Arrays & Linked Lists

Answer & solution
Official answer: A
Keep previous, current and next pointers. Save current.next, reverse that link, and advance; at termination previous becomes the head. This uses constant auxiliary space and one pass, O(n). Reversing the links of an arbitrary n-node list requires Ω(n) link changes, so the optimum is Θ(n), A.
Executable pointer pseudocode:
prev=NULL; cur=head;
while(cur!=NULL){ next=cur.next; cur.next=prev; prev=cur; cur=next; }
head=prev;
Loop invariant: prev heads the already reversed prefix and cur heads the untouched suffix; saving next prevents losing the suffix. Only three pointer variables are needed, independent of n.