Binary search has a average case performance as O(log n) and Quick Sort with O(n log n) is O(n log n) is same as O(n) + O(log n)
Binary search has a average case performance as O(log n) and Quick Sort with
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Imagine a database with with every person in the world. That’s 6.7 billion entries. O(log n) is a lookup on an indexed column (e.g. primary key). O(n log n) is returning the entire population in sorted order on an unindexed column.
Another way to imagine it:
log nis proportional to the number of digits in n.n log nis n times greater.Try writing the number
1000once versus writing it one thousand times. The first takes O(log n) time, the second takes O(n log n) time.Now try that again with
6700000000. Writing it once is still trivial. Now try writing it 6.7 billion times. Even if you could write it once per second you’d be dead before you finished.