Eduqas A-Level Computer Science A500QS
Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs
Variables, Scope, Parameters and Identifiers
Recursion and Modular Programming
Sorting Algorithms
Searching and Shortest-Path Algorithms
Big O Notation and Algorithm Efficiency
Validation, Verification and Testing
Data Compression
Programming Paradigms and Computer Languages
Systems Analysis, Maintenance and Documentation
System Design and Human-Computer Interaction
Software Engineering Tools and Translators
Computing, Society and the Law
Computer Architecture, the Processor and Assembly Language
Input, Output and Secondary Storage
Networks, Protocols and the Internet
Data Transmission and Network Performance
Number Systems and Binary Arithmetic
Data Types, Characters and Floating Point
Files, Records and File Organisation
Databases, Normalisation and Entity Modelling
SQL, Big Data and Distributed Systems
The Operating System and Its Modes
Interrupts, Memory Management and Scheduling
Types of Software System
Data Security, Cryptography and Attack
Sorting Algorithms
Storage space and sorting efficiency
- 3 things to know
- Component 1
Overview
Space complexity of a sorting algorithm, space complexity of bubble sort and insertion sort and space complexity of quicksort and explain where the space goes.
What you need to know
Answer each one before you reveal it.
State the space complexity of bubble sort and insertion sort.
State the space complexity of quicksort and explain where the space goes.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is meant by the space complexity of a sorting algorithm?
Model answer
Space complexity describes how much extra memory the algorithm needs as the data grows. The measure excludes the storage of the original list.
- 2
State the space complexity of bubble sort and insertion sort.
Model answer
Bubble sort and insertion sort each have a space complexity of O(1). Only a single temporary variable is needed for a swap.
- 3
State the space complexity of quicksort and explain where the space goes.
Model answer
Quicksort uses O(log n) extra space on average. The space is the stack of frames for the unfinished recursive calls.
- 4
Why does a recursive sorting algorithm need more memory than an iterative one?
Model answer
Every unfinished recursive call keeps a stack frame holding its parameters and local variables. An iterative sort reuses one set of variables.
- 5
What is the trade-off between time and space in sorting?
Model answer
An algorithm can often be made faster by using more memory, and smaller by accepting more time. The right balance depends on the machine and the data.
- 6
Which sorting algorithm would suit a device with only a few kilobytes of free memory?
Model answer
Insertion sort suits a very small memory because it sorts in place with no recursion. Quicksort would need stack space that the device may not have.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Sorting Algorithms, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.