Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method called removeInRange that accepts four parameters: a LinkedList, an element value, a starting index, and an ending index. Its behavior is to

  1. Write a method called removeInRange that accepts four parameters: a LinkedList, an element value, a starting index, and an ending index. Its behavior is to remove all occurrences of the given element that appear in the list between the starting index (inclusive) and the ending index (exclusive). Other values and occurrences of the given value that appear outside the given index range are not affected.

For example, with the list (0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 10, 0, 12, 0, 14, 0, 16), a call of removeInRange(list, 0, 5, 13) should produce the list (0,0, 2, 0, 4, 6, 8, 10, 12, 0, 14, 0, 16). Notice that the zeroes whose indexes were between 5 inclusive and 13 exclusive in the original list (before any modifications were made) are removed. Use the list given here to test your program

What I have:

image text in transcribed

I am not sure what I am doing wrong any guidance would be great. Thank you in advance

T: a * * A Outline X 619 9 Question2 removeInRange(List, int, int, int) : void # Package Explorer X RemoveRange > JRE System Library [JavaSE-15] src X (default package) Question2.java Question2 removeInRange(List, int, int, int) : void Question2.java X 1 2 public class Question2 { 3 40 public void remove InRange(List list, int value, int start, int end) { for (int i=start; i

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

Students also viewed these Databases questions

Question

What is the includes relationship used for?

Answered: 1 week ago