test for Big O, sorting and searching Flashcards

1
Q

complexity is

A

the amount of time and space that an algorithm requires to be executed

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

what is an example of a logarithmic complexity

A

binary search

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

what is an exmaple of an algorithm with pylonomial complexity O (n^2)

A

bubble sort, insertion sort

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

what is the time complexity of a recursive algorithm

A

Exponential O(2^n)

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

what is the best time complexity for all the search algorithms

A

O(1)

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

what is the worst time complexity for a quick sort

A

O(n^2)

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

what is the worst time complexity for hashing

A

O(n)

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

what is the best and the average / worst time complexity for insertion and bubble sort

A

best : O(n)
worst/average: O(n^2)

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

what is heuristics

A

it estimates the shortest path from the start node.
it is used to improve efficiency as it prioritises nodes that are likely to lead to the shortest path

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

what is the difference between A* and dijkstras

A

D explores all the nodes in a graph, finding the shortest path without considering heuristics
A* uses heuristics to prioritize nodes with the lowest estimated cost, improving efficiency

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