Data Structure and Algorithms #4

Computer Science Level pending

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?

O(n) O(log n) O(2^n) O(1)

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Selection sort requires only O(n) swaps

see for details : http://www.geeksforgeeks.org/which-sorting-algorithm-makes-minimum-number-of-writes/

But the question wasn't about sorting... To insert a number to a BST worst case is we go to the longest leaf... And I got why I am wrong now.. It's a BST NOT AVL the hight might be n.. Sorry

Suna Nawatha - 4 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...