Posts

Showing posts from December 19, 2020

Linklist all concepts using Dynamic arrays(using nodes)

Image
  Double Link List (Add and Show nodes) #include <iostream> using namespace std; struct node {     int data;     node* pre, *nxt; }; class Link_List {         node *head, *current;     public:         Link_List()         {             head=current=NULL; // Means at the most link list has no node.         }        void List_Add(int n)         {             node*tempNode;             tempNode=new node;             tempNode->data=n;             tempNode->pre=NULL;             tempNode->nxt=NULL;             if(head==NULL)             {                 current=head=tempNode;             }             else             {                 current->nxt=tempNode;                 tempNode->pre=current;                 current=tempNode;             }         }         void show_Forward()         {             node *tempNode=head;             while(1)             {                 cout<<"\t"<<tempNode->data<<endl;                 if(tempNode->n