Chapter 1 (Algorithms) Flashcards

1
Q

Prim’s algorithm, order?

A

Cubic

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

Kruskal’s algorithm, order?

A

Cubic

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

Bubble sort, order?

A

Quadratic

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

What’s an algorithm

A

A set of specific set of finite instructions for carrying out a procedure or solving a problem (usually terminate at one point).

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

Curved rectangular box meaning?

A

Start/ End

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

Rectangle box meaning?

A

Process (an instruction)

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

Diamond meaning?

A

Decision

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

How can you tell when a quick sort list of numbers are in order

A

Once every number has become a pivot (no more changes are made)

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

What do you do if the lower bound is not an integer?

A

Round up to the next whole number

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

First fit algorithm:

A

Take the items in the order they’re given, place each item in the first available bin that can take it. Start with bin one each time

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

Advantages and Disadvantages of the first fit bin algorithm:

A

Quick

Not likely to lead to a good solution

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

First fit decreasing algorithm:

A

Record the items so they’re in decreasing order

Apply the first fit algorithm to this recorded list

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

Advantages and disadvantages of the first fit decreasing algorithm:

A

Usually get fairly good solutions
Easy to do

You may not get the optimum solution

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

Full bin packing:

A

Use observation to find combinations of items that will fill a bin. Any remaining is packed using first fit algorithm.

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

Advantages and Disadvantages of Full bin packaging:

A

Good solution

Takes a long time

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

What can the order of an algorithm be described as?

A

As a function of its size

17
Q

If an algorithm has an order of f(n) then increasing the size of the problem from n to m will increase the run time by a factor of what?

A

f(m)/f(n)

18
Q

What number is definitely at the correct position after the first pass (list ascending order), in bubble sort?

A

The largest value

19
Q

What’s the max number of comparisons needed for a list of 10 numbers?

A

n-1

=9 comparisons