|
Initial Setup |
Exercise |
Final Configuration |
1 |
![](images/snap1b.png) |
Use a single assignment statement to make the
variable p refer to the Node with info '2' |
![](images/snap1a.png) |
2 |
![](images/snap2b.png) |
Redo exercise 1 but, this time, your
assignment statement must refer to both variables p
and q. |
![](images/snap2a.png) |
3 |
![](images/snap2b.png) |
Use a single assignment statement to make the
variable q refer to the Node with info '1'. |
![](images/snap3a.png) |
4 |
![](images/snap1b.png) |
Use a single assignment statement to make the
variable r refer to the Node with info '2'. |
![](images/snap4a.png) |
5 |
![](images/snap1b.png) |
Use a single assignment statement to set the
info of the Node referred to by p equal to the info of the
Node referred to by r (you must access this info through r;
do not refer to the character '3' directly). |
![](images/snap5a.png) |
6 |
![](images/snap1b.png) |
Redo exercise 5 by referring only to variable
p (not to variable r). Again, you may not refer to
the character '3' directly . |
![](images/snap5a.png) |
7 |
![](images/snap1b.png) |
Write a single assignment statement to
transform the linked list headed by p into a circular
linked list. Your assignment statement must refer to
both variables p and r. |
![](images/snap7a.png) |
8 |
![](images/snap8b.png) |
Redo exercise 7 but, this time, your
assignment statement must refer to both variables p
and q. |
![](images/snap8a.png) |
9 |
![](images/snap9b.png) |
Redo exercise 7 but, this time, your
assignment statement must refer only to variable p.
|
![](images/snap9a.png) |
10 |
![](images/snap10b.png) |
Write a single assignment statement to remove
the Node with info 'B' from the linked list headed by p.
Your assignment statement must refer to both
variables p and q. |
![](images/snap10a.png) |
11 |
![](images/snap11b.png) |
Write a single assignment statement to remove
the Node with info 'B' from the linked list headed by p. |
![](images/snap11a.png) |
12 |
![](images/snap12b.png) |
Write a while loop to make q refer
successively to each Node in the linked list headed by p. q
must end up referring to the last Node in the list. |
![](images/snap12a.png) |
13 |
![](images/snap13b.png) |
Write a while loop to make q refer
successively to each Node in the linked list headed by p
until q refers to the first Node with info (lowercase) 'c'. |
![](images/snap13a.png) |
14 |
![](images/snap14b.png) |
Use four assignment statements, each
referring to variable p, to create a linked list headed by p
and containing 4 Nodes with info 'A', 'B', 'C', and 'D', in
this order. |
![](images/snap14a.png) |
15 |
![](images/snap15b.png) |
Create a new Node with info 'A' and insert it
at the beginning of the list headed by p.
|
![](images/snap15a.png) |
16 |
![](images/snap16b.png) |
Create a new Node with info 'D' and insert it
at the end of the list headed by p. |
![](images/snap16a.png) |
17 |
![](images/snap17b.png) |
Remove the Node at the beginning of the list
headed by p and insert it at the end of the same list. Your
program must refer to both variables p and q. |
![](images/snap17a.png) |
18 |
![](images/snap18b.png) |
Redo exercise 17 but, this time, your program
must only refer to variable p. |
![](images/snap18a.png) |
19 |
![](images/snap19b.png) |
Merge the two lists headed by p and q into a
single list headed by p in which the Nodes are sorted in
alphabetical order. |
![](images/snap19a.png) |
20 |
![](images/snap20b.png) |
Using only the three existing variables p, q,
and r, reverse the order of the Nodes in the list headed by
p.
|
![](images/snap20a.png) |