Balanced Binary Search Tree Flashcards
1
Q
Worst Case pada operation BST?
A
O(n)
2
Q
Balanced Binary Search Tree, contohnya?
A
AVL Tree, Red Black Tree
3
Q
First self-balancing binary search tree?
A
AVL Tree
4
Q
AVL Tree Concept?
A
Height of a node:
- height of an empty sub tree is 0
- height of a leaf is 1
- height of an internal node is the maximum height of its children plus 1
balance factor of all nodes in AVL Tree at most 1
5
Q
Red Black Tree Concept?
A
- every node has a color, red or black
- root is black by default
- all external nodes are black
- if a node is red, the both its children are black
- no red node has a red parent
6
Q
Insertion RBT:
A
- if parent is black, no violation
2. if parent is red, violation occured