Project - algoscode File

Started by TechShristi, February 03, 2013, 02:30:02 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TechShristi

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


Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview