• RSS
  • Facebook
  • Twitter

Knowledge is Power.

  • Who you are ?

    Working on machines without understanding them ? Then you should be here..

  • Where you are ?

    Geographical location should not become a barrier to Share our knowledge.

  • What do you do ?

    Puzzles and Interview question are intended to be discussed here.

    Thursday, February 25, 2010

    Reverse a singly linked list :

    public void reverse()
    {
    Node current = head;
    head = null ; //set head to null
    while(current != null)
    {
    Node save = current;
    //Interchange the pointers
    current = current.next;
    save.next = head;
    head = save;
    }
    }

    0 comments:

    Post a Comment