Algorithms Flashcards
What’s abstraction?
Removing unnecessary information to focus on the necessary information, to simplify an issue
Why is abstraction used?
Simplifies a problem by making it less complex, making it easier to resolve
What is decomposition?
Breaking down a problem into smaller parts to make it easier to understand
Why is decomposition used?
More people can work on the problem
Each part of the problem can be individually tested
What is algorithmically thinking?
The logical steps are followed to solve the problem
What is an algorithm?
A set of instructions presented in a logical sequence
How does a linear search work?
Each item is searched from start to end/ till item is found
Not efficient for large lists
How does a binary search work?
Data must be sorted
Finds the midpoint and checks if item = wanted item
Then decides if its greater or smaller and discards one of the halves
This repeated until the item is found
How does a merge sort work?
Divides a list of items in half again and again until each item is individual
The items are then put in pairs and reordered
The items are merged again and reordered until the whole list is ordered
How does bubble sort work?
Each item is compared with the other on the right and swapped if wrongly ordered, this will be repeated going down the list till it’s ordered
How does insertion sort work?
Items are split, the left side is ordered and right is unordered
An item from the right side is added to the left and order, this repeated till the list is ordered