For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr.
A) lastPtr->nextPtr = newPtr; lastPtr = newPtr
B) lastPtr = newPtr; lastPtr->nextPtr = newPtr
C) newPtr->nextPtr = lastPtr; lastPtr = newPtr
D) lastPtr = newPtr; newPtr->nextPtr = lastPtr
Correct Answer:
Verified
Q4: What kind of linked list begins with
Q5: Which of the following is a self-referential
Q6: Which data structure represents a waiting line
Q7: A queue performs the following commands (in
Q8: The pointer member in a self-referential class
Q10: Select the incorrect statement. Binary search trees
Q11: A stack is initially empty, then the
Q12: Which of the following is not a
Q13: _ is not an advantage of linked
Q14: In general, linked lists allow:
A) Insertions and
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents