What is the time complexity for insertion in binary tree in worst case?
For inserting element as the left child of D(either in a left-skewed binary tree or right skewed binary tree), we have to traverse all elements(i.e. A, B, C, D). Therefore, insertion in the binary tree has worst-case complexity of O(n).
64.3k questions
77.9k answers
244k comments
80.0k users