




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth analysis of the Bubblesort and Mergesort algorithms, including the number of comparisons and passes, complexity, and runtime examples. Students of computer science and engineering will find this information useful for understanding the efficiency of different sorting methods.
Typology: Essays (high school)
1 / 8
This page cannot be seen from the preview
Don't miss anything!





Week 7
Bubblesort works by comparing and swapping values in a list
Bubblesort works by comparing and swapping values in a list
Largest value correctly placed
Look at the relationship between the two loops:
Therefore the complexity is:
Assume you are sorting 250,000,000 items N = 250,000, N 2 = 6.25 x 10^16 If you can do one operation per nanosecond (10-9^ sec) which is fast! It will take 6.25 x 10 7 seconds So 6.25 x 10 7 60 x 60 x 24 x 365 = 1.98 years
Log N
Log N
Assume same 250,000,000 items N*Log(N) = 250,000,000 x 8. = 2, 099, 485, 002
With the same processor as before
2 seconds