Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need some help doing this Java project. 1.Implement the MySort class with the following operations. a.bubbleSort(MyArrayList arraylist) conduct bubble sort on the elements contained

I need some help doing this Java project.

1.Implement the MySort class with the following operations.

a.bubbleSort(MyArrayList arraylist) conduct bubble sort on the elements contained in a MyArrayList object.

b.selectionSort(MyArrayList arraylist) conduct selection sort on the elements contained in a MyArrayList object.

2.Implement the MySearch class with the following operations.

a.binarySearch(MyArrayList arraylist, Comparable target) conduct binary search on sorted elements contained in a MyArrayList object.

b.linearSearchSorted (MyArrayList arraylist, Comparable target) conduct linear search on sorted elements contained in a MyArrayList object.

3.Both the MySearch and MySort classes should be created in the collection package.

4.After implementing the MySearch and MySort classes you will test them. To test the MySearch and MySort classes you will create a Lab3 class under the lab package.

5.In the Lab3 class you will create an static void test() method. In this test method you will do the following:

a.Create a numArraylist of MyArrayList type.

b.Generate a sequence of 800 integer numbers in the range [100, 999] using java.util.Random with current system time as the random seed (use java.lang.System.nanoTime()). Insert this sequence of numbers into numArraylistone by one when it is being generated.

c.Sort numArraylist using bubbleSort.

d.Print out numArraylist onto the screen.

e.Prompt user to type in a number through keyboard.

f.Search that number using linearSearchSorted, and print out the returned value onto screen.

g.Call numArraylist.removeRange(50, 650).

h.Then call numArraylist.reverse().

i.Sort numArraylist using selectionSort.

j.Print out numArraylist onto the screen.

k.Prompt user to type in a number through keyboard.

l.Search that number using binarySearch, and print out the returned value onto screen.

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions