#include #include struct node { int data; node *next; }; class linklist { private: node *start; node *current; node *previos; node *temp; node *temp1; node *ptr; public: linklist() { start=NULL; current=NULL; previos=NULL; temp = NULL; temp1=NULL; ptr=NULL; } /////////// THIS FUNCION IS STORING THE LINKED LIST IN ASCENDING ORDER void insert(int N) { current=start; temp = new node; temp -> data = N; temp -> next = NULL; if(start==NULL) { start = temp; } if(N < start->data) // to change order first change this sign { temp->next=start; start = temp; } else { while(current!=NULL && current->data <= N) // then change this sign { previos = current; current = current->next; } previos->next = temp; temp->next = current; } } //====================================================================== //////////////////// FUNCTION TO JUST CHECK VARIOUS VALUES OF POINTERS ETC void show(void) { cout<<"Starting node data: " <data<next<next; delete temp1; } // FUNCTION TO READ LINKED LIST //====================================================================== //////////////////// PERFORMING THE READING AND DELETION OF LINKED LIST //////////////////// SIMULTANEOSLY..... THIS PROCESS CAN BE SEPARATED BY //////////////////// REMOVING THE LAST THREE DELETION LINES AND CALLING //////////////////// THE deletestart() SEPARATELY void read(void) { ptr=start; if(ptr==NULL) { cout<<"Sorry... list empty "; } else { while(ptr!=NULL) { cout<data<next; //copy the address of next node in start temp1 = start; // deletion line 1 start=start->next; // deletion line 2 delete temp1; // deletion line 3 } } } //================================================================= }; void main(void) { clrscr(); char ans,w,resp; int n; linklist r; cout<<"========== Priority Linked List ======="<