




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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