Graph Theory, Hashing, and Priority Queues

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/28

flashcard set

Earn XP

Description and Tags

Flashcards covering algorithm complexities for Prim's and Kruskal's, Disjoint Set operations, graph connectivity terminology, search algorithms (BFS/DFS), hashing techniques, and Priority Queue data structure performance.

Last updated 7:26 AM on 8/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

29 Terms

1
New cards

Prim's Algorithm (Adjacency List + Binary Heap) Complexity

The total time complexity is O((V+E) log V)O((V + E) \text{ } \text{log} \text{ } V), where binary heap operations are O(V log V)O(V \text{ } \text{log} \text{ } V) and O(E log V)O(E \text{ } \text{log} \text{ } V), and initialization is O(V)O(V).

2
New cards

Prim's Algorithm (Adjacency List + Unsorted) Complexity

The total time complexity is O(V2)O(V^2), with operations broken into O(V)O(V) for initialization, O(V×V)O(V \times V) for extract-min, and O(E×1)O(E \times 1) for decrease-key.

3
New cards

Prim's Algorithm (Adjacency Matrix + Binary Heap) Complexity

The total time complexity is O(V2 log V)O(V^2 \text{ } \text{log} \text{ } V), based on O(V)O(V) initialization and O(V log V)O(V \text{ } \text{log} \text{ } V) heap operations.

4
New cards

Prim's Algorithm (Adjacency Matrix + Sorted) Complexity

The total time complexity is O(V3)O(V^3) due to O(V2+V)O(V^2 + V) operations.

5
New cards

Kruskal's Algorithm Initialization

The complexity of the making/initialization step is O(V)O(V).

6
New cards

Kruskal's Algorithm Sorting

The complexity of sorting the edges is O(E log E)O(E \text{ } \text{log} \text{ } E).

7
New cards

Total Kruskal's Complexity

The total complexity is O((E+V) log V)O((E + V) \text{ } \text{log} \text{ } V) or E log E+E log VE \text{ } \text{log} \text{ } E + E \text{ } \text{log} \text{ } V.

8
New cards

MakeSet(x)

A Disjoint Set operation with a complexity of O(1)O(1).

9
New cards

Union

A Disjoint Set operation that combines sets with a complexity of O(1)O(1).

10
New cards

FindSet

A Disjoint Set operation that finds and returns a pointer to xx (which is yy) with a complexity of O(min(x,min y))O(\text{min}(x, \text{min } y)).

11
New cards

Strongly Connected Graph

A graph where you can reach all other nodes through a directed edge or path.

12
New cards

Weakly Connected Graph

A graph that would be strongly connected if the edges were undirected; a component can be its own SCC (Strongly Connected Component).

13
New cards

Sink

A node with an outdegree of 00.

14
New cards

Source

A node with an indegree of 00.

15
New cards

BFS (Breadth First Search)

Used for unweighted, cyclic, directed or undirected graphs with a complexity of O(V+E)O(V + E).

16
New cards

DFS Discovery Labels

Labels used during Depth First Search including undiscovered, discovery, forward, backward, and cross.

17
New cards

Topological Sort

A method to order a graph into a list; it will terminate early if there is a cycle and only works with a DAG (Directed Acyclic Graph).

18
New cards

Kahn's Algorithm

A method for Topological Sort that uses a queue and indegree counts.

19
New cards

Unordered Map

A data structure using hashing with O(1)O(1) average complexity for find, insert, and erase; it is less memory efficient but faster than other maps.

20
New cards

Chaining

A collision method for hashing where the key is mapped via key % table size\text{key} \text{ } \% \text{ } \text{table size}; remains O(1)O(1) if the hash function is good.

21
New cards

Linear Probing

A collision resolution method that finds the next available spot and can loop around; uses the formula h(x)=h1(x)+ih(x) = h_1(x) + i where i=0,1,2, ...i = 0, 1, 2, \text{ } ...

22
New cards

Quadratic Probing

A collision resolution method using the hash function formula f(x,i)=(h(x)+i2) % 5f(x, i) = (h(x) + i^2) \text{ } \% \text{ } 5, where ii increases upon collision.

23
New cards

Double Hashing

A complexity resolution method where h1(x)=x3h_1(x) = x - 3 and h2(x)=x×7h_2(x) = x \times 7 are used in the formula f(x,i)=(h1(x)+i×h2(x)) % 5f(x, i) = (h_1(x) + i \times h_2(x)) \text{ } \% \text{ } 5.

24
New cards

Priority Queue (ADT) Operations

Standard operations for this Abstract Data Type include top, push, and pop.

25
New cards

Heapify Complexity

The time complexity for the heapify operation is O(n)O(n).

26
New cards

Heapify Swaps

The number of swaps in heapify is calculated as node number×height\text{node number} \times \text{height}, not the depth.

27
New cards

Sorted Array Complexity (Priority Queue)

For a sorted array, push is O(n)O(n), pop is O(1)O(1), and top is O(1)O(1).

28
New cards

Unsorted Array Complexity (Priority Queue)

For an unsorted array, push is O(1)O(1), pop is O(n)O(n), and top is O(n)O(n).

29
New cards

Heap Complexity (Priority Queue)

For a heap, push is O(log n)O(\text{log } n), pop is O(log n)O(\text{log } n), and top is O(1)O(1).