Altera Interview Question: Reverse the linked list.... | Glassdoor

Interview Question

Software Engineer Interview San Jose, CA

Reverse the linked list.


Interview Answer

1 Answer


All you need to do is let 1 point to null (Last node of linked list) and then reverse link between (1,2), (2,3) and so on.

Use 3 node variables to represent a 'size 3 moving window'
Node current;
Node next;
Node temp;

current = head;
next =; = null;

while (next != null){
temp =; = current;
current = next;
next =;

Akash on Apr 25, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.