Which of the following options is the correct code for traversing a link list…
NVS Computer Science / IT Teacher Recruitment · 2022 · PGT Computer Science · 15 Dec 2022 · Shift 2 · Computer Science or Information Technology
Which of the following options is the correct code for traversing a link list staring at pointer P, upto element X ?
- A.
while (P == NULL || P→Element != X) P = P→Next;
- B.
while (P == NULL && P→Element != X) P = P→Next;
- C.
while (P != NULL || P→Element != X) P = P→Next;
- D.
while (P != NULL && P→Element != X) P = P→Next;
Attempted by 34 students.
Sign up free to check your answer
Sign up freeLoading lesson…