**Binary Search tree** or BST or sorted binary tree is a binary tree in which each internal node X stores an element such that the element stored in the left subtree of X are less than or equal to X and elements stored in the right subtree of X are greater than or equal to X. The left and right subtree each must also be a binary search tree.Inorder traversal of binary tree always gives an ascending sorted array of elements.

Operations |
Average Case Complexity |
Worst Case Complexity |

insertion | O(log n) | O(n) |

search | O(log n) | O(n) |

deletion | O(log n) | O(n) |

BST creation takes O(n) space complexity.

**Java Code for Binary Search Tree :**

1 2 3 4 5 6 7 8 9 10 11 12 13 |
class BinarySearchTree { int data; BinarySearchTree left; BinarySearchTree right; public BinarySearchTree(int data) { super(); this.data = data; this.left = null; this.right = null; } } |

**Problems :**

**1 :** insert,search,delete and traversal operation in BST

** 2 :** check if the given Binary tree is BST or not.

**3 :** Minimum value node in a binary search Tree

** 4 :** Lowest Common Ancestor in a BST