CP 213 Test 1 2023
CP 213 Test 1 2023
i. Using Figure 1, mention the pointer(s) which will be involved to join the
Node: (0.5 Marks Each)
a. At the end of the list. _____________________________________
b. At the beginning of the list. ________________________________
c. After the second node. ____________________________________
ii. To complete the action in i.b) and i.c), arrange the pointer in the required
order (i.e which pointer should start and which should follow). Hints: Use
Figure 1. (0.5 Marks Each)
a. For i.b). ______________ b. For i.a). ______________
iii. For actions in i.a), i.b), and i.c); write one or two lines of codes to
accomplish the action (remember that the new node has already been created
and the place to join it has already been indicated). Hints: Use Figure 2.
(1 Mark Each)
a. For i.a). __________________________________________________
b. For i.b). __________________________________________________
c. For i.c). __________________________________________________
iv. Write the line(s) of code to add the new node if: (0.5 Marks Each)
a. Figure 2 is a queue _________________________________________
b. Figure 2 is a stack _________________________________________
v. If the structure name is List, write the structure definition for Linked List
shown in the figures. (1.5 Marks)
Structure definition here