For each of these problems, assume you have a linked list of integer values and
ID: 3534477 • Letter: F
Question
For each of these problems, assume you have a linked list of integer values and access to the beginning of the list. Each node has value and next instance variables.
a) Write a method sumAll that computes and return the sum of all values in the list. For example, if the original list is: 1 2 3 4 5 this method would return 15.
b) Writing a method called sumAlternate that computes and returns the sum of every other value in the list starting with the first one. For example, if the original list is: 1 2 3 4 5 this method woild return 9.
Explanation / Answer
Please rate with 5 stars :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.