SlideShare a Scribd company logo
1 of 8
Download to read offline
I will provide my LinkedList from my last lab.
LinkedList.cpp
~~~~~~~~~~~~~~
#include "LinkedList.h"
LinkedList::LinkedList()
{
first = last = NULL;
}
LinkedList::~LinkedList()
{
while (first != NULL)
{
Node *temp;
temp = first;
first = first->next;
free(temp);
}
last = NULL;
}
void LinkedList::insertAtBack(int valueToInsert)
{
Node *temp = (Node *)malloc(sizeof(Node));
temp->val = valueToInsert;
temp->next = NULL;
if (last == NULL)
first = last = temp;
else
{
last->next = temp;
last = temp;
}
}
bool LinkedList::removeFromBack()
{
if (first == NULL)
return false;
else if (first == last)
{
free(first);
first = last = NULL;
}
else
{
Node *temp;
temp = first;
while (temp->next != last)
temp = temp->next;
last = temp;
temp = temp->next;
free(temp);
last->next = NULL;
}
return true;
}
void LinkedList::print()
{
Node *temp = first;
while (temp != last)
{
cout << temp->val << " ";
temp = temp->next;
}
if (temp != NULL)
cout << temp->val;
}
bool LinkedList::isEmpty()
{
if (first == last)
return true;
return false;
}
int LinkedList::size()
{
int count = 0;
Node *temp = first;
if (temp == NULL)
return count;
while (temp != last)
{
count++;
temp = temp->next;
}
return count + 1;
}
void LinkedList::clear()
{
while (first != NULL)
{
Node *temp;
temp = first;
first = first->next;
free(temp);
}
last = NULL;
}
/*Exercise2 */
void LinkedList::insertAtFront(int valueToInsert)
{
Node *temp = (Node *)malloc(sizeof(Node));
temp->val = valueToInsert;
if (last == NULL)
first = last = temp;
else
{
temp->next = first;
first = temp;
}
}
bool LinkedList::removeFromFront()
{
if (first == NULL)
return false;
Node *temp = first;
first = first->next;
free(temp);
if (first == NULL)
last = NULL;
return true;
}
LinkedList.h
~~~~~~~~~~~
#include "LinkedList.h"
LinkedList::LinkedList()
{
first = last = NULL;
}
LinkedList::~LinkedList()
{
while (first != NULL)
{
Node *temp;
temp = first;
first = first->next;
free(temp);
}
last = NULL;
}
void LinkedList::insertAtBack(int valueToInsert)
{
Node *temp = (Node *)malloc(sizeof(Node));
temp->val = valueToInsert;
temp->next = NULL;
if (last == NULL)
first = last = temp;
else
{
last->next = temp;
last = temp;
}
}
bool LinkedList::removeFromBack()
{
if (first == NULL)
return false;
else if (first == last)
{
free(first);
first = last = NULL;
}
else
{
Node *temp;
temp = first;
while (temp->next != last)
temp = temp->next;
last = temp;
temp = temp->next;
free(temp);
last->next = NULL;
}
return true;
}
void LinkedList::print()
{
Node *temp = first;
while (temp != last)
{
cout << temp->val << " ";
temp = temp->next;
}
if (temp != NULL)
cout << temp->val;
}
bool LinkedList::isEmpty()
{
if (first == last)
return true;
return false;
}
int LinkedList::size()
{
int count = 0;
Node *temp = first;
if (temp == NULL)
return count;
while (temp != last)
{
count++;
temp = temp->next;
}
return count + 1;
}
void LinkedList::clear()
{
while (first != NULL)
{
Node *temp;
temp = first;
first = first->next;
free(temp);
}
last = NULL;
}
/*Exercise2 */
void LinkedList::insertAtFront(int valueToInsert)
{
Node *temp = (Node *)malloc(sizeof(Node));
temp->val = valueToInsert;
if (last == NULL)
first = last = temp;
else
{
temp->next = first;
first = temp;
}
}
bool LinkedList::removeFromFront()
{
if (first == NULL)
return false;
Node *temp = first;
first = first->next;
free(temp);
if (first == NULL)
last = NULL;
return true;
}
Solution
class Exersize1
{
//calling functions of server class.
public:
node* insertAtBack(int);
void insert_begin();
void removeFromBack();
void insert_last();
void removeFrom_Position();
void size();
void clear();
void isEmpty();
void print();
single_llist()
{
start = NULL;
}
};

More Related Content

Similar to I will provide my LinkedList from my last lab.LinkedList.cpp~~~~.pdf

Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdfCopy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdffacevenky
 
#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdfharihelectronicspune
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfmalavshah9013
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdfKUNALHARCHANDANI1
 
LinkedListOperations.java-class Node{    public int item;  .pdf
LinkedListOperations.java-class Node{    public int item;  .pdfLinkedListOperations.java-class Node{    public int item;  .pdf
LinkedListOperations.java-class Node{    public int item;  .pdfaquastore223
 
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
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfflashfashioncasualwe
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
 
DS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxDS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxVeerannaKotagi1
 
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdfHere is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdfarrowmobile
 
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdfLabprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdffreddysarabia1
 
public static class LinkedDequeT implements DequeADTT{    priv.pdf
public static class LinkedDequeT implements DequeADTT{    priv.pdfpublic static class LinkedDequeT implements DequeADTT{    priv.pdf
public static class LinkedDequeT implements DequeADTT{    priv.pdfamaresh6333
 
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
 
Help explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfHelp explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfalmonardfans
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfmail931892
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfclimatecontrolsv
 

Similar to I will provide my LinkedList from my last lab.LinkedList.cpp~~~~.pdf (20)

Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdfCopy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
 
#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf
 
LinkedListOperations.java-class Node{    public int item;  .pdf
LinkedListOperations.java-class Node{    public int item;  .pdfLinkedListOperations.java-class Node{    public int item;  .pdf
LinkedListOperations.java-class Node{    public int item;  .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
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
DS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxDS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docx
 
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdfHere is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
 
Hw3
Hw3Hw3
Hw3
 
Ds 2 cycle
Ds 2 cycleDs 2 cycle
Ds 2 cycle
 
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdfLabprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
 
public static class LinkedDequeT implements DequeADTT{    priv.pdf
public static class LinkedDequeT implements DequeADTT{    priv.pdfpublic static class LinkedDequeT implements DequeADTT{    priv.pdf
public static class LinkedDequeT implements DequeADTT{    priv.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
 
Linked Stack program.docx
Linked Stack program.docxLinked Stack program.docx
Linked Stack program.docx
 
Help explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfHelp explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdf
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
 
FSE 2008
FSE 2008FSE 2008
FSE 2008
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
 

More from funkybabyindia

Part C AssessmentsAs you examined each specific connective tissue,.pdf
Part C AssessmentsAs you examined each specific connective tissue,.pdfPart C AssessmentsAs you examined each specific connective tissue,.pdf
Part C AssessmentsAs you examined each specific connective tissue,.pdffunkybabyindia
 
please answer in details12 A communication system consists of 13 a.pdf
please answer in details12 A communication system consists of 13 a.pdfplease answer in details12 A communication system consists of 13 a.pdf
please answer in details12 A communication system consists of 13 a.pdffunkybabyindia
 
Name the plant phylum that exhibit the follow characteristics Co.pdf
Name the plant phylum that exhibit the follow characteristics  Co.pdfName the plant phylum that exhibit the follow characteristics  Co.pdf
Name the plant phylum that exhibit the follow characteristics Co.pdffunkybabyindia
 
Individuals that express the disease sickle cell anemia are homozygo.pdf
Individuals that express the disease sickle cell anemia are homozygo.pdfIndividuals that express the disease sickle cell anemia are homozygo.pdf
Individuals that express the disease sickle cell anemia are homozygo.pdffunkybabyindia
 
Implementing a basic directory-tree structure that is derived from a.pdf
Implementing a basic directory-tree structure that is derived from a.pdfImplementing a basic directory-tree structure that is derived from a.pdf
Implementing a basic directory-tree structure that is derived from a.pdffunkybabyindia
 
I need help summarizing a research article!! I need to summarize an .pdf
I need help summarizing a research article!! I need to summarize an .pdfI need help summarizing a research article!! I need to summarize an .pdf
I need help summarizing a research article!! I need to summarize an .pdffunkybabyindia
 
For the pedigree on the right, individuals affected with the genetic.pdf
For the pedigree on the right, individuals affected with the genetic.pdfFor the pedigree on the right, individuals affected with the genetic.pdf
For the pedigree on the right, individuals affected with the genetic.pdffunkybabyindia
 
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdf
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdfHow are the xylem and phloem arranged in a eudicot rootA. the xyl.pdf
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdffunkybabyindia
 
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdf
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdfGraph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdf
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdffunkybabyindia
 
Explain why Drosophila are often used as model organisms in the study.pdf
Explain why Drosophila are often used as model organisms in the study.pdfExplain why Drosophila are often used as model organisms in the study.pdf
Explain why Drosophila are often used as model organisms in the study.pdffunkybabyindia
 
Examine the two animals in the photographs figure. Use all of the c.pdf
Examine the two animals in the photographs figure. Use all of the c.pdfExamine the two animals in the photographs figure. Use all of the c.pdf
Examine the two animals in the photographs figure. Use all of the c.pdffunkybabyindia
 
Assess the types of stakeholders involved in the development process.pdf
Assess the types of stakeholders involved in the development process.pdfAssess the types of stakeholders involved in the development process.pdf
Assess the types of stakeholders involved in the development process.pdffunkybabyindia
 
There is a well-defined classification s developed originally by Caro.pdf
There is a well-defined classification s developed originally by Caro.pdfThere is a well-defined classification s developed originally by Caro.pdf
There is a well-defined classification s developed originally by Caro.pdffunkybabyindia
 
Write the level of protein structure below each picture. A word bank .pdf
Write the level of protein structure below each picture. A word bank .pdfWrite the level of protein structure below each picture. A word bank .pdf
Write the level of protein structure below each picture. A word bank .pdffunkybabyindia
 
Why should assembly language be avoided for general application deve.pdf
Why should assembly language be avoided for general application deve.pdfWhy should assembly language be avoided for general application deve.pdf
Why should assembly language be avoided for general application deve.pdffunkybabyindia
 
Who was Jesus of Nazareth What was his message How did he convey t.pdf
Who was Jesus of Nazareth What was his message How did he convey t.pdfWho was Jesus of Nazareth What was his message How did he convey t.pdf
Who was Jesus of Nazareth What was his message How did he convey t.pdffunkybabyindia
 
why has America never been a homogenous societywhy has Amer.pdf
why has America never been a homogenous societywhy has Amer.pdfwhy has America never been a homogenous societywhy has Amer.pdf
why has America never been a homogenous societywhy has Amer.pdffunkybabyindia
 
Which of these statements about Java are trueA.( T F ) Using va.pdf
Which of these statements about Java are trueA.( T  F ) Using va.pdfWhich of these statements about Java are trueA.( T  F ) Using va.pdf
Which of these statements about Java are trueA.( T F ) Using va.pdffunkybabyindia
 
When someone suffers from arteriosclerosis, there is a widening of th.pdf
When someone suffers from arteriosclerosis, there is a widening of th.pdfWhen someone suffers from arteriosclerosis, there is a widening of th.pdf
When someone suffers from arteriosclerosis, there is a widening of th.pdffunkybabyindia
 
What is the relationship of Computer System Validation to the Softwa.pdf
What is the relationship of Computer System Validation to the Softwa.pdfWhat is the relationship of Computer System Validation to the Softwa.pdf
What is the relationship of Computer System Validation to the Softwa.pdffunkybabyindia
 

More from funkybabyindia (20)

Part C AssessmentsAs you examined each specific connective tissue,.pdf
Part C AssessmentsAs you examined each specific connective tissue,.pdfPart C AssessmentsAs you examined each specific connective tissue,.pdf
Part C AssessmentsAs you examined each specific connective tissue,.pdf
 
please answer in details12 A communication system consists of 13 a.pdf
please answer in details12 A communication system consists of 13 a.pdfplease answer in details12 A communication system consists of 13 a.pdf
please answer in details12 A communication system consists of 13 a.pdf
 
Name the plant phylum that exhibit the follow characteristics Co.pdf
Name the plant phylum that exhibit the follow characteristics  Co.pdfName the plant phylum that exhibit the follow characteristics  Co.pdf
Name the plant phylum that exhibit the follow characteristics Co.pdf
 
Individuals that express the disease sickle cell anemia are homozygo.pdf
Individuals that express the disease sickle cell anemia are homozygo.pdfIndividuals that express the disease sickle cell anemia are homozygo.pdf
Individuals that express the disease sickle cell anemia are homozygo.pdf
 
Implementing a basic directory-tree structure that is derived from a.pdf
Implementing a basic directory-tree structure that is derived from a.pdfImplementing a basic directory-tree structure that is derived from a.pdf
Implementing a basic directory-tree structure that is derived from a.pdf
 
I need help summarizing a research article!! I need to summarize an .pdf
I need help summarizing a research article!! I need to summarize an .pdfI need help summarizing a research article!! I need to summarize an .pdf
I need help summarizing a research article!! I need to summarize an .pdf
 
For the pedigree on the right, individuals affected with the genetic.pdf
For the pedigree on the right, individuals affected with the genetic.pdfFor the pedigree on the right, individuals affected with the genetic.pdf
For the pedigree on the right, individuals affected with the genetic.pdf
 
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdf
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdfHow are the xylem and phloem arranged in a eudicot rootA. the xyl.pdf
How are the xylem and phloem arranged in a eudicot rootA. the xyl.pdf
 
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdf
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdfGraph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdf
Graph 1 Annual growth () of national output 25 20 15 15 10 0 So.pdf
 
Explain why Drosophila are often used as model organisms in the study.pdf
Explain why Drosophila are often used as model organisms in the study.pdfExplain why Drosophila are often used as model organisms in the study.pdf
Explain why Drosophila are often used as model organisms in the study.pdf
 
Examine the two animals in the photographs figure. Use all of the c.pdf
Examine the two animals in the photographs figure. Use all of the c.pdfExamine the two animals in the photographs figure. Use all of the c.pdf
Examine the two animals in the photographs figure. Use all of the c.pdf
 
Assess the types of stakeholders involved in the development process.pdf
Assess the types of stakeholders involved in the development process.pdfAssess the types of stakeholders involved in the development process.pdf
Assess the types of stakeholders involved in the development process.pdf
 
There is a well-defined classification s developed originally by Caro.pdf
There is a well-defined classification s developed originally by Caro.pdfThere is a well-defined classification s developed originally by Caro.pdf
There is a well-defined classification s developed originally by Caro.pdf
 
Write the level of protein structure below each picture. A word bank .pdf
Write the level of protein structure below each picture. A word bank .pdfWrite the level of protein structure below each picture. A word bank .pdf
Write the level of protein structure below each picture. A word bank .pdf
 
Why should assembly language be avoided for general application deve.pdf
Why should assembly language be avoided for general application deve.pdfWhy should assembly language be avoided for general application deve.pdf
Why should assembly language be avoided for general application deve.pdf
 
Who was Jesus of Nazareth What was his message How did he convey t.pdf
Who was Jesus of Nazareth What was his message How did he convey t.pdfWho was Jesus of Nazareth What was his message How did he convey t.pdf
Who was Jesus of Nazareth What was his message How did he convey t.pdf
 
why has America never been a homogenous societywhy has Amer.pdf
why has America never been a homogenous societywhy has Amer.pdfwhy has America never been a homogenous societywhy has Amer.pdf
why has America never been a homogenous societywhy has Amer.pdf
 
Which of these statements about Java are trueA.( T F ) Using va.pdf
Which of these statements about Java are trueA.( T  F ) Using va.pdfWhich of these statements about Java are trueA.( T  F ) Using va.pdf
Which of these statements about Java are trueA.( T F ) Using va.pdf
 
When someone suffers from arteriosclerosis, there is a widening of th.pdf
When someone suffers from arteriosclerosis, there is a widening of th.pdfWhen someone suffers from arteriosclerosis, there is a widening of th.pdf
When someone suffers from arteriosclerosis, there is a widening of th.pdf
 
What is the relationship of Computer System Validation to the Softwa.pdf
What is the relationship of Computer System Validation to the Softwa.pdfWhat is the relationship of Computer System Validation to the Softwa.pdf
What is the relationship of Computer System Validation to the Softwa.pdf
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Recently uploaded (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

I will provide my LinkedList from my last lab.LinkedList.cpp~~~~.pdf

  • 1. I will provide my LinkedList from my last lab. LinkedList.cpp ~~~~~~~~~~~~~~ #include "LinkedList.h" LinkedList::LinkedList() { first = last = NULL; } LinkedList::~LinkedList() { while (first != NULL) { Node *temp; temp = first; first = first->next; free(temp); } last = NULL; } void LinkedList::insertAtBack(int valueToInsert) { Node *temp = (Node *)malloc(sizeof(Node)); temp->val = valueToInsert; temp->next = NULL; if (last == NULL) first = last = temp; else { last->next = temp; last = temp; } } bool LinkedList::removeFromBack() { if (first == NULL)
  • 2. return false; else if (first == last) { free(first); first = last = NULL; } else { Node *temp; temp = first; while (temp->next != last) temp = temp->next; last = temp; temp = temp->next; free(temp); last->next = NULL; } return true; } void LinkedList::print() { Node *temp = first; while (temp != last) { cout << temp->val << " "; temp = temp->next; } if (temp != NULL) cout << temp->val; } bool LinkedList::isEmpty() { if (first == last) return true; return false; }
  • 3. int LinkedList::size() { int count = 0; Node *temp = first; if (temp == NULL) return count; while (temp != last) { count++; temp = temp->next; } return count + 1; } void LinkedList::clear() { while (first != NULL) { Node *temp; temp = first; first = first->next; free(temp); } last = NULL; } /*Exercise2 */ void LinkedList::insertAtFront(int valueToInsert) { Node *temp = (Node *)malloc(sizeof(Node)); temp->val = valueToInsert; if (last == NULL) first = last = temp; else { temp->next = first; first = temp; }
  • 4. } bool LinkedList::removeFromFront() { if (first == NULL) return false; Node *temp = first; first = first->next; free(temp); if (first == NULL) last = NULL; return true; } LinkedList.h ~~~~~~~~~~~ #include "LinkedList.h" LinkedList::LinkedList() { first = last = NULL; } LinkedList::~LinkedList() { while (first != NULL) { Node *temp; temp = first; first = first->next; free(temp); } last = NULL; } void LinkedList::insertAtBack(int valueToInsert) { Node *temp = (Node *)malloc(sizeof(Node)); temp->val = valueToInsert; temp->next = NULL; if (last == NULL)
  • 5. first = last = temp; else { last->next = temp; last = temp; } } bool LinkedList::removeFromBack() { if (first == NULL) return false; else if (first == last) { free(first); first = last = NULL; } else { Node *temp; temp = first; while (temp->next != last) temp = temp->next; last = temp; temp = temp->next; free(temp); last->next = NULL; } return true; } void LinkedList::print() { Node *temp = first; while (temp != last) { cout << temp->val << " "; temp = temp->next;
  • 6. } if (temp != NULL) cout << temp->val; } bool LinkedList::isEmpty() { if (first == last) return true; return false; } int LinkedList::size() { int count = 0; Node *temp = first; if (temp == NULL) return count; while (temp != last) { count++; temp = temp->next; } return count + 1; } void LinkedList::clear() { while (first != NULL) { Node *temp; temp = first; first = first->next; free(temp); } last = NULL; } /*Exercise2 */ void LinkedList::insertAtFront(int valueToInsert)
  • 7. { Node *temp = (Node *)malloc(sizeof(Node)); temp->val = valueToInsert; if (last == NULL) first = last = temp; else { temp->next = first; first = temp; } } bool LinkedList::removeFromFront() { if (first == NULL) return false; Node *temp = first; first = first->next; free(temp); if (first == NULL) last = NULL; return true; } Solution class Exersize1 { //calling functions of server class. public: node* insertAtBack(int); void insert_begin(); void removeFromBack(); void insert_last(); void removeFrom_Position(); void size(); void clear();