2.1 algorithms Flashcards
Whats abstraction?
When you remove unnecessary details
What’s decomposition?
Break down a complex problem into smaller parts
Whats algorithm thinking?
A way of getting to a solution by identifying individual steps needed
Flowchart symbols (diamond, rectangle, parallelogram, oval)
🔷=desision
Rectangle=process
Parallelogram=input/outut
🟡=terminal
Binary search?
1234567 looking for 5
Go to the middle
1234567 5>3
Go to the middle of the right side as it’s bigger
1234567 5<6
1234567 5
Linear search?
1234 Looking for 3
1==3? No
2==3? No
3==3? Yes
Bubble?
3241
2341
2341
2314. 1st pass
2314
2314
2134. 2nd pass
2134
1234 3rd pass
Merge?
2134
↙️↘️
12. 34
1 2 3 4
1234
Insertion?
11 2 21 -2
11 2 21 -2
2 11 21 -2
2 11 21 -2
-2 2 11 21