Question: Consider the following function to traverse a linked list. public void traverse ( Node head ) { while ( head . next ! = null

Consider the following function to traverse a linked list.
public void traverse (Node head){
while (head.next != null){
System. out.print (head.element +"");
head = head.next;
}
}
Which of the following is FALSE about above function?
A. The function may crash when the linked-list is empty.
B. The function doesn't print the last node when the linked-list is not empty.
C. The function is implemented incorrectly because it changes head.
D. None of them.
 Consider the following function to traverse a linked list. public void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!