Cambridge AS Level Computer Science 9618 · 10.4 Introduction to Abstract Data Types (ADT)

Q79 · 9618/21/M/J/24 Q3

Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 4 of 4.

Q799618/21/M/J/24original Q3Structured · 8 marks
Question 3 from 9618/21/M/J/24

Worked solution

(a)

Write all three of these points.

The start pointer PS holds a null pointer, because the list is empty [1]

The free list pointer PF points to the first element of the free list [1]

All the nodes are in the free list [1]

(b)

The two variables will be of type Integer [1]

The two variables will be used as pointers (indexes) to the arrays [1]

The values stored in the two variables will indicate the first element of each list (the used list and the free list) [1]

The first 1D array will be of type String, and will be used to store the data items (user IDs) [1]

The second 1D array will be of type Integer, and will be used to store the pointers to the next item [1]

KEY IDEAA linked list in arrays needs a data array, an integer pointer array and two integer start variables.
TOTAL 8 marks

Official mark scheme

Mark scheme for 9618/21/M/J/24 question 3
VIDEO
▶ Starts at Q3 (23:20)

Starts at Q3 (23:20) · by Pseudocode Pro. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.