Question: In this exercise, you will code a modified version of sequential search from the previous example. Here you should implement a method to do sequential

In this exercise, you will code a modified version of sequential search from the previous example.

Here you should implement a method to do sequential search on an ArrayList of doubles and return the index of the search double, or -1 if it isnt found using a while loop.

----------------------

import java.util.ArrayList;

public class ArrayListSearch { public static void main(String[] args) { ArrayList array = new ArrayList(); array.add(4.5); array.add(6.7); array.add(5.0); array.add(2.9); array.add(7.0); System.out.println(search(array, 5.0)); }

public static int search(ArrayList array, double key) { } }

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!