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 comparison, inserting 25 ,i need 1 comparison, insert 30 i need 2 comparison
like that to insert n th node i need (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)