Question: Question 6 0 Identify the error in the following algorithm for traversing a linked list. ListTraverse ( list ) { curNode = list - head
Question
Identify the error in the following algorithm for traversing a linked list.
ListTraverselist curNode listhead while
curNode is not null i Print
curNode's data curNode listheadnext
The statement while curNode is not null should be while curNode is null
The statement while curNode is not null should be while listtail is not null
The statement curNode Listheadnext should be curNode curNodenext
The statement curNode listhead should be curNode listtail.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
