Algorithms Flashcards

1
Q

Order of common Big(O) complexities

A
  • Log(n)
  • n
  • n*Log(n)
  • n^2
  • 2^n
  • !n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Complexity of merge sort

A

n*Log(n)

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

Complexity of binary search

A

Log(n)

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

Approx for:
x + x/2 + x/4 + x/8 + ….

A

2x

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

Approx for:
(n - 1) + (n - 2) + (n-3) + …

A

(n(n-1))/2

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

Sum of power of 2

A

2^(n+1)

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

What is De Morgan’s law (2)

A

!(A or B) = (!A) and (!B)
!(A and B) = (!A) or (!B)

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

What are the problem solving steps (7)

A

Listen
Example
Brute Force
Test
Optimise
Implement
Walkthrough
Implement

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

What are the BUD optimisation steps (3)

A

Bottlenecks
Unnecessary Work
Duplicated Work

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

Formula for permutations of n objects placed at m coordinates where n<=m

A

m!/(m-n)

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