Homework 36 Solution
A linked list contains nodes of the user-defined type (class) Node and the
beginning of the list is pointed to by the variable myList. There are four
nodes in the list and they are ordered in ascending
order of the data values. The node containing the data value 27 is stored in
memory beginning at location 84F8. The node containing the data value 64
is stored at memory location 3D64. The node containing data value 18 is
stored at memory location 2468 and the node containing 46 is stored a memory
location C482. You may assume the following class Node. Note: You do NOT
have to write any source code for this homework.
class Node
{public:
int data;
Node* next;
};
(a) Neatly handdraw a picture of the list as
described above (be sure to show the nodes in ascending order.
(b) Place each data value in the data field of the appropriate node.
(c) Place the correct address in the next field of each node (be sure to have
the next field of the last node point to NULL).
(d) Place the correct address in the variable myList.
Solution