Complete the code to create a new node with the given data.
Node newNode = new Node([1]);The new node should be created using the variable data which holds the value to insert.
Complete the code to check if the position is 1 (insert at head).
if (position == [1]) { InsertAtHead(newNode); return; }
Position 1 means inserting at the head of the list.
Fix the error in the loop that moves to the node before the insertion point.
for (int i = 1; i < [1] - 1; i++) { current = current.Next; }
pos or index.The loop should run until the node before the desired position, so it uses position.
Fill both blanks to correctly link the new node between nodes.
newNode.Next = current.[1]; newNode.Prev = current; current.[2] = newNode;
Prev instead of Next for forward links.The new node's next pointer should point to current's next node, and current's next pointer should point to the new node.
Fill all three blanks to update the previous pointer of the next node if it exists.
if (newNode.[1] != null) { newNode.[2].[3] = newNode; }
Prev instead of Next in the if condition.If the new node's next node exists, update its previous pointer to point back to the new node.
