Complete the code to initialize the previous pointer to nil.
var prev *Node = [1]We start with prev as nil because initially there is no previous node.
Complete the code to store the next node before changing links.
next := current[1]We save current.next in next to not lose the rest of the list when reversing the link.
Fix the error in reversing the link by assigning the correct pointer.
current[1] = prevWe reverse the link by setting current.next = prev, pointing current node back to previous.
Fill both blanks to update pointers for the next iteration.
prev, current = [1], [2]
After reversing the link, move prev to current and current to next to continue.
Fill all three blanks to complete the iterative reverse function.
func reverseList(head *Node) *Node {
var prev *Node = [1]
current := head
for current != nil {
next := current[2]
current[3] = prev
prev, current = current, next
}
return prev
}The function initializes prev to nil, saves current.next in next, reverses the link by current.next = prev, then moves pointers forward.
