Mindmap
2.1linear and binary searches
Inhalt der Mindmap
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
Informationen
- Beschreibung
- Mindmap am 2.1linear and binary searches, erstellt von Sam Power am 10/01/2019.
- Erstellt von
- Sam Power · Jan 2019
- Aktualisiert
- 10 Jan 2019
- Aufrufe
- 0
- Bewertung