Graph/Searching Algs

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

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

22 Terms

1
New cards

Breadth-First Search (BFS)

traverses the graph level by level using a queue

2
New cards

BFS Runtime

O(V + E) using adjacency list

3
New cards

BFS Uses

shortest paths in unweighted graphs

4
New cards

Depth-First Search (DFS)

traverses the graph as deep as possible using stack or recursion

5
New cards

DFS Runtime

O(V + E) using adjacency list

6
New cards

DFS Uses

cycle detection

7
New cards

Dijkstra’s Algorithm

finds shortest paths from a source vertex in a weighted graph with non-negative weights using a min-priority queue

8
New cards

Dijkstra Runtime

O(E log V) using binary heap

9
New cards

Dijkstra Uses

single-source shortest path in weighted graphs

10
New cards

Prim’s Algorithm

finds Minimum Spanning Tree by starting at a node and growing the MST one minimum-weight edge at a time using a priority queue

11
New cards

Prim Runtime

O(E log V) using binary heap

12
New cards

Prim Uses

constructing Minimum Spanning Tree for weighted graphs

13
New cards

Kruskal’s Algorithm

finds Minimum Spanning Tree by sorting all edges by weight and adding edges that do not create a cycle using Disjoint Set Union

14
New cards

Kruskal Runtime

O(E log V)

15
New cards

Kruskal Uses

constructing Minimum Spanning Tree for weighted graphs

16
New cards

Disjoint Set Union (Union-Find)

maintains disjoint sets of elements

17
New cards

DSU Runtime

nearly O(1) per operation (inverse Ackermann)

18
New cards

DSU Uses

cycle detection in Kruskal’s Algorithm

19
New cards

Graph Representation - Adjacency List

stores for each vertex a list of neighbors

20
New cards

Adjacency List Runtime

O(V + E) to traverse all vertices and edges

21
New cards

Graph Representation - Adjacency Matrix

stores a VxV matrix with edge weights or 0/1 for edges

22
New cards

Adjacency Matrix Runtime

O(V^2) to traverse all edges