Mind map
Searching Algorithms
Map content
Searching Algorithms
Linear Search
- A linear search doesn't need the numbers to be in order to be able to search
- A linear search is completed by going along each space and checking for the target e.g
- 1,2,3,4,5,6
- The target is 3
- Search space 0, search space 1, search space 2, stop at space 2
- The target is 3
- 1,2,3,4,5,6
- A linear search is completed by going along each space and checking for the target e.g
- A linear search doesn't need the numbers to be in order to be able to search
Binary search
- A binary search needs the numbers to be in order, that can be done by using 1 of many sorts e.g bubble sort, insertion sort and merge sort
- To do a binary search you have to sort the units e.g numbers into order and then see if your number is bigger or smaller then the number in the middle, if it is bigger for example you then check the middle number of all the numbers in front of the original middle number and repeat the process until you find the middle number
- A binary search needs the numbers to be in order, that can be done by using 1 of many sorts e.g bubble sort, insertion sort and merge sort
Pros and cons of the two methods
- Pros of linear are that you don't have to sort the numbers, saving memory and space
- Pros of a binary search are that it is quicker and more efficient, providing the numbers are already sorted
Example question: 1,2,3,6,7,8,9 Find 7 using a binary sort
Information
- Description
- Mind Map on Searching Algorithms, created by Sam Burton on 19/09/2018.
- Created by
- Sam Burton
- Views
- 0
- Rating