Algorithmic complexity Flashcards

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

Define time complexity

A

time it takes for a program to run

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

Define space complexity

A

memory that is required

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

Define Big O Notation

A

allows us to compare one algorithm to another as to choose the best option

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

How to calculate Big O

A

-take the highest power
e.g.
3n^3 + 4n^2
O(n^3)

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

What is the Big O for constant time complexity

A

O(1)

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

What is Big O for linear search

A

O(n)

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

What is Big O for binary search

A

O(logn)

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

What is Big O for Binary tree search

A

O(logn)

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

What is Big O for Bubble sort

A

O(n^2)

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

What is Big O for Merge sort

A

O(nlogn)

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

What is the order of complexities?

A
  • Constant
  • Logarithmic
  • Linear
  • Polynomial
  • Exponential
  • Factorial

‘Complexities love licking p*nises, especially Flynn’s’

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

Define intractable

A

it is too complex to be solved in polynomial time, heuristic methods can be used to find a ‘good enough’ solution
(DIFFERENT TO UNSOLVABLE)

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

Define heuristic method

A

practical methods to find a sufficient, but not optimal solution

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

Define halting problem

A
  • used by Alan Turing as proof that some problems are unsolvable for a computer
  • tell if program will halt without running it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is Big O for Travelling salesman

A

O(n!)

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

What is Big O for dynamic programming Travelling Salesman

A

O(a^n)

17
Q

What is big O for Hash table

A

O(1)