Binary Search Tree: Difference between revisions
Jump to navigation
Jump to search
Created page with "A Binary Search Tree is a binary tree with a specific ordering property: for any sub-tree, the left nodes is less that the root node and the right nodes is bigger to the root..." |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 7: | Line 7: | ||
'''Find''' and '''insert''' operations in a '''unbalanced''' Search Tree is '''O(n)''' whereas it is '''O(log n)''' in a '''balanced''' tree. | '''Find''' and '''insert''' operations in a '''unbalanced''' Search Tree is '''O(n)''' whereas it is '''O(log n)''' in a '''balanced''' tree. | ||
In order in Binary Search Tree, the in-order traversal is preferred. | In order in Binary Search Tree, the in-order traversal is preferred. | ||
Latest revision as of 05:10, 3 October 2020
A Binary Search Tree is a binary tree with a specific ordering property: for any sub-tree, the left nodes is less that the root node and the right nodes is bigger to the root node.
Searching in a Binary Search Tree is really fast thanks to its ordering property.
Insertion in a Binary Search Tree can unbalance the tree.
Find and insert operations in a unbalanced Search Tree is O(n) whereas it is O(log n) in a balanced tree.
In order in Binary Search Tree, the in-order traversal is preferred.