In what order is the node retrieved using Pre-order Traversal?
Root-Left-Right
In what order is the node retrieved using In-order Traversal?
Left-Root-Right
In what order is the node retrieved using Post-order Traversal?
Left-Right-Root
What are the key steps for searching in a BST?
What are the key steps in adding a node to a BST?
What is the minimum possible height of a BST for n number of nodes?
square root(n+1)
What is a binary tree?
A binary tree is a tree where each node has at most two children.
The two children of a node are commonly referred to as the left child and the right child of the node
What is a binary search tree?
A binary search tree is a binary tree in which all values smaller than a node are stored in that node’s left subtree and all values larger than a node are stored in that node’s right subtree
How can an unbalanced binary tree be rebalanced?
The binary search tree needs to be re-created or rebalanced with the same items to make it balanced
What are the advantages of Binary Search Tree? (3 in total)
Enables the use of binary search on a data structure that is guaranteed to remain sorted.
Adding elements into a BST has a time complexity of O(log n), vs append-and-sort operations for an array which have a time complexity of O(n log n) using merge sort.
Insertion and deletion of items involves the updating of pointers instead of rearranging elements, making the operations much more efficient, especially when the data stored in each entry is large
What are the disadvantages of Binary Search Tree?
What is an unbalanced binary search tree?
A binary search tree is unbalanced when one side of the tree has many more elements/nodes than the other side
Why is an unbalanced binary tree disadvantageous?
This makes binary search of the binary search tree inefficient
because the time complexity of binary search becomes almost O(n) instead of O(lg n)