Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, Thank you!!! There are tasks: Must be based on the following goose part code: task1: task2: task3: Task 1 (30 points). Complete the

In Java, Thank you!!!

There are tasks:

image text in transcribed

Must be based on the following goose part code:

task1:

image text in transcribed

task2:

image text in transcribed

task3:

image text in transcribed

Task 1 (30 points). Complete the "bubbleSort(float[] a)" method so that it sorts the specified array "a" using the bubble sort algorithm. First, for a certain time limit that you choose (e.g., 15 minutes), try to implement the "bubbleSort(int[] a)" method based only on your understanding of the algorithm. Please understand that, during each pass, bubble sort examines certain pairs of adjacent elements and swaps two such adjacent elements if they are not in order. Once you finish (or after the time limit), compare your implementation with the Java code in the slides. It is fine to use the code (but some slight changes will be needed). Task 2 (30 points). Complete the "selectionSort(float[] a)" method so that it sorts the specified array "a" using the selection sort algorithm. For a certain time limit that you choose (e.g., 15 minutes), try to implement the "selectionSort(float[] a)" method based only on your understanding of the algorithm. Please understand that, during each pass, selection sort finds the largest element within a certain portion in "a" and then swaps that element with the last element within that portion in "a". Once you finish (or after the time limit), compare your implementation with the Java code in the slides. You can use the code from the slides (but some slight changes may be needed). Task 3 (40 points). Complete the "quickSort(float[] a)" method so that it sorts the specified array "a" using the quicksort algorithm. For a certain time limit that you choose (e.g., 15 minutes), try to implement the method based only on your understanding of the algorithm. You can use the code from the slides (but some slight changes may be needed). public static void bubblesort(float [] a) \{ System.out.println(Arrays.tostring(a)); for (int last = a.length - 1; last >=1; last--) \{ // ToD0: add some code here \} System.out.println(Arrays.toString(a)); public static void selectionSort (float[] a) \{ System.out.println(Arrays.toString(a)); for (int last = a.length 1; last >=1; last--) // ToD0: add some code here \} System.out.println(Arrays.toString(a)); public static void quickSort(float [] a) \{ System.out.println(Arrays.toString(a)); for (int index =1; index 1; index++) \{ // TODO: add some code here System.out.println(Arrays.toString(a))

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions