Algorithms Flashcards

(23 cards)

1
Q

What are the conditions for an algorithm

A

It must be finite and deterministic

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

What does finite mean

A

It must terminate, algorithms can’t loop infinitely

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

What does deterministic mean

A

A single input must result in the same output every time. No randomness

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

What does recursive mean

A

Processes that loop

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

What is a stopping condition

A

The conditions under which which an algorithm will stop

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

What does a counter do

A

It will increment each loop

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

What is a heuristic method

A

A heuristic method is quick and solves problems reasonably well, but not optimally

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

What is a greedy method

A

It is short sighted, making the best choice at any given time which may not provide the best solution overall

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

What is an ad hoc method

A

It is made up on the spot and specific to the exact problem being solved

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

What is the maximum run time represented as

A

T(n)

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

What is the order of an algorithm

A

The dominant term in the run-time for a large scale problem, denoted O(n)

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

Do the bubble sort of 7,10,201,98,2

A

DRAW IT

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

Do the quick sort of 7,10,201,98,2

A

DRAW IT

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

Do the shuttle sort of 7,10,201,98,2

A

DRAW IT

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

What is the order of a bubble sort

A

O(n^2)

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

What is the order of a shuttle sort

17
Q

What is the order of quick sort in its worst case

18
Q

What is the next fit algorithm

A

Take them in the order they’re listed and put each in the first bin that can fit them, starting each time with the bin that was most recently used

19
Q

What is the first fit algorithm

A

Take the items in the order listed and pack each in the first bin that they can fit in, starting with the first bin each time

20
Q

What is a first fit decreasing algorithm

A

Order the items from largest to smallest, then apply the first fit method

21
Q

What is the full bin method

A

Look for combinations of items that will fill bins and pack them together. Pack the other items together to result in bins as close to full as possible.

22
Q

What is an offline problem

A

A problem where all the items and weights are known from the outset

23
Q

What is an online problem

A

A problem where the items/weights are released one at a time