SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
2. Assume the following ListNode class. class ListNode I public: int data; listNode* next; 1 .
Write a function that will return the sum of the data in all the nodes of the linked list. Make sure
you cover also special cases like an empty list. [8 points] class Linkedlist { private: ListNode*
head; public: I/ assume that the list class has the Rule-of-3 and the following function
implemented: void push_front(int x){} // add your member function with the code that will
return the sum of the data of all the nodes in the list:

Weitere ähnliche Inhalte

Mehr von info639484

25. It is hypothesized that Californian populations of Sea Otters a..pdf
 25. It is hypothesized that Californian populations of Sea Otters a..pdf 25. It is hypothesized that Californian populations of Sea Otters a..pdf
25. It is hypothesized that Californian populations of Sea Otters a..pdf
info639484
 
2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
 2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf 2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
info639484
 

Mehr von info639484 (20)

25) The Aircraft maintenance Costs are considered a major operating c.pdf
 25) The Aircraft maintenance Costs are considered a major operating c.pdf 25) The Aircraft maintenance Costs are considered a major operating c.pdf
25) The Aircraft maintenance Costs are considered a major operating c.pdf
 
25. It is hypothesized that Californian populations of Sea Otters a..pdf
 25. It is hypothesized that Californian populations of Sea Otters a..pdf 25. It is hypothesized that Californian populations of Sea Otters a..pdf
25. It is hypothesized that Californian populations of Sea Otters a..pdf
 
24. Country A�s adult population is 100 million, and it is likely t.pdf
 24. Country A�s adult population is 100 million, and it is likely t.pdf 24. Country A�s adult population is 100 million, and it is likely t.pdf
24. Country A�s adult population is 100 million, and it is likely t.pdf
 
2.4 Ethernet was originally developed to support a shared media envir.pdf
 2.4 Ethernet was originally developed to support a shared media envir.pdf 2.4 Ethernet was originally developed to support a shared media envir.pdf
2.4 Ethernet was originally developed to support a shared media envir.pdf
 
2.6. (a) Find the frequency response H(ej) of the linear time-invaria.pdf
 2.6. (a) Find the frequency response H(ej) of the linear time-invaria.pdf 2.6. (a) Find the frequency response H(ej) of the linear time-invaria.pdf
2.6. (a) Find the frequency response H(ej) of the linear time-invaria.pdf
 
2.Cases. Soulful Sounds Records inc. iby Ales Fither. aipecti ef t.pdf
 2.Cases. Soulful Sounds Records inc. iby Ales Fither. aipecti ef t.pdf 2.Cases. Soulful Sounds Records inc. iby Ales Fither. aipecti ef t.pdf
2.Cases. Soulful Sounds Records inc. iby Ales Fither. aipecti ef t.pdf
 
20. If the process of completing business requirements is difficult i.pdf
 20. If the process of completing business requirements is difficult i.pdf 20. If the process of completing business requirements is difficult i.pdf
20. If the process of completing business requirements is difficult i.pdf
 
2.2 A Network Topology is the arrangement with which computer systems.pdf
 2.2 A Network Topology is the arrangement with which computer systems.pdf 2.2 A Network Topology is the arrangement with which computer systems.pdf
2.2 A Network Topology is the arrangement with which computer systems.pdf
 
2.3 Decapsulation is the inverse of the encapsulation process. Encaps.pdf
 2.3 Decapsulation is the inverse of the encapsulation process. Encaps.pdf 2.3 Decapsulation is the inverse of the encapsulation process. Encaps.pdf
2.3 Decapsulation is the inverse of the encapsulation process. Encaps.pdf
 
2. What colour will methylene blue turn in the presence of carbon dio.pdf
 2. What colour will methylene blue turn in the presence of carbon dio.pdf 2. What colour will methylene blue turn in the presence of carbon dio.pdf
2. What colour will methylene blue turn in the presence of carbon dio.pdf
 
2. What age, on average, did people with tic disorders first start no.pdf
 2. What age, on average, did people with tic disorders first start no.pdf 2. What age, on average, did people with tic disorders first start no.pdf
2. What age, on average, did people with tic disorders first start no.pdf
 
2. True or false Given a sample size n=14, the degrees of freedom is.pdf
 2. True or false Given a sample size n=14, the degrees of freedom is.pdf 2. True or false Given a sample size n=14, the degrees of freedom is.pdf
2. True or false Given a sample size n=14, the degrees of freedom is.pdf
 
2. The standard normal distribution is the normal random variable X s.pdf
 2. The standard normal distribution is the normal random variable X s.pdf 2. The standard normal distribution is the normal random variable X s.pdf
2. The standard normal distribution is the normal random variable X s.pdf
 
2. The figure below depicts three metapopulation patterns. The size o.pdf
 2. The figure below depicts three metapopulation patterns. The size o.pdf 2. The figure below depicts three metapopulation patterns. The size o.pdf
2. The figure below depicts three metapopulation patterns. The size o.pdf
 
2. Movie Profit Modify the Movie Data program written for problem.pdf
 2. Movie Profit Modify the Movie Data program written for problem.pdf 2. Movie Profit Modify the Movie Data program written for problem.pdf
2. Movie Profit Modify the Movie Data program written for problem.pdf
 
2. Saving and investment in the national income accounts The foliowin.pdf
 2. Saving and investment in the national income accounts The foliowin.pdf 2. Saving and investment in the national income accounts The foliowin.pdf
2. Saving and investment in the national income accounts The foliowin.pdf
 
2. Let X1 be a binomial distributed rv with parameters n1 and p1, and.pdf
 2. Let X1 be a binomial distributed rv with parameters n1 and p1, and.pdf 2. Let X1 be a binomial distributed rv with parameters n1 and p1, and.pdf
2. Let X1 be a binomial distributed rv with parameters n1 and p1, and.pdf
 
2. Label the diagrams Explain in detali electron transportchemiosmos.pdf
 2. Label the diagrams Explain in detali electron transportchemiosmos.pdf 2. Label the diagrams Explain in detali electron transportchemiosmos.pdf
2. Label the diagrams Explain in detali electron transportchemiosmos.pdf
 
2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
 2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf 2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
2. Evolutonary theory predicts that orgunisms should apgear in a secp.pdf
 
2. Biodiversity Theme 2 Metabolic Diversity - What are the different.pdf
 2. Biodiversity Theme 2 Metabolic Diversity - What are the different.pdf 2. Biodiversity Theme 2 Metabolic Diversity - What are the different.pdf
2. Biodiversity Theme 2 Metabolic Diversity - What are the different.pdf
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

2. Assume the following ListNode class. class ListNode I public int .pdf

  • 1. 2. Assume the following ListNode class. class ListNode I public: int data; listNode* next; 1 . Write a function that will return the sum of the data in all the nodes of the linked list. Make sure you cover also special cases like an empty list. [8 points] class Linkedlist { private: ListNode* head; public: I/ assume that the list class has the Rule-of-3 and the following function implemented: void push_front(int x){} // add your member function with the code that will return the sum of the data of all the nodes in the list: