Mind map
2.1linear and binary searches
Map content
2.1linear and binary searches
linear search
- each item in the list is checked in order
- the binary search only works if data is in order
- check 1st value
- if it is the value you are looking for celebrate and stop
- ELSE- Move to and check the next value
- repeat until find value
- ELSE- Move to and check the next value
- if it is the value you are looking for celebrate and stop
Binary searches
- the list needs to bE in order
- take the middle value
- compare to the value you are looking for
- if it is the value you are looking for celebrate and STOP
- if it is smaller than the one you are looking for, take the values to the right of the middle value.
- ELSEIF- if it is larger than the one you are looking for
- take the values to the left of the middle value
Bubble sort
- bubble sorting - moving through a list repeatedly, swapping elements that are in the wrong order
- 1. take the 1st element and second element from the list
- 2. compare them
- 3. if element 1 >element 2 then - swap them
- 4. ELSE-do nothing
- 3. if element 1 >element 2 then - swap them
- 2. compare them
Information
- Description
- Mind Map on 2.1linear and binary searches, created by Sam Power on 10/01/2019.
- Created by
- Sam Power · Jan 2019
- Updated
- Jan 10, 2019
- Views
- 0
- Rating