A linked list class uses a Node class with successor reference next and field element to store values. It uses a reference first to point to the first node of the list. Code to print all elements stored in the list can be written as
```
A) System.out.print(first);
B)
Node p = first;
while (p != null)
{
System.out.println(p.element);
p = p.next;
}
C)
Node p = first;
while (p != null)
System.out.println(p.next);
D)
Node p = first;
for (p!= null)
{
System.out.println(p.element);
p++;
}
```
B)
Node p = first;
while (p != null)
{
System.out.println(p.element);
p = p.next;
}
You might also like to view...
The chief difference between a worm and a virus is that ____________________ replicate in a network.
Fill in the blank(s) with the appropriate word(s).
With ____ mode, a trusted internal FTP client makes an outgoing request to the FTP server.
A. passive B. active C. simple D. aggressive
In Word, it is possible to create your own custom tab
Indicate whether the statement is true or false
All of the following techniques are used to validate electronic data interchange transactions except
A. value added networks can compare passwords to a valid customer file before message transmission B. prior to converting the message, the translation software of the receiving company can compare the password against a validation file in the firm's database C. the recipient's application software can validate the password prior to processing D. the recipient's application software can validate the password after the transaction has been processed