3.1.3 Searching Algorithms Flashcards
1
Q
Hoe does the Linear search Algorithm work?
A
It goes through each piece of data 1 by 1 until data is found (if data not found it just goes through start - end)
2
Q
How does the Binary search Algorithm work?
A
Repeatedly dividing the list of data in half and discarding the half that does not have relevant data
3
Q
Advantage of Linear search
A
Is very efficient for small/ medium length arrays
4
Q
Disadvantage of Linear search
A
If a long array is used the time for data to be found is too long and complex
5
Q
Advantage of binary search
A
Better time complexity
6
Q
Disadvantage of binary search
A
Only works if the data is in order