Lesson 0 of 11
Start here
Show on a big screenThis term you search a list. Then you put it in order. You also count the work.
What you will learn
- Is it there at all? — check each item, say true or false.
- Where exactly — a counted loop: start (init), test, update, traced.
- In order first — a search that halves a sorted list.
- Counting both searches — the checks, called comparisons, side by side.
- One pass of selection — find the smallest, swap it to the front.
- The whole sort — repeat the pass until each item is placed.
- Sort once, search many — when sorting first saves work.
- How the count grows — double the list, watch each count.
Need a quick recap?
- Return sends one value back to the code that asked.
- A position finds one item in a list.
- Halving checks the middle and rules out half.
The code here is plain code, not Python. The ideas also work in Python.