URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Programming Questions
       *****************************************************
       #Post#: 286--------------------------------------------------
       Linked Lisgt
       By: kranthipls Date: November 30, 2012, 10:12 pm
       ---------------------------------------------------------
       Write a program to swap the kth node from the first and kth node
       from the last in a linked list.......
       #Post#: 323--------------------------------------------------
       Re: Linked List
       By: dinesh Date: December 4, 2012, 8:33 am
       ---------------------------------------------------------
       Can we swap only values ?
       If so
       The problem boils down to finding the kth node from the last and
       the kth node from the first and swap the values;
       The kth node from the end can be obtained by using 2 pointers
       which are initially k nodes apart - then traverse the list till
       the second node reached the end
       i.e second -> next == NULL
       #Post#: 350--------------------------------------------------
       Re: Linked Lisgt
       By: dinesh Date: December 5, 2012, 3:43 am
       ---------------------------------------------------------
       @kranthi: should we swap nodes also (not only values)?
       #Post#: 351--------------------------------------------------
       Re: Linked List
       By: kranthipls Date: December 5, 2012, 8:47 am
       ---------------------------------------------------------
       Yes please swap the nodes also......
       But Even then the method should be same right???
       #Post#: 387--------------------------------------------------
       Re: Linked Lisgt
       By: kpr29 Date: December 10, 2012, 11:17 am
       ---------------------------------------------------------
       @Satti: This thread is closed as the answer is already posted by
       majeti.......
       *****************************************************