1,309 views
1 1 vote
Could a binary search tree be built using o(n lg n) comparisons in the comparison
model? Explain why or why not.

2 Answers

1 1 vote

In case of skewed BST (worst case) :  O(n2)  

Inserting first element ; 0 comparison

Inserting second element : 1 comparison

Inserting nth element : n-1 comparisons

Total : O(n2) comparisons

In case of Balanced BST : O(nlogn) 

Position:
Show:

Related questions

0 0 votes
1 1 answer
1.8k
1.8k views
dhingrak asked Dec 11, 2014
1,781 views
23. Suppose you are given $n$ numbers and you sort them in descending order as follows: First find the maximum. Remove this element from the list and find the maximum of ...
2 2 votes
1 answers 1 answer
2.4k
2.4k views
pankaj_vir asked Mar 19, 2018
2,366 views
Consider the following two statements:P: There exists a comparison sort of 5 numbers that uses at most 6 comparisons in worst case.Q: Heap sort can be used as the auxilia...
1 1 vote
1 answers 1 answer
1.1k
1.1k views
jenny101 asked Dec 9, 2016
1,135 views
Find the output after applying 2 passes of radix sort followed by 1 pass of bubble sort to the given integers: $120,231,417,343,542,998,675,196$. Tie is broken as per FIF...
2 2 votes
1 answers 1 answer
6.3k
6.3k views
worst_engineer asked Oct 7, 2015
6,307 views
Which of the following sorting methods will be the best if number of swapping done is the only measure of efficiencyI am getting Bubble sort , is it right ?Which of the f...