Decision 1 Chapter 1 - Algorithms Flashcards

1
Q

Flow chart syntax - Start / End

A

Box with rounded edges

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

Flow chart syntax - Instruction

A

Rectangle

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

Flow chart syntax - Decision

A

Diamond

Two arrows coming from it with “yes” and “no”

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

Bubble sort algorithm

A

1 - Starting at he beginning of the list pass through and compare adjacent values. For each pair:
- If in order leave
- If not in order swap
2 - When at the end of the list repeat step 1
3 - When a pass is completed without any swaps the list is in order

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

Quick sort algorithm

A

1 - Choose the item at the middle of the list to be the pivot (if the list has an even length the item to the right of the middle)
2 - Write down all the numbers less than the pivot, keeping their order, in a sub list
3- Write down the pivot
4- Write down the remaining items in a sub list
5 - Apply steps 1-4 to each sub list recursively
6 - When all items are pivots, stop

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

Binary search algorithm

A

1 - Select the middle item in the list
2 - If it is the target the search is complete
3 - If the item is larger than the target delete the second half of the list including the selected item
4 - If the item is smaller than the target delete the first half of the list including the selected item
5 - Repeat steps 1-4 until either the target is found or not

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

What bubble sort and quicksort do

A

Order a list

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

What binary search does

A

Checks whether a value is in an ORDERED list

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

First fit algorithm

A

1 - Take the items in the order given

2 - Place each item in the first available bin that will take it

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

Advantage of first fit algorithm

A

It is quick and easy to do

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

Disadvantage of first fit algorithm

A

It is not likely to give 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

1 - Reorder the list so that it is in descending order

2 - Place each item at the first available bin that will take it

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

Advantage of first fit decreasing algorithm

A

You usually get a fairly good solution and it is easy to do

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

Disadvantage of first fit decreasing algorithm

A

You may not get an optimal solution

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

Full bin packing algorithm

A

1 - Use observation to find combinations of items that will fill a bin and pack these first
2- Pack any remaining items with first fit

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

Advantage of full bin packing algorithm

A

You usually get a good solution

17
Q

Disadvantage of full bin packing algorithm

A

It is difficult to do especially with plentiful or awkward numbers