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
Please!! I need help, this is due by tonight!!!
lyudmila [28]

Answer:

sorry if it is too late but I think it is d

Explanation:

4 0
3 years ago
Toshiba Corporation makes computer chips. Toshiba Corporation would be classified as a A. merchandising company. B. manufacturin
solmaris [256]

Answer: Option 'B'

Explanation: They will be referred to as a manufacturing company because of they make the necessary part themselves not buy it from somewhere else.

5 0
3 years ago
A business wants to centralize its administrative tasks. At the same time, it wants the existing systems to manage and sustain t
asambeis [7]

Answer:

personal information management

Explanation:

In other to ensure that required information regarding basic tasks which are required, personal information management helps attain this seamlessly by systematically studying the activities which are being performed in other to or for task such as storing, retrieving, creation. Maintainance and organization of information. With personal information management, tasks are segmented and organized in a tidy and effective manner such that the right, complete and quality information is made available at all times in other to ensure that nothing is missed or lacking.

5 0
3 years ago
Read 2 more answers
Given the following knowledge representation, what is a simple English sentence that it represents? PTRAN agent=John object=John
Sedaia [141]

Answer:

John is from London and is on a plane to London

Explanation:

The is known as a parallel text alignment or parallel translator.

8 0
3 years ago
The first thing you must consider in any type of communication is ______.
Wittaler [7]
As for this problem together with the options as answers presented with it, the most probable and the most likely answer would be C. the purpose of the communication.

The first thing you must consider in any type of communication is the purpose of the communication itself. Determining the purpose behind the communication would, in turn, pave way to determining the other things that is needed to be determined such as the type of communication, the style of communication, the timing of the communication, and so on and so forth.
5 0
3 years ago
Read 2 more answers
Other questions:
  • The source ip address is 164.109.28.3 subnet mask of 255.255.128.0 network address is
    7·1 answer
  • Jacek has just started a new job as a sales clerk, and his first task is to create a new sales invoice. Which Microsoft software
    6·1 answer
  • Which of the following image file formats uses lossy file compression?
    7·1 answer
  • Which of the following would be the most appropriate way to address and greet your teacher, Mr. Joseph Herman, in an email? Hi J
    7·1 answer
  • List 100 social media with functions​
    7·1 answer
  • you are a bank loan officer. carter has to come into your office and applied for a loan for a car.you ran his credit report, and
    7·1 answer
  • CONCEPTO DE ORGANIGRAMA
    15·1 answer
  • When you connect to an Access database, which entities are shown in the Navigator window?
    13·2 answers
  • What component of a change management program includes final testing that the software functions properly
    11·1 answer
  • Which protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!