2.1 Algorithims Flashcards
1
Q
What is an algorithm?
A
- Set of instructions
2
Q
What is decomposition?
A
- Breaking up data
- Smaller more manageable parts
3
Q
What is abstraction?
A
- Ignoring parts of data
- Faster outcome
4
Q
What does a rounded rectangle represent in flowcharts?
A
- Start / Stop
5
Q
What does a rectangle represent in flowcharts?
A
- Process
6
Q
What does a diamond represent in flowcharts?
A
- Decision
7
Q
What does a diamond represent in flowcharts?
A
- Decision
8
Q
What does a parallelogram represent in flowcharts?
A
- Input / Output
9
Q
What does a rectangle with two lines inside represent?
A
- Subroutine
10
Q
What is a variable?
A
- A location in memory
- Can be changed while the program is running
11
Q
What are the steps for a bubble sort?
A
- Start at the beginning of the values
- Compare the first and second values : if not in order, swap
- Continue through the list
- Repeat through the list until in order
- Do one last pass to ensure order
** One comparison is one pass
12
Q
What are the steps for merge sort?
A
- Split all elements into individual lists
- Compare the first elements of the lists
- Place the smallest in a new list
- Continue to compare first elements of the lists
- Repeat until individual lists have merged
13
Q
What are the steps for an insertion sort?
A
- The item is taken and placed in the correct position
- Continue through
- Repeat until sorted
14
Q
When is a bubble sort the better choice?
A
- Shorter list
- Mostly in order
15
Q
When is a insertion sort the better choice?
A
- Mostly in order