2.1 Algorithms Flashcards
What is Abstraction?
Process of removing unnecessary details and including only the relevant details
What is Decomposition?
Breaking a complex problem into smaller more manageable parts
What is Algorithmic Thinking?
Creating a step by step solution to a problem
What are the 2 types of searching algorithms?
Binary and Linear search
What are the advantages of a Linear Search?
Simple
The list doesn’t need to be ordered
Easy to program
What are the disadvantages of a Linear Search?
Not efficient
Takes time with a lot of data
What are the advantages of a Binary Search?
More efficient than a linear search
What are the disadvantages of a Binary Search?
Only works on an ordered list
How does linear search work?
Checks each item in the list one by one until it finds what it is looking for
How does binary search work?
Finds the middle item in an ordered list By doing n+1/2 Compares the item to the middle item So it knows where to look in the first half of the second half Repeats until the item is found
What is a sorting algorithm?
Sorts items into an ordered list
How does a bubble sort work?
Checks the first 2 items in a list Swaps them if they are in the wrong order Moves to the next items and Repeats Moves through the entire list again Until ordered
How does a merge sort work?
Finds the middle item by (n+1)/2 Splits the list in half Repeats until items are paired Each time the sub-list are paired They are sorted into the correct order
How does an insertion sort work?
Looks at 2nd item in the list and compares it to the items that are in front of it
Then inserts it into the right place correctly
It is Quick for sorting small lists
What is the shape of the input box?
Parallegoram
What is the shape of a decision making?
Diamond
What is the shape of the process?
Rectangle
What does the lines show?
The control passing betweens the connected shapes
How do you output an statement?
Print(“hello”)