849 views
1 votes
1 votes
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 votes
1 votes

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) 

Related questions

0 votes
0 votes
1 answer
1
dhingrak asked Dec 11, 2014
1,115 views
2 votes
2 votes
1 answer
2
pankaj_vir asked Mar 19, 2018
1,526 views
1 votes
1 votes
1 answer
3
jenny101 asked Dec 9, 2016
564 views
2 votes
2 votes
1 answer
4
worst_engineer asked Oct 7, 2015
5,573 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 ?