2.4.6 How standard searching and sorting algorithms work, and the benefits and drawbacks Flashcards
State:
Another name for linear search
Serial search
State:
How a linear search functions
Starting at the beginning of the dataset, each value is examined until a match is made
Fill The Blank:
Binary Search is a ……. search algorithm and works on the principle of ………… and ………….
Fast, Divide, Conquer
State:
What is one requirement of Binary Search
Data is in a sorted format
Fill The Blank:
The search ……….. is repeatedly …………. in half. If the middle value is greater than the value of the search then the interval is changed to the ……….. half of the array. If the middle value is lower than the value of the search then the interval is changed to the ………. half of the array.
This is ………….. until the value is found or the interval is …………
Steps of binary search
Interval, Divided, Lower, Upper, Repeated, Empty
State:
3 advantages of using linear search
3 of:
* List does not have to be ordered
* Fast performance when searching small to medium lsits
* Because list is not sorted, elements can be added and deleted - if needed to be sorted re-ordering would be needed
* Linear search is simpler and easier to implement
* Can be used on any type of data
State:
1 advantage of binary search
Faster performance than linear search because the data being searched is halfed at each stage
State:
1 disadvantage of linear search
Very slow when searching lists with large quantitiese of data items
State:
1 disadvantage of binary search
Data must be ordered/sorted first