Exercises 12.7
- The following fragment is intended to print the contents of a linked
list like the ones discussed in this chapter. What is wrong with the
fragment?
Node temp = head;
do
{
System.out.println(temp.info);
temp = temp.link;
}
while (temp != null);
- Write a constructor for the Tree class discussed in this chapter. The
constructor should have three int parameters: a, b, and c. It should
construct the tree shown in the diagram.
- Write a fragment that will create a new node containing the value 27
in its info field and then insert this node into the list between the
two nodes shown in the diagram.
|
|