Free learning guide

Algorithms and problem-solving

Structured programming and algorithm practice ideas.

Challenge: searching

Design a linear search that reports whether a target appears in a list. Trace it by hand before coding.

Extension

Implement bubble sort without using Python’s built-in sorting methods. Test duplicates, empty lists and already sorted input.

← Browse all resources

Trace an algorithm before coding it

Start with a small input list and write down the value of every variable after each iteration. For a linear search, note the current index and whether a match has been found. For sorting, record the complete list after each comparison or pass. Once the trace works, translate the steps into Python.

Try linear search, binary search and bubble sort to test those ideas in working programs.