Question: Problem 8 (12 points) Write a method for a Circular Linked List class that calculates the sum of values stored in the list. The class
Problem 8 (12 points) Write a method for a Circular Linked List class that calculates the sum of values stored in the list. The class has two data fields: head(pointing to the first node) and size(specifying how many nodes are stored in the list). The Node class contains a data field called data of type int and next of type Node. The method should handle all special cases (if you think there are any). The method should return zero, if the list is empty. The method should return 81 (12 +56 + 2 +11) for the example below. head 1266 // WRITE YOUR METHOD BELOW
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
