Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Binary tree execution time calculation
I have this question, that's,
Q1) if 1000 elements in a binary search tree takes one second to search an element, how long it will take for 10,000 elements ?
Big O for binary search tree O(log N). That means 1000 elements, log 1000 (base 2) = 9.96 ~= 10 comparison takes 1 second
For 10,000 element, log 10000 = 13.28 ~= 13 comparison, 13/10 = 1.3 seconds.
It takes 1.3 seconds for 10,000 elements.
Q2) Similarly one million elements binary tree takes one 1 second to search an element how long it take for 10 million elements?
For one million elements, log(1,000,000) = 19.93 ~= 20 comparison in 1 second.
For 10,million elements, log(10,000,000) = 23.25 ~= 23 comparison.
That's 23/20 = 1.15 seconds.
I am not sure whether I did the calculation correct. Please confirm and correct my calculation.