Trees and Transversals Flashcards

1
Q

What is in order transversal

A

Left → Root → Right

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

What is Preorder transversal

A

Root → Left → Right

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

What is Postorder transversal

A

Left → Right → Root

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

Why are AVL trees used

A

They are self-balancing BSTs, maintaining O(log n) operations

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

What’s the height of a complete binary tree with 15 nodes?

A

3 (0-based), since 15 = 2⁴ - 1

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

What property defines a min-heap?

A

Every parent is less than or equal to its children.

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

What’s the minimum number of nodes in an AVL tree of height h

A

F(h+2) − 1, where F is the Fibonacci sequence

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

In an AVL tree, what balance factor range is valid

A

Must be -1, 0, or +1

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

What is the balance factor of a leaf node in an AVL tree

A

0 — both left and right heights are -1

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

What’s the result of deleting the root in a BST and replacing it with a value from the right subtree?

A

The smallest value from the right subtree replaces the root

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

Can a min-heap also be a binary search tree?

A

No — BSTs must satisfy in-order value rules, heaps only structural.

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