Question: Question 6 0 Identify the error in the following algorithm for traversing a linked list. ListTraverse ( list ) { curNode = list - head

Question 60
Identify the error in the following algorithm for traversing a linked list.
ListTraverse(list){ curNode = list-head while
(curNode is not null) i Print
curNode's data curNode = list-head-next
}
The statement (while (curNode is not null) should be while (curNode is null).
The statement (while (curNode is not null) should be while (list-tail is not null).
The statement curNode = List-head-next should be curNode = curNode-next .
The statement curNode = list-head should be curNode = list-tail.

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 Programming Questions!