Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question

Interview(Student Candidate)

How do you reverse all of the pointers in a singly-linked


Interview Answer

1 Answer


void reverseSLList(Node *head) { Node *tempNode = NULL; Node *tempNext = NULL; while(head != NULL) { tempNode = head; head = head->next; tempNext = head->next; head->next = tempNode; head = tempNext; } head = tempNode; }

Anonymous on Sep 18, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.