The following diagram represents an Abstract Data Type (ADT) for a linked list. [Diagram: A --> C --> D --> E --> Ø]. The free list is as follows: [Diagram: (empty box) --> (empty box) --> (empty box) --> Ø]
- (a)Explain how a node containing data value B is added to the list in alphabetic sequence.[4]
- (b)Describe how the linked list in part (a) may be implemented using variables and arrays.[2]
This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.
Mark scheme
Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.
- [1] Check for a free node
- [1] Assign data value B to first node in free list / node pointed to by start pointer of free list
- [1] Search for correct insertion point
- [1] Pointer from A will be changed to point to node containing B (instead of C)
- [1] Pointer from B will be changed to point to node containing C
- [1] Start pointer in free list moved to point to next free node
- [1] An array (1D) to store the data and a second array (1D) to store the pointers
- [1] An (integer) variable to hold the start pointer and an (integer) variable to store the next free pointer
- ALTERNATIVE:
- [1] Define a record type comprising a data element and a pointer and declare an array (1D) of this type
- [1] An integer variable to hold the start pointer and an integer variable to store the next free pointer
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →