Trees Flashcards

1
Q

What is a binary search tree (BST)?

A

Left subtree < root < right subtree.

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

What is the difference between a BST and a heap?

A

BST supports ordered access, Heap is optimized for min/max extraction.

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

What is an AVL tree?

A

Self-balancing BST

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

What is the purpose of tree rotations in AVL trees?

A

Used in AVL trees to maintain balance.

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

What is the difference between a B-tree and a BST?

A

B-Trees allow multiple children per node (good for databases).

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

What is a Trie? What are its use cases?

A

Prefix tree for fast word lookup.

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

How does a segment tree work?

A

Fast range queries (O(log n) updates and queries).

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

What is the purpose of an interval tree?

A

Efficiently handles interval-based queries.

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