can someone please explain to me why (d) is the correctanswer.
this piece of code is written in java.
thanks.
Given the following definition of ListNode constructor (similarto the one we have in our doubly-linked list example).
public ListNode (T v, ListNode<T> n) { this.value = v; this.next = n;}
Which statement inserts an item x right after the node pointedby “current” in the linked list?
bcurrent = new ListNode(x, current.next);ccurrent.next = new ListNode(x, current);dcurrent.next = new ListNode(x, current.next);enone of the above
Answer
current.next = new ListNode(x, current.next);Current state of linked listcurrent -> node1 -> node2 …=> new ListNode(x,
OR
OR