2.3.4 average time complexities of different searching algorithms Flashcards

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

Linear search

A

O(n)
Worst case is O(n)
Best case is O(1) (finding it instantly)

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

Binary search (array)

A

O(log(n))
Worst case is O(log(n))
Best case is O(1)

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

Binary search (tree)

A

O(log(n))
Worst case is O(n)
Best case is O(1)

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

Hashing

A

O(1)
Worst case is O(n)
Best case is O(1)

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

Breadth/depth first of graph

A

O(V+E) (number of vertices + number of edges)
Worst case is O(V^2) (number of vertices, squared)
Best case is O(1)

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