AVL Tree (Module 8.3) Flashcards

1
Q

What determines the cost of lookup?

A

how far down the tree needs to go

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

The number of nodes on the longest path from the root to a leaf is the ______ of the tree.

A

height

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

The lookup for a tree of height h has ALWAYS which complexity?

A

O(h)

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

A tree is balanced if ________, where h is its height and n is the number of nodes.

A

h - O(log n)

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

What are the 3 requirements for balanced trees?

A

1) the tree is a BST
2) all paths from the root to a leaf have height either h or h-1
3) the leaves at height h be on the left-hand side of the tree

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

Trees that remain balanced as inserting new nodes and continue to be a valid BST is known as?

A

self-balancing

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

What is it called when at every node, the heights of the left and right subtrees differ by at most 1?

A

height invariant

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

What is used when an imbalance occurs in a straight-line pattern?

A

Single Rotation

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

Which type of rotation occurs when a node is inserted into the left subtree of the left child?

A

LL (Left-Left) Rotation

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

Which type of rotation is performed on an unbalanced node for LL Rotation?

A

Right rotation

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

Which type of rotation occurs when a node is inserted into the right subtree of the right child?

A

RR (Right-Right) Rotation

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

Which type of rotation is performed on the unbalanced node for RR Rotation?

A

Left rotation

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