HomeAway Interview Question: How do you reverse all of the... | Glassdoor

Interview Question

Software Engineering 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.