4.4.4.2 Maths for understanding Big-0 notation and 4.4.4.3 Order of complexity Flashcards

1
Q

What is Big-O notation?

A

it is a way of defining how efficient an algorithm is by how “fast” it will run. You determine the algorithm’s notation by the worst case scenario run time.
see http://bigocheatsheet.com/

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

What is constant time?

A

O(1)
using a constant-size lookup table
One of the most ideal complexities

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

What is logarithmic time?

A

O(logn)
Finding an item in a sorted array with a binary search or a balanced search tree
One of the most ideal complexities

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

What is linear time?

A

O(n)

Finding an item in an unsorted list

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

What algorithms are O(nlogn)?

A

heapsort or merge sort

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

What is quadratic time?

A

Multiplying two n-digit numbers by a simple algorithm; bubble sort (worst case
quicksort (worst case),
selection sort or insertion sort

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

What is exponential time?

A
O(2^n)
Finding the (exact) solution to the travelling salesman problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is factorial time?

A

O(n!)

Solving the travelling salesman problem via brute-force search;

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