Binary Tree Data Structure
A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child.
Binary Search Tree Data Structure
Binary Search Tree is a node-based binary tree data structure which has the following properties:
- The left subtree of a node contains only nodes with keys lesser than the node’s key.
- The right subtree of a node contains only nodes with keys greater than the node’s key.
- The left and right subtree each must also be a binary search tree.
- There must be no duplicate nodes.
Difference between Binary Tree and Binary Search Tree:
|BINARY TREE||BINARY SEARCH TREE|
|BINARY TREE is a non linear data structure where each node can have almost two child nodes||BINARY SEARCH TREE is a node based binary tree which further has right and left subtree that too are binary search tree.|
|BINARY TREE is unordered hence slower in process of insertion, deletion and searching.||Insertion, deletion, searching of an element is faster in BINARY SEARCH TREE than BINARY TREE due to the ordered characteristics|
|IN BINARY TREE there is no ordering in terms of how the nodes are arranged||IN BINARY SEARCH TREE the left subtree has elements less than the nodes element and the right subtree has elements greater than the nodes element.|
- Minimum swap required to convert binary tree to binary search tree
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Binary Tree to Binary Search Tree Conversion
- Binary Tree to Binary Search Tree Conversion using STL set
- Count the Number of Binary Search Trees present in a Binary Tree
- Difference between General tree and Binary tree
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Difference between Binary tree and B-tree
- Make Binary Search Tree
- Search a node in Binary Tree
- Sum of all the levels in a Binary Search Tree
- Floor in Binary Search Tree (BST)
- Optimal Binary Search Tree | DP-24
- Iterative Search for a key 'x' in Binary Tree
- Binary Search Tree | Set 2 (Delete)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.