2.3.1 algorithms Flashcards

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

what is worst case average case and best case for a linear search

A

O(n) O(n), O(1)

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

what is worst case average case and best case for a Binary search

A

O(log(n)) O(log(n)) O(1)

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

what is worst case average case and best case for a binary search tree

A

O(n), O(log(n)), O(1)

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

what is worst case average case and best case for searching a hash table

A

O(n) O(1) O(1)

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

what is worst case average case and best case for a breadth/depth of a graph

A

O(v^2) O(V+E) O(1)

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

what is worst case average case and best case for a bubble sort

A

O(n^2) O(n^2) O(n)

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

what is worst case average case and best case for a insertion sort

A

O(n^2) O(n^2) O(n)

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

what is worst case average case and best case for a Merge sort

A

O(nlog(n)) O(nlog(n)) O(nlog(n))

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

what is worst case average case and best case for quick sort

A

O(n*log(n)) O(nlog(n)) O(n^2)

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

what is the space complexity of merge sort

A

O(n) (because it has to make temporary arays with a sieze proportional to the main array)

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

what is the space complexity of quick sort

A

O(log(n)) (dont have to know but makes log(n) recursive calls and makes an array of fixed size each recursive call)

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

what is the space complexity of bubble and insertion sort

A

O(1)

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