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
Big O Notation and Algorithm Efficiency
Space complexity and sorting in place
- 3 things to know
- Component 1
Overview
Space complexity of a bubble sort, space complexity of an insertion sort and space complexity of a quicksort.
What you need to know
Answer each one before you reveal it.
What does it mean to say a sorting algorithm works in place?
State the space complexity of a bubble sort.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What does it mean to say a sorting algorithm works in place?
Model answer
An in-place algorithm rearranges the data within the original array. Only a fixed small amount of extra memory is needed.
- 2
State the space complexity of a bubble sort.
Model answer
A bubble sort is O(1) in space. The algorithm needs only one temporary variable to hold a value during a swap.
- 3
State the space complexity of an insertion sort.
Model answer
An insertion sort is O(1) in space, because the item being placed is held in one temporary variable.
- 4
State the space complexity of a quicksort.
Model answer
A quicksort partitions in place but needs stack space for its recursive calls. The space complexity is O(log n) on average.
- 5
Why does a recursive algorithm consume memory even when it stores no new data?
Model answer
Each recursive call places a stack frame on the call stack holding its parameters and return address. The frames are only released as the calls unwind.
- 6
What is the space complexity of a quicksort in its worst case?
Model answer
The worst case is O(n), because the recursion reaches a depth of n when every partition is maximally unbalanced.
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 Big O Notation and Algorithm Efficiency, 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.