SlideShare a Scribd company logo
1 of 14
Download to read offline
Assignment is :
"Page 349-350 #4 and #5 Use the "Linked List lab" you have been working on in class and add
the two functions the questions are asking you to develop: divideMid and divideAt. Be sure to
include comments Use meaningful identifier names (constants where appropriate) Do not work
together; no two people should have identical work!?!? Turn in .cpp file AND Turn in a "print-
screen' of your output (press "print-screen' on keyboard, then 'paste' in MS-Word)"
How do you solve QUESTION #5 in the book data structures using c++ by D.S. Malik in Visiual
Studios using the linked list below with what is being asked? Please need help
Linked list :
#include
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void deleteLast(nodeType*& last, nodeType* first);
int main()
{
nodeType *first, *last;
int num;
createList(first, last);
int choice;
while(true)
{
cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Exit.
";
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 1: insertFront(first); break;
case 2: insertBack(last); break;
case 3: deleteFirst(first); break;
case 4: deleteLast(last, first); break;
case 5: printList(first); break;
case 6: return 0;
default: cout<<"Invalid menu option. Try again."<>number;
while (number != -999)
{
newNode = new nodeType; // create new node
newNode->info = number;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout<<"Enter an integer (-999 to stop): ";
cin>>number;
} // end of while-loop
} // end of build list function
void deleteFirst(nodeType*& first)
{
nodeType *temp;
temp= first;
first= temp->link;
delete temp;
return;
}
void deleteLast(nodeType*& last, nodeType* current)
{
nodeType *temp;
while(current->link != NULL)
{
temp=current;
current=current->link;
}
temp=last;
current->link=NULL;
delete temp;
last = current;
return;
}
void insertFront(nodeType*& front)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= front;
front= newNode;
return;
}
void insertBack(nodeType*& last)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= NULL;
last->link= newNode;
last = newNode;
return;
}
void printList(nodeType*& first)
{
cout<<"Inside printList...printing linked list... "<info << " ";
current = current->link;
}
cout<
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void deleteLast(nodeType*& last, nodeType* first);
int main()
{
nodeType *first, *last;
int num;
createList(first, last);
int choice;
while(true)
{
cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Exit.
";
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 1: insertFront(first); break;
case 2: insertBack(last); break;
case 3: deleteFirst(first); break;
case 4: deleteLast(last, first); break;
case 5: printList(first); break;
case 6: return 0;
default: cout<<"Invalid menu option. Try again."<>number;
while (number != -999)
{
newNode = new nodeType; // create new node
newNode->info = number;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout<<"Enter an integer (-999 to stop): ";
cin>>number;
} // end of while-loop
} // end of build list function
void deleteFirst(nodeType*& first)
{
nodeType *temp;
temp= first;
first= temp->link;
delete temp;
return;
}
void deleteLast(nodeType*& last, nodeType* current)
{
nodeType *temp;
while(current->link != NULL)
{
temp=current;
current=current->link;
}
temp=last;
current->link=NULL;
delete temp;
last = current;
return;
}
void insertFront(nodeType*& front)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= front;
front= newNode;
return;
}
void insertBack(nodeType*& last)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= NULL;
last->link= newNode;
last = newNode;
return;
}
void printList(nodeType*& first)
{
cout<<"Inside printList...printing linked list... "<info << " ";
current = current->link;
}
cout< otherList; Suppose myList points to the list with the elements: 34 65 18 39 27 89 12 (in
this order). The statement: myList divideAt (otherList, 18) divides myList into two sublists:
myList points to the list with the elements 34 65, and otherList points to the sublist with the
elements 39 27 89 12. 6. b. Write the definition of the function to implement the tion divide
template a. Add o write a program to test your function. the following operation to the class
dered inkedli st opera-
Solution
Explanation :-
----------------------------
1.Take
nodeType *first1, *last1;
First and last for the divided list
2. Add Choice "6" for Divide
3.When user enter choice
Ask index where to break the list
When user enters the index , then break the list there
3) After User enters the index of item where to break the list
First find the item at the index
4)Check the method
/**
* first---> start of main list
* last ----> last of main list
* first1---> start of new list after list
* last1 ----> last of new listafter list
* item ---> item at which we have to split
*/
void breakList(nodeType*& first, nodeType*& last,nodeType*& first1, nodeType*&
last1,nodeType*item);
5)To break the list at middle , just give the middle index
Programme :-
----------------------------
#include
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void deleteLast(nodeType*& last, nodeType* first);
//method to split the list
/**
* first---> start of main list
* last ----> last of main list
* first1---> start of new list after list
* last1 ----> last of new listafter list
* item ---> item at which we have to split
*/
void breakList(nodeType*& first, nodeType*& last,nodeType*& first1, nodeType*&
last1,nodeType*item);
int main()
{
nodeType *first, *last;
//First,Last for 2nd list after divide
nodeType *first1, *last1;
int num;
createList(first, last);
int choice;
while(true)
{
cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Divide
7. Exit. ";
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 1: insertFront(first); break;
case 2: insertBack(last); break;
case 3: deleteFirst(first); break;
case 4: deleteLast(last, first); break;
case 5: printList(first); break;
//case 6 , Divide
case 6:{
int index;
//Ask user item at which we need to divide
cout<<"Enter your index: ";
cin>>index;
//Go to item at given index , and then split
int i = 0;
nodeType *current = NULL;
current = first;
while (current != NULL)
{
current = current->link;
i++;
if(i == index){
break;
}
}
breakList(first,last,first1,last1,current);
}
break;
case 7: return 0;
default: cout<<"Invalid menu option. Try again."<>number;
while (number != -999)
{
newNode = new nodeType; // create new node
newNode->info = number;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout<<"Enter an integer (-999 to stop): ";
cin>>number;
} // end of while-loop
} // end of build list function
void deleteFirst(nodeType*& first)
{
nodeType *temp;
temp= first;
first= temp->link;
delete temp;
return;
}
void deleteLast(nodeType*& last, nodeType* current)
{
nodeType *temp;
while(current->link != NULL)
{
temp=current;
current=current->link;
}
temp=last;
current->link=NULL;
delete temp;
last = current;
return;
}
void insertFront(nodeType*& front)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= front;
front= newNode;
return;
}
void insertBack(nodeType*& last)
{
int num;
cout<<" Enter the number to insert: ";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= NULL;
last->link= newNode;
last = newNode;
return;
}
void printList(nodeType*& first)
{
cout<<"Inside printList...printing linked list... "<info << " ";
current = current->link;
}
cout<link == item){
found = true;
break;
}
current = current->link;
}
//If item found
if(found){
//set first of new list
first1 = current->link;
//set last of new list
last1= last;
//set last of new list
last = current;
//close old list after current item
last->link = NULL;
}
}

More Related Content

Similar to Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf

Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfJUSTSTYLISH3B2MOHALI
Β 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdfadityastores21
Β 
Please need help on following program using c++ language. Please inc.pdf
Please need help on following program using c++ language. Please inc.pdfPlease need help on following program using c++ language. Please inc.pdf
Please need help on following program using c++ language. Please inc.pdfnitinarora01
Β 
C++ Background Circular Linked List A circular linked list.pdf
C++ Background Circular Linked List A circular linked list.pdfC++ Background Circular Linked List A circular linked list.pdf
C++ Background Circular Linked List A circular linked list.pdfsaradashata
Β 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfstopgolook
Β 
Background Circular Linked List A circular linked list is .pdf
Background Circular Linked List A circular linked list is .pdfBackground Circular Linked List A circular linked list is .pdf
Background Circular Linked List A circular linked list is .pdfaaseletronics2013
Β 
C++ Please test your program before you submit the answer.pdf
C++ Please test your program before you submit the answer.pdfC++ Please test your program before you submit the answer.pdf
C++ Please test your program before you submit the answer.pdfaashisha5
Β 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
Β 
Implement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfImplement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfarihantstoneart
Β 
Write a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfWrite a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfthangarajarivukadal
Β 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfConint29
Β 
C++ please put everthing after you answer it- thanks Complete the stub.docx
C++ please put everthing after you answer it- thanks Complete the stub.docxC++ please put everthing after you answer it- thanks Complete the stub.docx
C++ please put everthing after you answer it- thanks Complete the stub.docxMatthPYNashd
Β 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdffathimahardwareelect
Β 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdfaathmaproducts
Β 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdfaathiauto
Β 
Write the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxWrite the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxdelicecogupdyke
Β 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfARCHANASTOREKOTA
Β 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdfalmaniaeyewear
Β 
coding in C- Create a function called reverseList that takes the head.docx
coding in C- Create a function called reverseList that takes the head.docxcoding in C- Create a function called reverseList that takes the head.docx
coding in C- Create a function called reverseList that takes the head.docxtienlivick
Β 

Similar to Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf (20)

Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
Β 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdf
Β 
Please need help on following program using c++ language. Please inc.pdf
Please need help on following program using c++ language. Please inc.pdfPlease need help on following program using c++ language. Please inc.pdf
Please need help on following program using c++ language. Please inc.pdf
Β 
C++ Background Circular Linked List A circular linked list.pdf
C++ Background Circular Linked List A circular linked list.pdfC++ Background Circular Linked List A circular linked list.pdf
C++ Background Circular Linked List A circular linked list.pdf
Β 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
Β 
Background Circular Linked List A circular linked list is .pdf
Background Circular Linked List A circular linked list is .pdfBackground Circular Linked List A circular linked list is .pdf
Background Circular Linked List A circular linked list is .pdf
Β 
C++ Please test your program before you submit the answer.pdf
C++ Please test your program before you submit the answer.pdfC++ Please test your program before you submit the answer.pdf
C++ Please test your program before you submit the answer.pdf
Β 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
Β 
Implement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfImplement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdf
Β 
Write a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfWrite a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdf
Β 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Β 
C++ please put everthing after you answer it- thanks Complete the stub.docx
C++ please put everthing after you answer it- thanks Complete the stub.docxC++ please put everthing after you answer it- thanks Complete the stub.docx
C++ please put everthing after you answer it- thanks Complete the stub.docx
Β 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
Β 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
Β 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
Β 
Write the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxWrite the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docx
Β 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
Β 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
Β 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdf
Β 
coding in C- Create a function called reverseList that takes the head.docx
coding in C- Create a function called reverseList that takes the head.docxcoding in C- Create a function called reverseList that takes the head.docx
coding in C- Create a function called reverseList that takes the head.docx
Β 

More from formicreation

Many people believe that, because the emergence of life was very impr.pdf
Many people believe that, because the emergence of life was very impr.pdfMany people believe that, because the emergence of life was very impr.pdf
Many people believe that, because the emergence of life was very impr.pdfformicreation
Β 
Know the different types of viruses which have a dsRNA genome A type .pdf
Know the different types of viruses which have a dsRNA genome A type .pdfKnow the different types of viruses which have a dsRNA genome A type .pdf
Know the different types of viruses which have a dsRNA genome A type .pdfformicreation
Β 
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdf
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdfIssued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdf
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdfformicreation
Β 
IPv4 provided the primary addressing scheme in TCPIP. However after.pdf
IPv4 provided the primary addressing scheme in TCPIP. However after.pdfIPv4 provided the primary addressing scheme in TCPIP. However after.pdf
IPv4 provided the primary addressing scheme in TCPIP. However after.pdfformicreation
Β 
Implement the member function void insertAfterHead(int d) of the Lin.pdf
Implement the member function void insertAfterHead(int d) of the Lin.pdfImplement the member function void insertAfterHead(int d) of the Lin.pdf
Implement the member function void insertAfterHead(int d) of the Lin.pdfformicreation
Β 
I am trying to create a program that will create Objects of differen.pdf
I am trying to create a program that will create Objects of differen.pdfI am trying to create a program that will create Objects of differen.pdf
I am trying to create a program that will create Objects of differen.pdfformicreation
Β 
How does Ansoffs matrix impact organizations missionsSoluti.pdf
How does Ansoffs matrix impact organizations missionsSoluti.pdfHow does Ansoffs matrix impact organizations missionsSoluti.pdf
How does Ansoffs matrix impact organizations missionsSoluti.pdfformicreation
Β 
How is a chorioallantoic placenta different from a choriovitelline.pdf
How is a chorioallantoic placenta different from a choriovitelline.pdfHow is a chorioallantoic placenta different from a choriovitelline.pdf
How is a chorioallantoic placenta different from a choriovitelline.pdfformicreation
Β 
How can I tell when it is going to be a Archimedean Spiral. What is .pdf
How can I tell when it is going to be a Archimedean Spiral. What is .pdfHow can I tell when it is going to be a Archimedean Spiral. What is .pdf
How can I tell when it is going to be a Archimedean Spiral. What is .pdfformicreation
Β 
flow chart or step by step process of the key steps in forming a uni.pdf
flow chart or step by step process of the key steps in forming a uni.pdfflow chart or step by step process of the key steps in forming a uni.pdf
flow chart or step by step process of the key steps in forming a uni.pdfformicreation
Β 
Description For this part of the assignment, you will create a Grid .pdf
Description For this part of the assignment, you will create a Grid .pdfDescription For this part of the assignment, you will create a Grid .pdf
Description For this part of the assignment, you will create a Grid .pdfformicreation
Β 
Discuss one (1) traditional and two (2) new strategies that special i.pdf
Discuss one (1) traditional and two (2) new strategies that special i.pdfDiscuss one (1) traditional and two (2) new strategies that special i.pdf
Discuss one (1) traditional and two (2) new strategies that special i.pdfformicreation
Β 
Define health systems and healthcare delivery systems and discuss th.pdf
Define health systems and healthcare delivery systems and discuss th.pdfDefine health systems and healthcare delivery systems and discuss th.pdf
Define health systems and healthcare delivery systems and discuss th.pdfformicreation
Β 
B. You do an experiment in which you divide 8 cell stage urch.pdf
B. You do an experiment in which you divide 8 cell stage urch.pdfB. You do an experiment in which you divide 8 cell stage urch.pdf
B. You do an experiment in which you divide 8 cell stage urch.pdfformicreation
Β 
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdf
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdfa. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdf
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdfformicreation
Β 
An electron is moving in a circular motion clockwise. A uniform magne.pdf
An electron is moving in a circular motion clockwise. A uniform magne.pdfAn electron is moving in a circular motion clockwise. A uniform magne.pdf
An electron is moving in a circular motion clockwise. A uniform magne.pdfformicreation
Β 
After reading Thomas Malthus population theory and the ideas of Ju.pdf
After reading Thomas Malthus population theory and the ideas of Ju.pdfAfter reading Thomas Malthus population theory and the ideas of Ju.pdf
After reading Thomas Malthus population theory and the ideas of Ju.pdfformicreation
Β 
Any ideas on an IT topic I could use for this case studyFor this .pdf
Any ideas on an IT topic I could use for this case studyFor this .pdfAny ideas on an IT topic I could use for this case studyFor this .pdf
Any ideas on an IT topic I could use for this case studyFor this .pdfformicreation
Β 
C++ Write a function that takes a number as a parameter and display.pdf
C++ Write a function that takes a number as a parameter and display.pdfC++ Write a function that takes a number as a parameter and display.pdf
C++ Write a function that takes a number as a parameter and display.pdfformicreation
Β 
Why is it important for marketers to understand the product life cyc.pdf
Why is it important for marketers to understand the product life cyc.pdfWhy is it important for marketers to understand the product life cyc.pdf
Why is it important for marketers to understand the product life cyc.pdfformicreation
Β 

More from formicreation (20)

Many people believe that, because the emergence of life was very impr.pdf
Many people believe that, because the emergence of life was very impr.pdfMany people believe that, because the emergence of life was very impr.pdf
Many people believe that, because the emergence of life was very impr.pdf
Β 
Know the different types of viruses which have a dsRNA genome A type .pdf
Know the different types of viruses which have a dsRNA genome A type .pdfKnow the different types of viruses which have a dsRNA genome A type .pdf
Know the different types of viruses which have a dsRNA genome A type .pdf
Β 
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdf
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdfIssued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdf
Issued a $4000 Note Receivable for 3 months 10 interest. Calculate .pdf
Β 
IPv4 provided the primary addressing scheme in TCPIP. However after.pdf
IPv4 provided the primary addressing scheme in TCPIP. However after.pdfIPv4 provided the primary addressing scheme in TCPIP. However after.pdf
IPv4 provided the primary addressing scheme in TCPIP. However after.pdf
Β 
Implement the member function void insertAfterHead(int d) of the Lin.pdf
Implement the member function void insertAfterHead(int d) of the Lin.pdfImplement the member function void insertAfterHead(int d) of the Lin.pdf
Implement the member function void insertAfterHead(int d) of the Lin.pdf
Β 
I am trying to create a program that will create Objects of differen.pdf
I am trying to create a program that will create Objects of differen.pdfI am trying to create a program that will create Objects of differen.pdf
I am trying to create a program that will create Objects of differen.pdf
Β 
How does Ansoffs matrix impact organizations missionsSoluti.pdf
How does Ansoffs matrix impact organizations missionsSoluti.pdfHow does Ansoffs matrix impact organizations missionsSoluti.pdf
How does Ansoffs matrix impact organizations missionsSoluti.pdf
Β 
How is a chorioallantoic placenta different from a choriovitelline.pdf
How is a chorioallantoic placenta different from a choriovitelline.pdfHow is a chorioallantoic placenta different from a choriovitelline.pdf
How is a chorioallantoic placenta different from a choriovitelline.pdf
Β 
How can I tell when it is going to be a Archimedean Spiral. What is .pdf
How can I tell when it is going to be a Archimedean Spiral. What is .pdfHow can I tell when it is going to be a Archimedean Spiral. What is .pdf
How can I tell when it is going to be a Archimedean Spiral. What is .pdf
Β 
flow chart or step by step process of the key steps in forming a uni.pdf
flow chart or step by step process of the key steps in forming a uni.pdfflow chart or step by step process of the key steps in forming a uni.pdf
flow chart or step by step process of the key steps in forming a uni.pdf
Β 
Description For this part of the assignment, you will create a Grid .pdf
Description For this part of the assignment, you will create a Grid .pdfDescription For this part of the assignment, you will create a Grid .pdf
Description For this part of the assignment, you will create a Grid .pdf
Β 
Discuss one (1) traditional and two (2) new strategies that special i.pdf
Discuss one (1) traditional and two (2) new strategies that special i.pdfDiscuss one (1) traditional and two (2) new strategies that special i.pdf
Discuss one (1) traditional and two (2) new strategies that special i.pdf
Β 
Define health systems and healthcare delivery systems and discuss th.pdf
Define health systems and healthcare delivery systems and discuss th.pdfDefine health systems and healthcare delivery systems and discuss th.pdf
Define health systems and healthcare delivery systems and discuss th.pdf
Β 
B. You do an experiment in which you divide 8 cell stage urch.pdf
B. You do an experiment in which you divide 8 cell stage urch.pdfB. You do an experiment in which you divide 8 cell stage urch.pdf
B. You do an experiment in which you divide 8 cell stage urch.pdf
Β 
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdf
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdfa. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdf
a. project aid. b. emergency aid. c. development aid. d. bilateral ai.pdf
Β 
An electron is moving in a circular motion clockwise. A uniform magne.pdf
An electron is moving in a circular motion clockwise. A uniform magne.pdfAn electron is moving in a circular motion clockwise. A uniform magne.pdf
An electron is moving in a circular motion clockwise. A uniform magne.pdf
Β 
After reading Thomas Malthus population theory and the ideas of Ju.pdf
After reading Thomas Malthus population theory and the ideas of Ju.pdfAfter reading Thomas Malthus population theory and the ideas of Ju.pdf
After reading Thomas Malthus population theory and the ideas of Ju.pdf
Β 
Any ideas on an IT topic I could use for this case studyFor this .pdf
Any ideas on an IT topic I could use for this case studyFor this .pdfAny ideas on an IT topic I could use for this case studyFor this .pdf
Any ideas on an IT topic I could use for this case studyFor this .pdf
Β 
C++ Write a function that takes a number as a parameter and display.pdf
C++ Write a function that takes a number as a parameter and display.pdfC++ Write a function that takes a number as a parameter and display.pdf
C++ Write a function that takes a number as a parameter and display.pdf
Β 
Why is it important for marketers to understand the product life cyc.pdf
Why is it important for marketers to understand the product life cyc.pdfWhy is it important for marketers to understand the product life cyc.pdf
Why is it important for marketers to understand the product life cyc.pdf
Β 

Recently uploaded

ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)Dr. Mazin Mohamed alkathiri
Β 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
Β 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ9953056974 Low Rate Call Girls In Saket, Delhi NCR
Β 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
Β 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
Β 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
Β 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Β 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
Β 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
Β 

Recently uploaded (20)

ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
Β 
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Β 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
Β 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
Β 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Β 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Β 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
Β 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Β 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
Β 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Β 

Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf

  • 1. Assignment is : "Page 349-350 #4 and #5 Use the "Linked List lab" you have been working on in class and add the two functions the questions are asking you to develop: divideMid and divideAt. Be sure to include comments Use meaningful identifier names (constants where appropriate) Do not work together; no two people should have identical work!?!? Turn in .cpp file AND Turn in a "print- screen' of your output (press "print-screen' on keyboard, then 'paste' in MS-Word)" How do you solve QUESTION #5 in the book data structures using c++ by D.S. Malik in Visiual Studios using the linked list below with what is being asked? Please need help Linked list : #include #include using namespace std; struct nodeType { int info; nodeType *link; }; void createList(nodeType*& first, nodeType*& last); void printList(nodeType*& first); void insertFront(nodeType*& first);
  • 2. void insertBack(nodeType*& last); void deleteFirst(nodeType*& first); void deleteLast(nodeType*& last, nodeType* first); int main() { nodeType *first, *last; int num; createList(first, last); int choice; while(true) { cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Exit. "; cout<<"Enter your choice: "; cin>>choice; switch(choice) { case 1: insertFront(first); break; case 2: insertBack(last); break; case 3: deleteFirst(first); break; case 4: deleteLast(last, first); break; case 5: printList(first); break; case 6: return 0; default: cout<<"Invalid menu option. Try again."<>number; while (number != -999) { newNode = new nodeType; // create new node newNode->info = number;
  • 3. newNode->link = NULL; if (first == NULL) { first = newNode; last = newNode; } else { last->link = newNode; last = newNode; } cout<<"Enter an integer (-999 to stop): "; cin>>number; } // end of while-loop } // end of build list function void deleteFirst(nodeType*& first) { nodeType *temp;
  • 4. temp= first; first= temp->link; delete temp; return; } void deleteLast(nodeType*& last, nodeType* current) { nodeType *temp; while(current->link != NULL) { temp=current; current=current->link; } temp=last; current->link=NULL; delete temp; last = current; return; } void insertFront(nodeType*& front) { int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= front; front= newNode; return; }
  • 5. void insertBack(nodeType*& last) { int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= NULL; last->link= newNode; last = newNode; return; } void printList(nodeType*& first) { cout<<"Inside printList...printing linked list... "<info << " "; current = current->link; } cout< #include using namespace std; struct nodeType { int info; nodeType *link; }; void createList(nodeType*& first, nodeType*& last); void printList(nodeType*& first); void insertFront(nodeType*& first); void insertBack(nodeType*& last); void deleteFirst(nodeType*& first);
  • 6. void deleteLast(nodeType*& last, nodeType* first); int main() { nodeType *first, *last; int num; createList(first, last); int choice; while(true) { cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Exit. "; cout<<"Enter your choice: "; cin>>choice; switch(choice) { case 1: insertFront(first); break; case 2: insertBack(last); break; case 3: deleteFirst(first); break; case 4: deleteLast(last, first); break; case 5: printList(first); break; case 6: return 0; default: cout<<"Invalid menu option. Try again."<>number; while (number != -999) { newNode = new nodeType; // create new node newNode->info = number; newNode->link = NULL;
  • 7. if (first == NULL) { first = newNode; last = newNode; } else { last->link = newNode; last = newNode; } cout<<"Enter an integer (-999 to stop): "; cin>>number; } // end of while-loop } // end of build list function void deleteFirst(nodeType*& first) { nodeType *temp; temp= first; first= temp->link;
  • 8. delete temp; return; } void deleteLast(nodeType*& last, nodeType* current) { nodeType *temp; while(current->link != NULL) { temp=current; current=current->link; } temp=last; current->link=NULL; delete temp; last = current; return; } void insertFront(nodeType*& front) { int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= front; front= newNode; return; } void insertBack(nodeType*& last) {
  • 9. int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= NULL; last->link= newNode; last = newNode; return; } void printList(nodeType*& first) { cout<<"Inside printList...printing linked list... "<info << " "; current = current->link; } cout< otherList; Suppose myList points to the list with the elements: 34 65 18 39 27 89 12 (in this order). The statement: myList divideAt (otherList, 18) divides myList into two sublists: myList points to the list with the elements 34 65, and otherList points to the sublist with the elements 39 27 89 12. 6. b. Write the definition of the function to implement the tion divide template a. Add o write a program to test your function. the following operation to the class dered inkedli st opera- Solution Explanation :- ---------------------------- 1.Take nodeType *first1, *last1; First and last for the divided list 2. Add Choice "6" for Divide 3.When user enter choice Ask index where to break the list
  • 10. When user enters the index , then break the list there 3) After User enters the index of item where to break the list First find the item at the index 4)Check the method /** * first---> start of main list * last ----> last of main list * first1---> start of new list after list * last1 ----> last of new listafter list * item ---> item at which we have to split */ void breakList(nodeType*& first, nodeType*& last,nodeType*& first1, nodeType*& last1,nodeType*item); 5)To break the list at middle , just give the middle index Programme :- ---------------------------- #include #include using namespace std; struct nodeType { int info; nodeType *link; }; void createList(nodeType*& first, nodeType*& last); void printList(nodeType*& first); void insertFront(nodeType*& first); void insertBack(nodeType*& last); void deleteFirst(nodeType*& first); void deleteLast(nodeType*& last, nodeType* first); //method to split the list /** * first---> start of main list * last ----> last of main list * first1---> start of new list after list * last1 ----> last of new listafter list
  • 11. * item ---> item at which we have to split */ void breakList(nodeType*& first, nodeType*& last,nodeType*& first1, nodeType*& last1,nodeType*item); int main() { nodeType *first, *last; //First,Last for 2nd list after divide nodeType *first1, *last1; int num; createList(first, last); int choice; while(true) { cout<<"1. Insert Front. 2. Insert Last. 3. Delete Front. 4. Delete Last. 5. Print List. 6. Divide 7. Exit. "; cout<<"Enter your choice: "; cin>>choice; switch(choice) { case 1: insertFront(first); break; case 2: insertBack(last); break; case 3: deleteFirst(first); break; case 4: deleteLast(last, first); break; case 5: printList(first); break; //case 6 , Divide case 6:{ int index; //Ask user item at which we need to divide cout<<"Enter your index: "; cin>>index; //Go to item at given index , and then split int i = 0; nodeType *current = NULL; current = first; while (current != NULL)
  • 12. { current = current->link; i++; if(i == index){ break; } } breakList(first,last,first1,last1,current); } break; case 7: return 0; default: cout<<"Invalid menu option. Try again."<>number; while (number != -999) { newNode = new nodeType; // create new node newNode->info = number; newNode->link = NULL; if (first == NULL) { first = newNode; last = newNode; } else { last->link = newNode; last = newNode; } cout<<"Enter an integer (-999 to stop): "; cin>>number; } // end of while-loop } // end of build list function void deleteFirst(nodeType*& first) { nodeType *temp; temp= first; first= temp->link;
  • 13. delete temp; return; } void deleteLast(nodeType*& last, nodeType* current) { nodeType *temp; while(current->link != NULL) { temp=current; current=current->link; } temp=last; current->link=NULL; delete temp; last = current; return; } void insertFront(nodeType*& front) { int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= front; front= newNode; return; } void insertBack(nodeType*& last) { int num; cout<<" Enter the number to insert: "; cin>>num; nodeType *newNode = new nodeType; newNode->info=num; newNode->link= NULL;
  • 14. last->link= newNode; last = newNode; return; } void printList(nodeType*& first) { cout<<"Inside printList...printing linked list... "<info << " "; current = current->link; } cout<link == item){ found = true; break; } current = current->link; } //If item found if(found){ //set first of new list first1 = current->link; //set last of new list last1= last; //set last of new list last = current; //close old list after current item last->link = NULL; } }