EXAM 3 FOCUS (Heaps, Hash Tables, Graphs, BST)

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/37

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

38 Terms

1
New cards

Heap property (min-heap)

Parent node is always smaller than its children

2
New cards

Heap stored how

Using an array representing a complete binary tree

3
New cards

Heap insert complexity

O(log n)

4
New cards

Heap remove-min complexity

O(log n)

5
New cards

Heap find-min complexity

O(1)

6
New cards

Percolate up purpose

Restore heap order after insert

7
New cards

Percolate down purpose

Restore heap order after deletion

8
New cards

Index of left child in heap

2*i + 1

9
New cards

Index of right child in heap

2*i + 2

10
New cards

Index of parent in heap

(i - 1) / 2

11
New cards

Why heap is not a BST

Heap only ensures heap-order, not sorted in subtrees

12
New cards

Hashing definition

Mapping keys to indices using a hash function

13
New cards

Collision definition

Two keys map to the same index

14
New cards

Collision handling methods

Chaining or open addressing

15
New cards

Load factor formula

Number of elements / table size

16
New cards

Hash table average search time

O(1)

17
New cards

Hash table worst-case search time

O(n)

18
New cards

Chaining advantage

Simple, flexible collision resolution

19
New cards

Linear probing issue

Primary clustering

20
New cards

Quadratic probing purpose

Reduces clustering

21
New cards

Double hashing purpose

Avoids clustering by changing step size

22
New cards

Graph adjacency list

Each vertex stores a list of neighbors

23
New cards

Graph adjacency matrix

VxV matrix storing edge values

24
New cards

BFS uses what

Queue

25
New cards

DFS uses what

Stack or recursion

26
New cards

BFS complexity

O(V + E)

27
New cards

DFS complexity

O(V + E)

28
New cards

Directed graph definition

Edges have direction

29
New cards

Undirected graph definition

Edges have no direction

30
New cards

Tree vs graph

Tree is acyclic, graph may contain cycles

31
New cards

BST property

Left child < root < right child

32
New cards

BST search average

O(log n)

33
New cards

BST search worst-case

O(n)

34
New cards

BST insert complexity

O(log n) average, O(n) worst

35
New cards

Inorder traversal produces

Sorted order

36
New cards

Min value in BST

Leftmost node

37
New cards

BST delete worst-case

O(n)

38
New cards

BST height relation

Affects all BST operations