FINAL - Running Times Flashcards

1
Q

Integer multiplication

A

n^lg 3 (3 multiplication subproblems)

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

Strassen’s algorithm

A

n^lg 7 (7 multiplication subproblems!)

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

Maximum subarray

A

n lg n (2T(n/2) + n)

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

Heap Sort

A

n lg n (do lg n heap deletion n times!)

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

Heap Insertion

A

lg n

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

Heap Deletion

A

lg n

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

Heap Deletion best case

A

O(1)

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

Bottom-up heap construction

A

n

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

MCM

A

n^3

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

BFS

A

O(V + E)

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

DFS

A

O(V + E)

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

Topological sort

A

O(V + E), since DFS is the implementation mechanism

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

Strongly-Connected Components

A

O(V + E), since running DFS 2x is the implementation!

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

Prim’s algorithm

A

O(V + E log V)

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

LCS

A

O(n*m)

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

Insertion sort (avg)

A

n^2

17
Q

Quicksort (avg)

A

n lg n

18
Q

Quicksort (worst)

A

O(n^2)

19
Q

Mergesort

A

n lg n

20
Q

Counting sort

A

n + k

21
Q

Radix sort

A

nk

22
Q

Bucket sort (worst)

A

O(n^2)

23
Q

Bucket sort (avg)

A

n + k

24
Q

Selection sort

A

n^2

25
Q

Making change

A

n

26
Q

Maximum Subarray (DP)

A

n

27
Q

Rod-cutting

A

n^2

28
Q

Kruskal’s algorithm

A

O(E lg E)