Searching And Sorting Flashcards
What is an algorithm?
A set of step by step instructions that describes how to get something done or solve a problem
What can algorithms be designed by ?
Pseudocode and flowcharts
1st feature of linear searches ?
Moves through a list one at a time, starting on the left
2nd feature of linear searches ?
Very simple to create and run
3rd feature if linear searches ?
The list doesn’t have to be in order
4th feature of linear searches?
Very slow, inefficient and takes a lot of comparisons
Binary search feature 1
Looks at the middle number .
Is it the target number?
Is it greater or less?
Binary search feature 2
Half of the list is discarded If it’s too small or large
And the process starts again
Binary search feature 3
Very efficient and much quicker than linear search , uses less comparisons
Binary search feature 4
The list must be in order for it to work
Bubble search feature 1
Moves the a list, comparing two numbers at a time
Bubble sort feature 2
Numbers are swapped if the left number is greater
Bubble sort feature 3
The process is repeated until the list is in order
Bubble sort feature 4
Simple to create and run
Bubble sort feature 5
Slow, inefficient and requires a large number of comparisons
Insertion sort feature 1
Puts the first number into a sorted list
Insertion sort feature 2
Compared the rest of the numbers in the unsorted list with the sorted list,
one by one
Inserting them into the correct place
Insertion sort feature 3
More complicated than bubble sort
Much faster
Requires less comparisons