Question 4(d)(ii) 2013 · May-June · Paper 33 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (d)
(ii)
(ii)
Show text version of question
Question 4
Part (d)
(ii)
Question 4
A linked list is implemented with an array of records of data type Node. For
Examiner's Use The Node record has two fields as defined below:
RECORD Node Data : STRING Pointer : INTEGER ENDRECORD
Identifier Data Type Description
MyList ARRAY[100] OF Node An array to store the data and pointer values
HeadPointer INTEGER Stores the index position of the node at the head of the linked list The following algorithm traverses the linked list and outputs the data values. For Examiner's Use PROCEDURE ListTraversal(Index) IF MyList[Index].Pointer <> 0 THEN // follow the pointer to the next node ListTraversal(MyList[Index].Pointer) ENDIF OUTPUT MyList[Index].Data ENDPROCEDURE
(ii)
The diagram shows a trace of the execution of this algorithm for the given linked
list data.
HeadPointer: 3
MyList Data Pointer 1 BEAN 2
2 COURGETTE 4
3 APPLE 1
4 PEPPER 0
...
Question 99
100
Question 13
Fill in the missing lines of pseudocode. For Examiner's Use ListTraversal(3) MyList[3].Pointer <> 0 is TRUE ListTraversal(1) MyList[1].Pointer <> 0 is TRUE ListTraversal(2)
.................................................................. ListTraversal(4)
...................................................
................................................... ENDPROCEDURE OUTPUT COURGETTE ENDPROCEDURE OUTPUT BEAN
......................... OUTPUT APPLE ENDPROCEDURE
Why this question appears here
71% assigned-topic match · Algorithm design and problem-solving › Algorithms
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9691_s13_qp_33.pdf
