SlideShare a Scribd company logo
1 of 2
Download to read offline
Use C++
class Node{
public:
Node ( int = 0 ); // constructor with default value for
// info field
int info; // data
Node * next; // pointer to next node in the list
};
and put the constructor in Node.cpp
// Constructor
Node::Node ( int data )
{
info = data;
next = nullptr;
}
Write the following using the Node class.
A function that copies a linked list pointed to by ptr and returns a pointer to the copied list.
Please note: the copied list should be independent of the original list; the original list can be
destroyed and the copy should still remain.
const Node * copy (Node * ptr);
Solution
Need to perform 'Deep copy' here :
const Node * copy (Node * ptr)
{
//Create new list to hold copied items
Node* newNode = new Node;
//Return if empty list
if (ptr->next == 0)
{
return newNode;
}
while(ptr !=NULL)
{
newNode->info = ptr->info;
newNode->next = ptr->next;
ptr = ptr ->next;
}
return newNode;
}

More Related Content

Similar to Use C++class Node{public   Node ( int = 0 );       constru.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.pdffeelinggift
 
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docx
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docxWrite a C++ function that delete nodes in a doubly linkedlist- It shou.docx
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docxnoreendchesterton753
 
I need help completing this C++ code with these requirements.instr.pdf
I need help completing this C++ code with these requirements.instr.pdfI need help completing this C++ code with these requirements.instr.pdf
I need help completing this C++ code with these requirements.instr.pdfeyeonsecuritysystems
 
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
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxBrianGHiNewmanv
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfanwarsadath111
 
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdfAdrianEBJKingr
 
COMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesCOMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesXiao Qin
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdfsudhirchourasia86
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfcallawaycorb73779
 
Write java program using linked list to get integer from user and.docx
 Write java program using linked list to get integer from user and.docx Write java program using linked list to get integer from user and.docx
Write java program using linked list to get integer from user and.docxajoy21
 
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
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfvishalateen
 
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
 
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
 

Similar to Use C++class Node{public   Node ( int = 0 );       constru.pdf (20)

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
 
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docx
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docxWrite a C++ function that delete nodes in a doubly linkedlist- It shou.docx
Write a C++ function that delete nodes in a doubly linkedlist- It shou.docx
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
 
Linked list
Linked listLinked list
Linked list
 
I need help completing this C++ code with these requirements.instr.pdf
I need help completing this C++ code with these requirements.instr.pdfI need help completing this C++ code with these requirements.instr.pdf
I need help completing this C++ code with these requirements.instr.pdf
 
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
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docx
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
 
C Homework Help
C Homework HelpC Homework Help
C Homework Help
 
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
 
COMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesCOMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercises
 
DSA(1).pptx
DSA(1).pptxDSA(1).pptx
DSA(1).pptx
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdf
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
 
Write java program using linked list to get integer from user and.docx
 Write java program using linked list to get integer from user and.docx Write java program using linked list to get integer from user and.docx
Write java program using linked list to get integer from user and.docx
 
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
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.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
 
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
 

More from optokunal1

Which asymmetric cryptosystem is used for digital signaturesA. DE.pdf
Which asymmetric cryptosystem is used for digital signaturesA. DE.pdfWhich asymmetric cryptosystem is used for digital signaturesA. DE.pdf
Which asymmetric cryptosystem is used for digital signaturesA. DE.pdfoptokunal1
 
Which of these theories fit into the contextual world-viewQuestio.pdf
Which of these theories fit into the contextual world-viewQuestio.pdfWhich of these theories fit into the contextual world-viewQuestio.pdf
Which of these theories fit into the contextual world-viewQuestio.pdfoptokunal1
 
Which of the following distinguishes prophase of meiosis I from proph.pdf
Which of the following distinguishes prophase of meiosis I from proph.pdfWhich of the following distinguishes prophase of meiosis I from proph.pdf
Which of the following distinguishes prophase of meiosis I from proph.pdfoptokunal1
 
What is meant by primary growth What is meant by secondary growth .pdf
What is meant by primary growth  What is meant by secondary growth .pdfWhat is meant by primary growth  What is meant by secondary growth .pdf
What is meant by primary growth What is meant by secondary growth .pdfoptokunal1
 
What to the characteristic X-ray radiation What is the originSo.pdf
What to the characteristic X-ray radiation What is the originSo.pdfWhat to the characteristic X-ray radiation What is the originSo.pdf
What to the characteristic X-ray radiation What is the originSo.pdfoptokunal1
 
What other blood cell related problems are often seen in patients wi.pdf
What other blood cell related problems are often seen in patients wi.pdfWhat other blood cell related problems are often seen in patients wi.pdf
What other blood cell related problems are often seen in patients wi.pdfoptokunal1
 
what is inductive and deductive reasoningSolutionDeductive and.pdf
what is inductive and deductive reasoningSolutionDeductive and.pdfwhat is inductive and deductive reasoningSolutionDeductive and.pdf
what is inductive and deductive reasoningSolutionDeductive and.pdfoptokunal1
 
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdf
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdfWhat are the major evolutionary feats shared by all 3 phyla( Platyhe.pdf
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdfoptokunal1
 
What are some of the advantages in the use of AOA notation as oppose.pdf
What are some of the advantages in the use of AOA notation as oppose.pdfWhat are some of the advantages in the use of AOA notation as oppose.pdf
What are some of the advantages in the use of AOA notation as oppose.pdfoptokunal1
 
Verify the identity.StartFraction sine left parenthesis alpha plus.pdf
Verify the identity.StartFraction sine left parenthesis alpha plus.pdfVerify the identity.StartFraction sine left parenthesis alpha plus.pdf
Verify the identity.StartFraction sine left parenthesis alpha plus.pdfoptokunal1
 
This is a lab for a java program that I am very unsure of, it has to.pdf
This is a lab for a java program that I am very unsure of, it has to.pdfThis is a lab for a java program that I am very unsure of, it has to.pdf
This is a lab for a java program that I am very unsure of, it has to.pdfoptokunal1
 
The concentration of carbon dioxide in the atmosphere today is about .pdf
The concentration of carbon dioxide in the atmosphere today is about .pdfThe concentration of carbon dioxide in the atmosphere today is about .pdf
The concentration of carbon dioxide in the atmosphere today is about .pdfoptokunal1
 
Research and discuss two operating systems and how incident response.pdf
Research and discuss two operating systems and how incident response.pdfResearch and discuss two operating systems and how incident response.pdf
Research and discuss two operating systems and how incident response.pdfoptokunal1
 
Proteins can be attached to a membrane in a variety of ways. How doe.pdf
Proteins can be attached to a membrane in a variety of ways. How doe.pdfProteins can be attached to a membrane in a variety of ways. How doe.pdf
Proteins can be attached to a membrane in a variety of ways. How doe.pdfoptokunal1
 
Problem 1-What is environmental engineering (20 pts) Below you wil.pdf
Problem 1-What is environmental engineering (20 pts) Below you wil.pdfProblem 1-What is environmental engineering (20 pts) Below you wil.pdf
Problem 1-What is environmental engineering (20 pts) Below you wil.pdfoptokunal1
 
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdfNetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdfoptokunal1
 
Mosses and liverworts are early colonizers during ecological success.pdf
Mosses and liverworts are early colonizers during ecological success.pdfMosses and liverworts are early colonizers during ecological success.pdf
Mosses and liverworts are early colonizers during ecological success.pdfoptokunal1
 
Many programming languages, especially older ones, provide no langua.pdf
Many programming languages, especially older ones, provide no langua.pdfMany programming languages, especially older ones, provide no langua.pdf
Many programming languages, especially older ones, provide no langua.pdfoptokunal1
 
Inferior nasal concha Lacrimal bone Mandible Maxilla Nasal bone .pdf
Inferior nasal concha  Lacrimal bone  Mandible  Maxilla  Nasal bone  .pdfInferior nasal concha  Lacrimal bone  Mandible  Maxilla  Nasal bone  .pdf
Inferior nasal concha Lacrimal bone Mandible Maxilla Nasal bone .pdfoptokunal1
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfoptokunal1
 

More from optokunal1 (20)

Which asymmetric cryptosystem is used for digital signaturesA. DE.pdf
Which asymmetric cryptosystem is used for digital signaturesA. DE.pdfWhich asymmetric cryptosystem is used for digital signaturesA. DE.pdf
Which asymmetric cryptosystem is used for digital signaturesA. DE.pdf
 
Which of these theories fit into the contextual world-viewQuestio.pdf
Which of these theories fit into the contextual world-viewQuestio.pdfWhich of these theories fit into the contextual world-viewQuestio.pdf
Which of these theories fit into the contextual world-viewQuestio.pdf
 
Which of the following distinguishes prophase of meiosis I from proph.pdf
Which of the following distinguishes prophase of meiosis I from proph.pdfWhich of the following distinguishes prophase of meiosis I from proph.pdf
Which of the following distinguishes prophase of meiosis I from proph.pdf
 
What is meant by primary growth What is meant by secondary growth .pdf
What is meant by primary growth  What is meant by secondary growth .pdfWhat is meant by primary growth  What is meant by secondary growth .pdf
What is meant by primary growth What is meant by secondary growth .pdf
 
What to the characteristic X-ray radiation What is the originSo.pdf
What to the characteristic X-ray radiation What is the originSo.pdfWhat to the characteristic X-ray radiation What is the originSo.pdf
What to the characteristic X-ray radiation What is the originSo.pdf
 
What other blood cell related problems are often seen in patients wi.pdf
What other blood cell related problems are often seen in patients wi.pdfWhat other blood cell related problems are often seen in patients wi.pdf
What other blood cell related problems are often seen in patients wi.pdf
 
what is inductive and deductive reasoningSolutionDeductive and.pdf
what is inductive and deductive reasoningSolutionDeductive and.pdfwhat is inductive and deductive reasoningSolutionDeductive and.pdf
what is inductive and deductive reasoningSolutionDeductive and.pdf
 
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdf
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdfWhat are the major evolutionary feats shared by all 3 phyla( Platyhe.pdf
What are the major evolutionary feats shared by all 3 phyla( Platyhe.pdf
 
What are some of the advantages in the use of AOA notation as oppose.pdf
What are some of the advantages in the use of AOA notation as oppose.pdfWhat are some of the advantages in the use of AOA notation as oppose.pdf
What are some of the advantages in the use of AOA notation as oppose.pdf
 
Verify the identity.StartFraction sine left parenthesis alpha plus.pdf
Verify the identity.StartFraction sine left parenthesis alpha plus.pdfVerify the identity.StartFraction sine left parenthesis alpha plus.pdf
Verify the identity.StartFraction sine left parenthesis alpha plus.pdf
 
This is a lab for a java program that I am very unsure of, it has to.pdf
This is a lab for a java program that I am very unsure of, it has to.pdfThis is a lab for a java program that I am very unsure of, it has to.pdf
This is a lab for a java program that I am very unsure of, it has to.pdf
 
The concentration of carbon dioxide in the atmosphere today is about .pdf
The concentration of carbon dioxide in the atmosphere today is about .pdfThe concentration of carbon dioxide in the atmosphere today is about .pdf
The concentration of carbon dioxide in the atmosphere today is about .pdf
 
Research and discuss two operating systems and how incident response.pdf
Research and discuss two operating systems and how incident response.pdfResearch and discuss two operating systems and how incident response.pdf
Research and discuss two operating systems and how incident response.pdf
 
Proteins can be attached to a membrane in a variety of ways. How doe.pdf
Proteins can be attached to a membrane in a variety of ways. How doe.pdfProteins can be attached to a membrane in a variety of ways. How doe.pdf
Proteins can be attached to a membrane in a variety of ways. How doe.pdf
 
Problem 1-What is environmental engineering (20 pts) Below you wil.pdf
Problem 1-What is environmental engineering (20 pts) Below you wil.pdfProblem 1-What is environmental engineering (20 pts) Below you wil.pdf
Problem 1-What is environmental engineering (20 pts) Below you wil.pdf
 
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdfNetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
 
Mosses and liverworts are early colonizers during ecological success.pdf
Mosses and liverworts are early colonizers during ecological success.pdfMosses and liverworts are early colonizers during ecological success.pdf
Mosses and liverworts are early colonizers during ecological success.pdf
 
Many programming languages, especially older ones, provide no langua.pdf
Many programming languages, especially older ones, provide no langua.pdfMany programming languages, especially older ones, provide no langua.pdf
Many programming languages, especially older ones, provide no langua.pdf
 
Inferior nasal concha Lacrimal bone Mandible Maxilla Nasal bone .pdf
Inferior nasal concha  Lacrimal bone  Mandible  Maxilla  Nasal bone  .pdfInferior nasal concha  Lacrimal bone  Mandible  Maxilla  Nasal bone  .pdf
Inferior nasal concha Lacrimal bone Mandible Maxilla Nasal bone .pdf
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
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
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
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
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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 🔝✔️✔️
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
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
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 

Use C++class Node{public   Node ( int = 0 );       constru.pdf

  • 1. Use C++ class Node{ public: Node ( int = 0 ); // constructor with default value for // info field int info; // data Node * next; // pointer to next node in the list }; and put the constructor in Node.cpp // Constructor Node::Node ( int data ) { info = data; next = nullptr; } Write the following using the Node class. A function that copies a linked list pointed to by ptr and returns a pointer to the copied list. Please note: the copied list should be independent of the original list; the original list can be destroyed and the copy should still remain. const Node * copy (Node * ptr); Solution Need to perform 'Deep copy' here : const Node * copy (Node * ptr) { //Create new list to hold copied items Node* newNode = new Node; //Return if empty list if (ptr->next == 0) { return newNode; } while(ptr !=NULL) {
  • 2. newNode->info = ptr->info; newNode->next = ptr->next; ptr = ptr ->next; } return newNode; }