Question: Which XXX completes the following algorithm for inserting a new node after curNode in a singly-linked list? A call to insertAfter (list, null, newNode) would

Which XXX completes the following algorithm for inserting a new node after curNode in a singly-linked list? A call to insertAfter (list, null, newNode) would prepend to the list. insertAfter(list, curNode, newNode) { if (list.head == null) { list.head = newlode list.tail = newNode 1 else if (curNode == list.tail) { list.tail.next = newNode list.tail = newNode } else { } 1 Answers: newNode.next = curNode.next curNode.next = null a. newNode.next = null curNode.next = list.tail.next b. newNode.next = curNode.next curNode = newNode C. newNode.next = curNode.next curNode.next = newNode d
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
