Balanced Binary Search Tree Flashcards

1
Q

Worst Case pada operation BST?

A

O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Balanced Binary Search Tree, contohnya?

A

AVL Tree, Red Black Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

First self-balancing binary search tree?

A

AVL Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

AVL Tree Concept?

A

Height of a node:

  1. height of an empty sub tree is 0
  2. height of a leaf is 1
  3. 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Red Black Tree Concept?

A
  1. every node has a color, red or black
  2. root is black by default
  3. all external nodes are black
  4. if a node is red, the both its children are black
  5. no red node has a red parent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Insertion RBT:

A
  1. if parent is black, no violation

2. if parent is red, violation occured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly