Skip to content

NCEA Level 3 Digital Technologies Complexity and Tractability (AS91908): Revision

Revision for AS91908, Analyse an area of computer science, using complexity and tractability. An invented courier's routing problem, with Achieved, Merit and Excellence practice on growth rates, brute force, heuristics and trade-offs, and graded model answers.
WorksheetTechnologyYear 13Shared by Heapso

Preview

Answers and teacher notes are hidden here. Verified teachers see them once it's copied into Heapso.

Read the text

Swift Parcels: planning delivery routes in Hamilton (invented case)

  1. [1]

    Swift Parcels is an invented courier company in Hamilton. Every morning each van leaves the depot, visits every delivery stop once and returns to the depot. The company wants the shortest route for each van, because shorter routes save fuel, time and money. This is a version of the travelling salesperson problem.

  2. [2]

    A brute force program tries every possible order of the stops and keeps the shortest. For n stops there are n! (n factorial) possible orders, for example 4! = 4 × 3 × 2 × 1 = 24. The company's computer can check about 1 billion (10^9) orders each second.

  3. [3]

    A small example. A van leaves the Hub and must visit stops A, B, C and D. Road distances in kilometres: Hub to A 9, Hub to B 8, Hub to C 2, Hub to D 6, A to B 5, A to C 7, A to D 9, B to C 6, B to D 4, C to D 8.

  4. [4]

    The nearest neighbour algorithm is a heuristic: from wherever the van is, it always goes to the closest stop it has not yet visited, then returns to the Hub at the end. It runs quickly, but it does not always find the shortest route.

  5. [5]

    Swift Parcels also sorts every parcel by street before loading the vans. Sorting n parcels with a good algorithm such as merge sort takes about n log₂ n steps, so even 10,000 parcels sort almost instantly.

  6. [6]

    Key terms. Tractable problem: one that can be solved in polynomial time (for example n or n² steps), so it stays practical as n grows. Intractable problem: one where every known exact algorithm takes exponential time or worse (for example 2^n or n! steps), so it becomes impossible in practice for large n. Heuristic: a method that quickly finds a good answer that is not guaranteed to be the best.