Question: PLEASE USE JAVA PLEASE ANSWER A,B,C,D,E 20. You must assign the grades for a programming class. Right now the class is studying recursion, and students

 PLEASE USE JAVA PLEASE ANSWER A,B,C,D,E 20. You must assign thegrades for a programming class. Right now the class is studying recursion,

PLEASE USE JAVA

PLEASE ANSWER A,B,C,D,E

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 s unfquares 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 I nt eger. Example: list 5 sumsquares(list) yields (5 * 5)+(2 *2)+ 3 *3)+ (1 *1)= 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 sunquares (LLNo de Integer> list) { return 0; if (list != null) return (list.getInfo() * list.getInfo() + sumf quares(list. get Link())); } b. int sunf quares (LLNo de Integer> list) { int sum = 0; www.ebook777.com Chapter 4: Recursion while (list != null) { sum = list get Info() + sum, list = list. get Link(); } return sun } c. int sunf quares (LLNode list) { if (list == null) return 0; else return list.getInfo() * list.getInfo() + sunf quares (list. get Link()); } d int sunsquares (LLNode list) { if (list. get Li nk() == null) return list.getInfo() * list.getInfo(); else return list.getInfo() * list.getInfo() + sunf quares (list. get Link()); } e. int sumfquares (LLNode list) { if (list == null) return 0; else return (sunfquares (list. get Link()) * sunf quares (list. get Link()))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!