Topic 1 · Lesson 5 of 5
Exam technique and practice
Exam technique
- Keep a neat trace table for algorithms in words or flow charts; examiners mark the values at each step.
- In sorting, write the full list after every pass and mark the pivots. State when the sort is finished (a pass with no swaps, or every item fixed).
- In bin packing, show the lower bound calculation and say "rounded up". Say whether a packing is optimal and why.
- For order questions, write the scale factor clearly: "time ".
- For planarity, list the arcs, say which pairs cross, and state the conclusion in words.
Common mistakes
- Choosing the wrong pivot in a quick sort with an even number of items. Fix: use the item to the right of the middle.
- Reordering items in a sublist. Fix: items keep their original order on each side of the pivot.
- Rounding the bin lower bound down. Fix: always round up; 4.1 bins means at least 5.
- Thinking a non-optimal packing proves nothing. Fix: a packing that meets the lower bound is optimal; one that does not might still be optimal.
- Confusing Eulerian (every arc once) with Hamiltonian (every vertex once).
- Saying a graph is non-planar because the drawing has crossings. Fix: use the planarity algorithm.
Check yourself
- Carry out the first pass of a bubble sort, into descending order, on .
- A list of 10 items is sorted by bubble sort. What is the largest possible number of comparisons?
- Items of size are packed into bins of size 12. Find the lower bound and the first-fit decreasing packing.
- An algorithm of cubic order takes 3 seconds for . Estimate the time for .
- How many arcs does have? Is Eulerian?
- A graph has degrees . How many arcs does it have? Is it Eulerian, semi-Eulerian or neither?
- A tree has 15 arcs. How many vertices does it have?
- With Hamiltonian cycle ABCDEFA, do the arcs AC and BF cross?
Show answersHide answers
- Total 34, lower bound , so 3; first-fit decreasing: 9, 3 / 7, 5 / 6, 4: three bins, optimal
- seconds
- 36 arcs; every degree is 8, which is even, so yes
- Total 14, so 7 arcs; two odd vertices, so semi-Eulerian (if connected)
- 16
- Yes: A, B, C, F alternate round the cycle
Practise this topic
Quiz me on this topic10 questions, marked as you go.Make a practice paperPick the marks and difficulty. Print it with a mark scheme.
Both are part of Premium.