Chapter 15 — Speeding Up All the Things with Binary Search Trees

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

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:03 PM on 7/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

40 Terms

1
New cards
Tree
A node-based data structure where nodes can connect to multiple child nodes
2
New cards
Root
The top node of a tree
3
New cards
Parent
A node that has child nodes below it
4
New cards
Child
A node below another node
5
New cards
Descendant
Any node that stems from another node
6
New cards
Ancestor
Any node above another node in its path
7
New cards
Level
A row of nodes in a tree
8
New cards
Binary tree
A tree where each node has zero, one, or two children
9
New cards
Binary search tree
A binary tree where left descendants are lesser values and right descendants are greater values
10
New cards
BST
Short for binary search tree
11
New cards
BST left rule
Values less than the current node go to the left
12
New cards
BST right rule
Values greater than the current node go to the right
13
New cards
BST search
Start at the root, compare the target, then move left or right
14
New cards
BST search left
Search left if the target is less than the current node
15
New cards
BST search right
Search right if the target is greater than the current node
16
New cards
BST search found
Stop when the current node equals the target value
17
New cards
BST search not found
Stop when the search reaches a dead end or null child
18
New cards
Balanced tree
A tree where subtrees are spread out evenly
19
New cards
Imbalanced tree
A tree where one side has many more nodes than the other
20
New cards
Balanced BST search Big O
O(log N), because each step moves down one level and eliminates many nodes
21
New cards
Imbalanced BST search Big O
O(N), if the tree becomes like a linked list
22
New cards
Why balanced BST search is fast
Each comparison eliminates either the left or right side of the tree
23
New cards
BST levels and log N
A balanced tree with N nodes has about log N levels
24
New cards
BST insertion
Search for the correct empty spot, then insert the new node there
25
New cards
BST insertion average Big O
O(log N), if the tree is balanced
26
New cards
BST insertion worst case
O(N), if the tree is badly imbalanced
27
New cards
Order of insertion
The order values are inserted can affect whether the tree becomes balanced or imbalanced
28
New cards
Sorted insertion problem
Inserting sorted values can make a BST act like a linked list
29
New cards
Randomized insertion benefit
Random insertion order can help create a more balanced tree
30
New cards
BST deletion
Removing a node while preserving the binary search tree rules
31
New cards
Leaf node
A node with no children
32
New cards
Delete a leaf node
Remove it directly from the tree
33
New cards
Delete node with one child
Connect the deleted node’s parent to the deleted node’s child
34
New cards
Delete node with two children
Replace it with its successor node
35
New cards
Successor node
The smallest value greater than the node being deleted
36
New cards
Finding a successor
Start at the right child, then keep going left until there is no left child
37
New cards
Rightmost node
The greatest value in a binary search tree
38
New cards
Find greatest value
Keep moving right until there is no right child
39
New cards
Ordered array vs BST
Both can search in O(log N), but BSTs can insert faster when balanced
40
New cards
Main lesson of Chapter 15
Binary search trees keep data ordered while allowing efficient search, insertion, and deletion when balanc