Home
Add Document
Sign In
Register
Program of singly link list in c++
Home
Program of singly link list in c++
Program of singly link list in c++ with insertion ,deletion and traversing optionsFull description...
Author:
pratikjain998
6 downloads
144 Views
34KB Size
Report
DOWNLOAD .PDF
Recommend Documents
Snakes Ladders program in C++
This is snakes and ladders program which is written in C++ programming language.
kirchoff law in c++ program
programmingFull description
C program for list implementation using array
C program for list implementation using array
Analysis of Singly Reinforced Beam
C PROGRAM of Machine Design
C PROGRAM of Machine Design
List of Architects in Lko
LIST OF ARCHITECTS
List of Industries in Cavite
Full description
List of Companies in Uae
Full description
List of Companies in Hosur
List of companies in hosur
List of TCodes in SAP
T CODESDescripción completa
List of Industries in Pakistan
Industry list of Pakistan.Full description
List of Dargahs in Delhi
A list of Dargahs for Ziyarat with Summary of each
List of CRO in Mumbai
List of Mills in Coimbatore
THIS IS PECULIAR LIST MOST NEEDEDFull description
List of Hospitals in India
All Recognized Hospitals in IndiaFull description
List of Architects in Mumbai
architectureFull description
List of Hospitals in India
List of Hospitals in IndiaFull description
list of companies in india.xlsx
List of Dargahs in Hyderabad
List of Dargahs im Hyderabad with brief summary of eachFull description
List of Companies in Pakistan
Full description
Missing Link in Astrology
This document tries to dymystify the astrology we know so far!
C# List Examples.pdf
Full description
Modul Linked List c++
Deskripsi lengkap
Link
LinkFull description
#include
#include
#include
voidmessage(); voidinsertion_beg(); voidinsertion_end(); voidinsertion_pos(); voiddeletion_beg(); voiddeletion_end(); voiddeletion_pos(); voidtraverse(); structll{ structll*next; intdata; }; structll*start=NULL; voidmain(){ clrscr(); cout<<"Pleaseenter1forinsertionatbeginning\n"; cout<<"Pleaseenter2forinsertionatending\n"; cout<<"Pleaseenter3forinsertionatspecificposition\n"; cout<<"Pleaseenter4forDeletionatbeginning\n"; cout<<"Pleaseenter5forDeletionatending\n"; cout<<"Pleaseenter6forDeletionatspecificposition\n"; cout<<"pleaseenter7fortraversal\n"; cout<<"pleaseenter8forexit\n"; message(); getch(); } voidmessage(){ intchoice; cout<<"pleaseenteryourchoice\n"; cin>>choice; switch(choice){ case1: insertion_beg(); break; case2: insertion_end(); break; case3: insertion_pos(); break; case4: deletion_beg(); break; case5: deletion_end(); break; case6: deletion_pos(); break; case7: traverse(); break; case8: exit(1); break; default:
cout<<"pleaseentervalidchoice"; message(); break; } } voidinsertion_end(){ structll*node=newll; if(start==NULL){ start=node; cout<<"pleaseenterdata\n"; cin>>start->data; start->next=NULL; } else{ structll*p=start;//creatingatemppointer while(p->next!=NULL){ p=p->next; } p->next=node; node->next=NULL; cout<<"pleaseenterdata\n"; cin>>node->data; } message(); } voidinsertion_beg(){ structll*node=newll; if(start==NULL){ start=node; cout<<"pleaseenterdata\n"; cin>>start->data; start->next=NULL; } else{ node->next=start; cout<<"enterdata\n"; cin>>node->data; start=node; } message(); } voidinsertion_pos(){ structll*node=newll; intpos,i; cout<<"pleaseenterposition\n"; cin>>pos; if(start==NULL){ start=node; cout<<"pleaseenterdata\n"; cin>>start->data; start->next=NULL; } else{ structll*p=start; structll*q; i=1;
while(p->next!=NULL&&pos!=i){ q=p; p=p->next; i=i+1; } if(pos==1){ insertion_beg(); } elseif(pos>i){ p->next=node; node->next=NULL; cout<<"pleaseenterdata\n"; cin>>node->data; } else{ cout<<"pleaseenterdata\n"; cin>>node->data; node->next=p; q->next=node; } } message(); } voiddeletion_end(){ //inthiswearedeletinglastnode structll*p=start;//creatingtwotemppointerpandq structll*q=NULL; if(start==NULL){ cout<<"linklistisempty\n"; } else{ while(p->next!=NULL){ q=p;//qhold1lesspositionthanp p=p->next; } if(q==NULL) start=NULL; else q->next=NULL; deletep; } message(); } voiddeletion_beg(){ structll*p=start; if(start->next==NULL){ deletep; start=NULL; } elseif(start==NULL){ cout<<"LinkListisempty\n"; } else{ start=p->next; deletep; } message(); } voiddeletion_pos(){ if(start==NULL){
cout<<"LinkListisempty\n"; } else{ structll*p=start; structll*q; inti=1,pos; cout<<"pleaseenterspecificposition\n"; cin>>pos; while(p->next!=NULL&&pos!=i){ q=p; p=p->next; i=i+1; } if(pos==1){ deletion_beg(); } elseif(pos>i){ cout<<"\nlistcontainonly"<
next=p->next; deletep; } } message(); } voidtraverse(){ if(start==NULL){ cout<<"LinkListEmpty\n"; message(); } else{ structll*p=start; while(p->next!=NULL){ cout<
data<
next; } cout<
data<
×
Report "Program of singly link list in c++"
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
×
Sign In
Email
Password
Remember me
Forgot password?
Sign In
Our partners will collect data and use cookies for ad personalization and measurement.
Learn how we and our ad partner Google, collect and use data
.
Agree & close