WJEC A-Level Computer Science 601-5345-3
Hardware: Architecture, Memory and Storage
Networks and Data Transmission
Logic Gates and Boolean Algebra
Data Representation and Data Types
Data Structures
Organisation of Data: Files and Records
Database Systems
The Operating System
Algorithms and Programs
Principles of Programming
Systems Analysis
Software Engineering and Program Construction
Types of Software System
Practical Programming
Data Security and Integrity
Computing, Society and the Law
Advanced Data Structures and Logic
Recursion, Sorting and Searching
Programming Paradigms and Translators
System Design and Human-Computer Interaction
Software Engineering Tools and Professional Practice
Advanced Architecture and Assembly Language
Communication Networks and File Organisation
Number Representation and Floating Point
Databases and Distributed Systems
Operating System Management
Software Systems and Applications
Data Security, Cryptography and Attack
Recursion, Sorting and Searching
Comparing sorting algorithms
- 3 things to know
- A2 Unit 3
Overview
Four measures used to compare the efficiency of sorting algorithms, stable sort and pass through the data in a sorting algorithm.
What you need to know
Answer each one before you reveal it.
Name four measures used to compare the efficiency of sorting algorithms.
What effect does a swap flag have on the best-case running time of a bubble sort?
Questions from this subtopic
Each one with the model answer underneath.
- 1
Name four measures used to compare the efficiency of sorting algorithms.
Model answer
They are the number of comparisons made, the number of exchanges made, the number of passes through the data and the extra storage space required.
- 2
Why is the number of exchanges a more telling measure than the number of comparisons when large records are sorted?
Model answer
Moving a whole record costs far more than comparing one key field, so the exchanges dominate the running time.
- 3
What does it mean to say that a sort is performed in place?
Model answer
An in-place sort rearranges the items within the storage they already occupy, needing only a constant amount of extra space whatever the size of the list.
- 4
State the number of comparisons a bubble sort makes on a list of ten items when no early exit is used.
Model answer
It makes 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 45 comparisons.
- 5
What effect does a swap flag have on the best-case running time of a bubble sort?
Model answer
A pass that makes no exchange shows the list is already in order and the sort ends there, so the best case falls to O(n).
- 6
Why is a selection sort attractive when writing to the storage medium is expensive?
Model answer
It makes at most one exchange per pass, so a list of n items costs at most n − 1 exchanges however disordered it is.
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 Recursion, Sorting and Searching, 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.