1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natta225 [31]
3 years ago
11

Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an

array of data, convert it to maxheapusing bottom-up algorithm. The expected run time should be O(n), where n is the total number of data. BubbleDown method isNOTprovided, we went over a similar one in class and it’s on class website.swap method is provided and you have to write your own BubbleDown method.2. Complete the efficient quickSort. Choose the medianof three values as the pivot. Switch to insertSort if sub-problem is small. Check with sizes 3, 8, 20, choosesone that gives the best runtimeplease use code below:public class A4Sort{ public static void quickSort(int[] a, int l, int h){ if (l >= h) return; if (/*fill in */) { /*fill in */ } int pivot = partition(a, l, h); quickSort(a, l, pivot - 1); quickSort(a, pivot + 1, h); } public static int partition(int[] a, int l, int h){ int pivot = a[h]; //use last entry int last = h; h--; while (l < h){ while(a[l] < pivot) { l++; } while(a[h] > pivot){ h--; } if (l < h) swap(/*fill in */); else swap(/*fill in */); } return l; } public static void insertionSort(int[] a, int l, int h){ for (int i = /*fill in */; i++){ int j = i; int v = a[i]; while (j > 0 && v < a[j - 1]){ a[j] = a[j - 1]; j--; } a[j] = v; } } public static void swap(int[] a, int i, int j){ int temp = a[i]; a[i] = a[j]; a[j] = temp; } public static void heapSort(int[] a, int l, int h){ heapify(a); //maxheap } public static void heapify(int[] a){ /*fill in */ } public static void bubbleDown(int[] a, int i, int size){ /*fill in */ } public static void main(String[] args){ int[] a = new int[]{3,19,12,7,15,1,16,4,18,9,13,2,17,5,10,11,14,6,8,20}; int[] b = new int[]{3,19,12,7,15,1,16,4,18,9,13,2,17,5,10,11,14,6,8,20}; long time, nextTime; System.out.println("quickSort: "); time = System.nanoTime(); quickSort(a, 0, a.length - 1); nextTime = System.nanoTime(); System.out.println("\tTime used: " + (nextTime - time) + " nseconds"); for (int i = 0; i < a.length; i++) System.out.print(a[i] + ","); System.out.println(); System.out.println("heapSort: "); heapSort(b, 0, b.length - 1); for (int i = 0; i < b.length; i++) System.out.print(b[i] + ","); System.out.println(); }}
Computers and Technology
1 answer:
Sladkaya [172]3 years ago
3 0

Answer:

Yes

Explanation:

Because you send it to the java file and the java file is only one single (1)

You might be interested in
A file system which used tables to store data is called ?
ira [324]

Answer:

The filesystem table is an array of entries that describe each filesystem implementation that is part of the system image. ... The data field contains any private data that the filesystem needs, perhaps the root of its data structures

5 0
3 years ago
Read 2 more answers
N Excel, a number can contain the characters ____.
VashaNatasha [74]
Do you have answer choices?
7 0
3 years ago
How do you see everyone on a schoology conference
Vikentia [17]
I don’t think you can
6 0
2 years ago
What difficulties would a user face when using a computer without an operating system
attashe74 [19]

Answer:

The user would not be able to access programs easily and would not be able to connect to internet and perform necessary tasks

Explanation:

7 0
2 years ago
The goal of _______ is to identify and fix as many errors as possible before units are combined into larger software units.
Archy [21]

The goal of <u>unit testing</u>  is to identify and fix as many errors as possible before units are combined into larger software units.

<h3>What are the types of integration testing?</h3>

Some different types of integration testing are big-bang, mixed (sandwich), risky-hardest, top-down, and bottom-up. Other Integration Patterns are: collaboration integration, backbone integration, layer integration, client-server integration, distributed services integration and high-frequency integration.

<h3>Which is integration testing?</h3>

Unit and System testing are various testing levels where the Unit testing is used to test each unit or an individual component of the software application. The integration testing is used only after the functional testing is completed on each module of the application.

To learn more about integration , refer

brainly.com/question/27015819

#SPJ4

6 0
1 year ago
Other questions:
  • Which behaviors might lead someone to have a low credit score?
    13·1 answer
  • Osha requires employers pay for most required personal protective equipment including
    11·1 answer
  • Which of the following is 1000 of a second​
    15·1 answer
  • Framing can create which of the following in a photograph? Mystery Saturation Aperture All of the above
    10·2 answers
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • What do developers do to support software products?
    5·2 answers
  • What are the programs in a computer​
    8·1 answer
  • Wow that funny a heck
    7·1 answer
  • Colorful bead bracelet in codehs
    14·1 answer
  • Steps for Saving and opening a document.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!