What is the worst case time complexity to construct a binary search tree.??? Now i know ,that if a BST is left or right-skewed, searching an element takes O(n) time.so suppose i want to insert 10,25,30,35,40 in a bst.. it will be completely right skewed.. So when inserting 10 i need 0 ... n-1) comparisons so overall work =0+1+2+...+(n-1)=N(n-1)/2= O(n2) Am i correct here?? or it is O(nlogn)

asked
Jan 25, 2017
in Algorithms
649 views