Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: The goal of this assignment is to practice recursion Assignment: The assignment requires writing recursive methods for some linked list operations. The use of

image text in transcribedimage text in transcribedimage text in transcribed

Objective: The goal of this assignment is to practice recursion Assignment: The assignment requires writing recursive methods for some linked list operations. The use of loops is strictly prohibited in this assignment. That is, you cannot use for, while, and do-while in the recursive methods you will write. The only time you can use a loop is when you initiate values for a linked list in the main method. Consider that you are given he following linked list node. public class MyListofInts public int firstInt: public MyListofInts restofTheInts; public MyListofints (int f) i firstint-f public MyListofInts (int f, MyListofInts r) firstint-f restofTheInts-r Clearly, this class can be used to create a linked list. Write a class named Listoperations that will contain the following methods l. write a recursive method named printMyList(MyListof Ints m) to print all the 2. Write a recursive method named sumOfMyList (MyListofInts m) that will sum 3. Write a recursive method named maxOfMyList (MyListofInts m) that will return 4. Write a recursive method named lengthofMyList (MyListofInts m) that will 5. Write a recursive method named reverseMyist (MyListofInts m) to reverse integers in the linked list M. Notice that M is the head of the linked list. up all the integers in the linked list M and return the summation value the largest number in a linked list compute and return the length of a given linked list M. a linked list. Return the head of the reversed linked list. A template for the Listoperations program is given below. You need to write your codes inside the body of the methods. Modify the main method for testing purpose, as necessary Objective: The goal of this assignment is to practice recursion Assignment: The assignment requires writing recursive methods for some linked list operations. The use of loops is strictly prohibited in this assignment. That is, you cannot use for, while, and do-while in the recursive methods you will write. The only time you can use a loop is when you initiate values for a linked list in the main method. Consider that you are given he following linked list node. public class MyListofInts public int firstInt: public MyListofInts restofTheInts; public MyListofints (int f) i firstint-f public MyListofInts (int f, MyListofInts r) firstint-f restofTheInts-r Clearly, this class can be used to create a linked list. Write a class named Listoperations that will contain the following methods l. write a recursive method named printMyList(MyListof Ints m) to print all the 2. Write a recursive method named sumOfMyList (MyListofInts m) that will sum 3. Write a recursive method named maxOfMyList (MyListofInts m) that will return 4. Write a recursive method named lengthofMyList (MyListofInts m) that will 5. Write a recursive method named reverseMyist (MyListofInts m) to reverse integers in the linked list M. Notice that M is the head of the linked list. up all the integers in the linked list M and return the summation value the largest number in a linked list compute and return the length of a given linked list M. a linked list. Return the head of the reversed linked list. A template for the Listoperations program is given below. You need to write your codes inside the body of the methods. Modify the main method for testing purpose, as necessary

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

More Books

Students also viewed these Databases questions

Question

Describe six kinds of informal reports.

Answered: 1 week ago