Algorithms Flashcards
1
Q
What is Decomposition?
A
- breaking a complex problem down into smaller problems & solving each one individually
2
Q
What is Algorithmic Thinking?
A
- a logical way of getting from the problem to the solution
- if the steps you take to solve a problem follow an algorithm then they can be reused & adapted to solve similar problems in the future
3
Q
What is Abstraction?
A
- picking out the important bits of information from the problem, ignoring the specific details that don’t matter
4
Q
A
Start/Stop
5
Q
A
Processes
6
Q
A
Input/Output
7
Q
A
Decision
8
Q
A
Sub Program
9
Q
A
Arrows
10
Q
What does binary search look for?
A
- Items in an ordered list
11
Q
What is the first stage in binary search?
A
- Find the middle item in the ordered list
- To find the middle item in a list of n items do (n + 1) / 2 & round up if necessary
12
Q
What is the second stage in binary search?
A
- If this is the item you’re looking for, then stop the search - you’ve found it
13
Q
What is the third stage in binary search?
A
- If not, compare the item you’re looking for to the middle item
- If it comes before the middle item, get rid of the second half of the list
- If it comes after the middle item, get rid of the first half of the list
14
Q
What is the fourth stage in binary search?
A
- You’ll be left with a list that is half the size of the original list
- Repeat stages 1 to 3 on this smaller list to get an even smaller one
- Keep going until you find the item you’re looking for
15
Q
What are linear searches used on?
A
- an unordered list
16
Q
What is the first stage in linear search?
A
- Look at the first item in the unordered list
17
Q
What is the second stage in linear search?
A
- If this is the item you’re looking for - then stop the search - you’ve found it