Well, I didn't suggest a BST to be built In my reply #15 I suggested an O(log N) solution based on two slightly modified standard binary searches.Quote:
Originally Posted by ideru
Printable View
Well, I didn't suggest a BST to be built In my reply #15 I suggested an O(log N) solution based on two slightly modified standard binary searches.Quote:
Originally Posted by ideru
oh okay my bad, you did not suggest a BST ..:rolleyes:Quote:
Originally Posted by _uj
but its good the OP can now have some options on how to solve the problem ..
If you look closely, the sample code that seeguna posted is actually a binary search code :)Quote:
Originally Posted by ProgramThis
Yes, and you wouldn't have posted this comment if you knew the difference between a binary search and a binary search tree. :)Quote:
Originally Posted by ideru
I was suggesting that there is no need to use a BST when you can perform a binary search on the array. YOU suggested placing the array into a BST and then using that. I was reasoning that there was no need to create the tree because a binary search can already be done on an array.