Data Structures and Algorithms
A-Level Computer Science revision: Data Structures and Algorithms. Learning objectives, key points, worked examples and practice questions across AQA, Edexcel, OCR, WJEC and CCEA.
A-Level Computer Science revision: Data Structures and Algorithms. Learning objectives, key points, worked examples and practice questions across AQA, Edexcel, OCR, WJEC and CCEA.
Question: Trace quicksort on [3, 6, 8, 10, 1, 2, 1] with pivot as first element
Model Answer:
Pivot=3. Partition: [1,2,1] + [3] + [6,8,10]. Recurse left: pivot=1 -> [1] + [1] + [2]. Right: pivot=6 -> [] + [6] + [8,10] -> pivot=8 -> [] + [8] + [10]. Result: [1,1,2,3,6,8,10]
Questions: