Deck 2: Trees & BSTs

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

18 Terms

1
New cards

What is a root node?

The only node with no parent.

2
New cards

What is a leaf node?

A node with no children.

3
New cards

What is a parent node?

A node directly above another node.

4
New cards

What is a child node?

A node directly below another node.

5
New cards

What are siblings?

Nodes with the same parent.

6
New cards

What is an ancestor?

Any node above another node.

7
New cards

What is a descendant?

Any node below another node.

8
New cards

What is tree size?

The total number of nodes.

9
New cards

What is tree depth?

The distance from the root to a node.

10
New cards

What is tree height?

The length of the longest path from root to leaf.

11
New cards

What is a subtree?

A node and all of its descendants.

12
New cards

What is a binary tree?

A tree where each node has at most two children.

13
New cards

BST property?

Left subtree < Parent < Right subtree.

14
New cards

What is a balanced tree?

A tree whose leaf node depths differ by at most 1.

15
New cards

Why are balanced trees useful?

Searching is O(log n).

16
New cards

What is a perfect tree?

All leaves are on the same level and every internal node has the maximum number of children.

17
New cards

What is a degenerate tree?

A tree where each parent has only one child.

18
New cards

Why is a degenerate BST inefficient?

Searching becomes O(n).