# Time complexity of searching an element in Binary Search Tree [closed]

I want to know what will be the time complexity to search, insert and delete an element in a) balanced binary search tree. b) unbalanced binary search tree.

## closed as unclear what you're asking by fade2black, Evil, David Richerby, Yuval Filmus, codyDec 7 '17 at 16:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• What have you tried and where did you get stuck? Those results are utterly standard. Where did you look? – Raphael Nov 29 '17 at 10:38
• For balanced Binary search tree this is what i think , for searching (assuming element needed is at leaf position) we would require to search upto last level , just like binary search the problem gets divided each time till we get the element therfore O(log n)..i dont know its correct or not...for unbalanced i dont know where to start... – JobLess Nov 29 '17 at 10:50
• I suggest you pick up a text book that explains the basics and then this analysis to you. I recommend Sedgewick's books. – Raphael Nov 29 '17 at 10:54
• This is what is writeen in the text ". The running times of algorithms on binary search trees depend on the shapes of the trees, which, in turn, depends on the order in which keys are inserted." So if shape of the tree skews either left or right then all the nodes will be present on one side only.. So suppose that element to be found is at last level ... N nodes needs to be visited hence it is O(n) is it correct – JobLess Nov 29 '17 at 12:06

• You mean $\Omega(n)$. – Raphael Nov 29 '17 at 10:39