Algorithm-finding kth next element in an array -
i couldn't solve question can please help?
for i=1 i=n/2, if a[i]<=a[2i] , a[i]<=a[2i+1] called "bst" what's time complexity finding kth smallest element in bst n elements?
there 2 methods:
- o(k ln(n)) time complexity.
- o(k ln(k)) time complexity + o(k) space complexity.
Comments
Post a Comment