Professional Documents
Culture Documents
KIE1008 (Theory Tutorial) Session 2016/2017 (Semester 2)
KIE1008 (Theory Tutorial) Session 2016/2017 (Semester 2)
KIE1008 (Theory Tutorial) Session 2016/2017 (Semester 2)
Tutorial 3: Linked-Lists
list 18 32 23 16 43 87 25 44
A B
6. Consider the following statement, what is the output? (assume print() will show the info
of the list)
list.insertFirst(15);
list.insertLast(28);
list.insertFirst(30);
list.insertFirst(2);
list.insertLast(45);
list.insertFirst(38);
list.insertLast(25);
list.deleteNode(30);
list.insertFirst(18);
list.deleteNode(28);
list.deleteNode(12);
list.print();
8. Given the memory allocation as shown in the figure for a descendingly-ordered linked-list,
complete the tables with the appropriate values.
Address Value
0x10 20
0x30 18
0x50 25
0x60 56
0x80 12
(head) 0xfc X
(tail) 0xff Y