ExamBank Scot · AH Computing Science question bank · All AH Computing Science questions
2 marks · Linked lists
The following section of pseudocode is included in the design for a program. 1. If head is null 2. Create first node 3. Set previous pointer of new node = null 4. Set next pointer of new node = null 5. Else 6. Create new node 7. Set old tail’s next pointer = new tail 8. Set new tail’s previous pointer = old tail 9. Set new tail’s next pointer = null 10. End if Name the data structure and operation used in this design.
Data structure: Double linked list Operation: Adding a new node 1 mark for correct data structure 1 mark for correct operation Note: answers must mention double linked list to gain mark for correct data structure
Previous question: AH Computing Science 2019 Question 4 (CfE)