Thursday, September 10, 2009

Node* recursive_rev(Node *head)
{
  static Node *temp = NULL;
  static Node *headnode = NULL;

    if(head == NULL)
       return NULL;


  if (head->next)
  {
    recursive_rev(head->next);
    temp->next = head;
    temp = temp->next;
  }
  else
  {
    headnode = head;
    temp = headnode;
  }

  temp -> next = NULL;

  return headnode;


}

No comments:

Post a Comment