Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

20. You must assign the grades for a programming class. Right now the class is studying recursion, and students have been given this simple assignment:

image text in transcribed
image text in transcribed
20. You must assign the grades for a programming class. Right now the class is studying recursion, and students have been given this simple assignment: Write a recursive method sumSquares that takes a reference to a linked list of Inte ger elements and returns the sum of the squares of the elements. The list nodes are of class LLNode. The objects in the list are all of class Integer. Example: ist5 sumSquares (11st) yields (5 . 5) + (2 2) + (3 3) + (11) = 39 Assume that the list is not empty. You have received quite a variety of solutions. Grade the methods below, marking errors where you see them. a. int sumSquares (LLNodeKInteger> 1ist) return 0 if (list !- nul1) return (list.getInfo) list.getInfo) + sumSquares(list.getLink ())): b. int sumsSquares (LLNode list) int sum = 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

Students also viewed these Databases questions