Advantages:
BST is fast in insertion and deletion etc when balanced.
Very efficient and its code is easier than link lists.
Disadvantages:
Shape of the tree depends upon order of insertion and it can be degenerated.
Searching takes long time.
Chat with our AI personalities
The complexity of binary search tree : Search , Insertion and Deletion is O(h) . and the Height can be of O(n) ( if the tree is a skew tree). For Balanced Binary Trees , the Order is O(log n).
A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
yes, why not,
O(log n)At each step of insertion you are either going to the left child or the right child. In a balanced tree, this will effectively cut the number of possible comparisons in half each time.
Ne=N2+1Here Ne=no. of leaf nodesN2= no. of nodes of degree 2