An algorithm design strategy is a general, reusable approach to structuring a solution before writing any code. Rather than inventing a new method from scratch for every problem, experienced programmers reach for proven strategies — divide and conquer, greedy, brute force — that are known to produce correct, efficient solutions in particular situations.

Why do algorithm design strategies matter?

Consider two students both asked to find the shortest route between two cities on a map. One starts drawing random paths and measuring them — that is brute force. Another decomposes the map into regions, finds the best sub-route through each, and combines the results — that is divide and conquer. Both may eventually find the answer, but one does so in seconds and the other in hours.

Choosing the right strategy before coding saves enormous effort and often makes the difference between an algorithm that finishes in a second and one that would take longer than the universe has existed.

What is divide and conquer?

Divide and conquer splits a problem into smaller sub-problems of the same type, solves each sub-problem independently, and combines the results. The strategy works recursively: each sub-problem is itself divided until reaching a base case small enough to solve directly.

Classic examples:

Algorithm How divide and conquer applies
Merge sort Divide list in half repeatedly; sort each half; merge sorted halves
Binary search Discard half the search space at each step by comparing the middle element
Quicksort Partition around a pivot; recursively sort each partition

Worked example — binary search using divide and conquer:

Sorted list: [2, 5, 8, 12, 16, 23, 38, 45, 67, 90], target: 23

  1. Middle element at index 4 = 16. Target 23 > 16 → search right half: [23, 38, 45, 67, 90]
  2. Middle element at index 2 of sublist = 45. Target 23 < 45 → search left half: [23, 38]
  3. Middle element = 23. Found!

Three comparisons instead of up to ten (linear search worst case). The problem was halved at each step — this is the essence of divide and conquer.

Time complexity advantage: Divide and conquer algorithms typically achieve O(n log n) or O(log n) where brute force would be O(n²) or O(n).

What is a greedy algorithm?

A greedy algorithm makes the locally optimal choice at each step, hoping that a sequence of locally best decisions leads to a globally best solution. It never backtracks or reconsiders a previous decision.

When it works perfectly: Dijkstra's shortest path algorithm is greedy — at each step it extends the path to the nearest unvisited node. For graphs with non-negative weights, this always produces the globally shortest paths. Huffman coding (for data compression) is also greedy: always merge the two least-frequent symbols first. Both produce provably optimal results.

When it fails: Consider making change for 30p using coins of 20p, 15p, and 1p. A greedy algorithm picks the largest coin first: 20p, then 1p ten times = 11 coins. The optimal solution is two 15p coins = 2 coins. The greedy choice (pick the biggest) was locally sensible but globally wrong.

Greedy works when: the problem has greedy choice property (a locally optimal choice is always part of a global optimum) and optimal substructure (optimal solution to the whole contains optimal solutions to its parts).

What is brute force?

Brute force tries every possible solution systematically until the correct one is found. It requires no insight into the problem structure — it simply exhausts all possibilities.

  • Linear search is brute force: check every element until the target appears.
  • Breaking a 4-digit PIN by trying 0000, 0001, 0002, … 9999 is brute force — at most 10,000 attempts.
  • Breaking a 128-bit encryption key by brute force would require 2¹²⁸ attempts — computationally infeasible (more than the age of the universe even on modern hardware).

Brute force is correct (it always finds a solution if one exists) but often impractical. Its time complexity is O(n), O(n²), or far worse depending on the problem.

Comparing the strategies

Strategy Core idea Time complexity (typical) When to use
Divide and conquer Split, solve, combine O(n log n) Sorting, searching, sub-dividable problems
Greedy Take best local choice O(n) or O(n log n) Scheduling, graph algorithms, compression
Brute force Try everything O(n!) to O(2ⁿ) Small inputs, verification, when no better approach exists

What is dynamic programming (for context)?

Dynamic programming extends divide and conquer by storing the results of solved sub-problems (memoisation) so they are never computed twice. This is crucial when the same sub-problems recur many times — for example, calculating Fibonacci numbers. Without memoisation, a recursive Fibonacci function recomputes the same values exponentially many times. With memoisation, each sub-problem is solved once: O(n) rather than O(2ⁿ). Dynamic programming is primarily A-level content but is worth knowing the concept of for GCSE stretch questions.

Frequently asked questions

Which algorithm design strategies do I need for GCSE Computer Science?

At GCSE, the most commonly examined strategies are divide and conquer (linked to merge sort and binary search) and brute force (linked to linear search and the limits of encryption). Greedy algorithms appear in the context of Dijkstra's shortest path. You should be able to identify which strategy an algorithm uses, describe its key idea, and evaluate its efficiency compared with alternatives.

Is bubble sort a divide and conquer algorithm?

No. Bubble sort is an iterative comparison-based algorithm that makes repeated passes through a list, swapping adjacent out-of-order pairs. It does not divide the problem into sub-problems. Merge sort and quicksort are the classic divide-and-conquer sorting algorithms. Bubble sort is a brute-force approach: try every adjacent pair until no swaps remain.

Why does a greedy algorithm not always produce the optimal result?

A greedy algorithm only considers the current step — it never reconsiders a past decision or anticipates future consequences. When the locally best choice at one step closes off a globally better path at a later step, the greedy approach fails. Problems where greedy works are special: they have a mathematical property (greedy choice property) that guarantees local optima combine into a global optimum.

How does algorithm design relate to computational thinking?

Algorithm design is the practical expression of decomposition (break the problem into sub-problems) and abstraction (ignore irrelevant details, keep the essential structure). Choosing a design strategy — divide and conquer, greedy, brute force — is a form of pattern recognition: recognising the shape of a problem and matching it to a known solution approach. This is precisely what computational thinking trains.


Professor Turing at aitutors.me will challenge you with algorithm design problems and guide your thinking — never giving the answer, always the next right question.