Documente Academic
Documente Profesional
Documente Cultură
1. Gives definition for list and linked list. 2. Let say, we want to delete D. Sketch the diagram of list to show the changes.
[0] H [1] G [2] F [3] [4] E D [5] [6] C B [7] A
3. List down the basic operation that can be done towards a list. 4. Each node in linked list is divided into 2 parts. State the parts for each node.
5. Gives the differences between list and linked list.
6. Write down the node declaration for a linked list that consists of 3 fields; name, marks and pointer that point to next
node.
a) Gives declaration for pointer p and q that point to a node in a linked list. b) Sketch a diagram to show changes based on the statement given. i. ii. iii. iv. v.
p p p p p = p -> link; -> link -> link = p; -> link = p; -> data = q -> data; = NULL;
suzila@psmza.edu.my
8. Based on the diagram given, state the declaration for a linked list. Zukia 21 Syahieda 19 Suzana 20
9.
Write down code statement to show an operation for inserting node in-front of the linked list based on the diagram given. C D E
x y
B A
Before x B C D E
A After
10. Given are the diagram before and after for delete operation towards a node in linked list. Write down code
statement for (a), (b) and (c) as shown in the diagram given. x 2 7 14 23
Before
y (a)
14 (b)
23
(c)
x After
23
suzila@psmza.edu.my