Solved

A Linked List Class Uses a Node Class with Successor

Question 29

Multiple Choice

A linked list class uses a Node class with successor reference next,and uses a reference first to point to the first node of the list.A positive index k is given,and we want to set a reference pred to point to the node with index k-1.The right code to use is


A) pred = first;
For (int i = 0;i < k;i++)
Pred = pred.next;
B) pred = first;
For (int i = 0;i < = k;i++.
Pred ++;
C) pred = first;
For (int i = 1;i < k;i++.
Pred = pred.next;
D) pred = head;
For (int k : list.
K--;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents