Techshristi's Forum

Author Topic: Project - algoscode File  (Read 1170 times)

0 Members and 1 Guest are viewing this topic.

Offline TechShristi

  • Welclome to Techshristi
  • Administrator
  • *****
  • Posts: 556
    • techshristi
Project - algoscode File
« on: February 03, 2013, 02:30:02 AM »
algoscode File

algoscode File consit of 34 pages


1. Reverse a singly linked list


 //


// iterative version


//


Node* ReverseList( Node ** List )      


{


   Node *temp1 = *List;


   Node * temp2 = NULL;


   Node * temp3 = NULL;


 


   while ( temp1 )


   {


         *List = temp1; //set the head to last node           


temp2= temp1->pNext; // save the next ptr in temp2


         temp1->pNext = temp3; // change next to privous


         temp3 = temp1;


         temp1 = temp2;


   }


    return *List;


}


 2. Delete a node in double linked list


 void deleteNode(node *n)


{


node *np = n->prev;


node *nn = n->next;


np->next = n->next;


nn->prev = n->prev;


delete n;


}


Source: algoscode File

Techshristi's Forum

Project - algoscode File
« on: February 03, 2013, 02:30:02 AM »

 
Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18