In this tutorial you will learn about the Difference Between Binary tree vs Binary Search tree and its application with practical example.
Difference Between Binary tree vs Binary Search tree
What Is Binary Tree?
In data structure the binary tree is that kind of tree where each node consist of only two child part, these parts are called as left child part and right child part and these upper nodes in which two different parts are present are called root nodes. In this the data are stores in these nodes and these nodes are denoted by a pointer and theses pointers denotes both left and right child part. In binary tree each node has three parts they are: pointer to the left node, data element and, pointer to the right node. Every binary tree has one root pointer which denotes the root node of binary tree and one empty binary tree denotes null to the root pointer. In this process of representation binary tree is stored in memory in form of linked list where a non contiguous memory location on nodes depends on their count. Binary tree has following two sub trees; they are (1) Strictly binary tree, (2) Complete binary tree.
What Is Binary Search tree?
In this kind of searching tree the systematic and sequential allocation of nodes are arranged, it is also called as the ordered binary tree, it is defined as in terms of binary tree class .In binary search tree the searching operation is very easy and settled and while operation it gives hint also for the desired element in that sub-tree. It is more dynamic and expert data structure then array and linked list, while searching it auto removes the half sub-tree which lower the effect of disturbance in searching. In binary search tree the time taken in searching of an element is denoted by o (log2n) .The time taken in searching of an element in the worst case is denoted by 0(n). It also provides speed in the operations like insertion and deletion.
Binary tree vs Binary Search tree
BINARY TREE | BINARY SEARCH TREE |
In this kind of non-linear data structure, each nodes contains two child nodes. | In binary search tree, the nodes based on binary tree contain left and right binary sub-tree. |
Due to is un ordered manner it is slower in operations like insertion and deletion. | Due to their ordered characteristics operation like insertion and deletion is faster. |
In this no order or sequence are present for the nodes to be arranged. | It is well organized and settled in terms of elements in the left sub-tree and right sub-tree greater then nodes. |
There are several types. Most common ones are the Complete Binary Tree, Full Binary Tree, and Extended Binary Tree. | The most popular ones are AVL Trees, Splay Trees, Tango Trees, and T-Trees. |