Algorithms/ solving Problems Flashcards

1
Q

existence problem

A

determining if there is a solution

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

construction problem

A

finding a solution to the problem

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

enumeration

A

finding how many solutions there are to a problem

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

optimisation

A

finding the best solution to a problem

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

pigeon hole principal

A

if there are m pigeonholes and n pigeons, where m

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

proper subset

A

a part of a set that is smaller than the original set

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

number of ways of arranging n objects where non are repeated

A

n!

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

if there are n numbers and r positions to arrange them and a number cannot be repeated then the number of ways of arranging the numbers is

A

n!/(n-r)!

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

choosing n items from a set of r where the order doesn’t matter

A

r!/n!

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

The number of combinations of r objects from n is

A

n!/(n-r)!r!

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

inclusion exclusion principal

A

|AUBUC| = |A|+|B|+|C|-|A∩B|-|B∩C|-|A∩C|+|A∩B∩C|

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

order of an algorithm

A

The value with the largest exponent with the coefficient

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

Bin packing algorithms

A

next-fit
first-fit
first-fit decreasing

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

Comparisons in bubble sort

A

decrements with each pass

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

Comparisons in shuttle sort

A

random

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

If there are no swaps in bubble sort

A

the list is sort

17
Q

what is the maximum number of passes for a bubble sort algorithm

A

n - 1

n is the number of passes

18
Q

finding the lower bound for a bin packing algorithm

A

adding all the contents and dividing it by the bin size. This gives minimum number of bins to be used.

19
Q

Quadratic complexity

A

Doubling the size of the problem results in four times the effort

20
Q

Linear complexity

A

Doubling the size of the problem doubles the effort

21
Q

worst case time complexity of a quick sort

A

O(n^2)

if the list in in reverse order

22
Q

first fit decreasing in 3D

A

sort by length, height, perimeter or area

23
Q

Knapsack problems

A
  • workout value per kg
  • the highest value per kg should go in the knapsack
  • the remaining knapsack can be filled optimally by trial and error
24
Q

Derangement formula

A

Dn = (n-1)(Dn-2)(Dn-1)

25
Q

For passwords…

A

use selections n!/(n-r)!