Algorithm Complexities Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Insertion Sort

A

Best Case: O(n)
Worst Case: O(n^2)
Average: O(n^2 / 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Selection Sort

A

O(n^2 / 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Merge Sort

A

O(n log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Quick Sort

A

O(n log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Heap Sort

A

O(n log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Sequential Search

A

O(n/2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Binary Search

A

O(log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Binary Search Tree

A

Worst Case: O(n)

Average: O(1.39 log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Red-Black Search Tree

A

O(log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Depth-First Search

A

O(E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Breadth-First Search

A

O(V+E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Prim’s MST Algorithm

A

O(E log E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Kruskal’s MST Algorithm

A

O(E log E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Dijkstra’s Shortest-Path Algorithm

A

O(E log V)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Longest Path in DAG

A

O(E + V)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Bellman-Ford

A

O(EV)

17
Q

Ford-Fulkerson

A

O(VE^2 / 2)

18
Q

Stable Matching

A

O(n^2)

19
Q

A*

A

Roughly same as Dijkstra’s, though slightly better: O(E log V)

20
Q

Memoization

A

Saving values that have already been calculated - part of dynamic programming