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]
2 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]2 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
Why is there a need to compare and align one's PECs of a successful entrepreneur?
gulaghasi [49]
There is a need to compare and align one's PEC to that of a successful entrepreneur because doing so help ensure success in one chosen career. PEC refers to Personal Entrepreneurial Competencies, which are the important characteristics that one has to possess in order to be a successful entrepreneur. 
4 0
2 years ago
Assume that scotus is a two-dimensional character array that stores the family names (last names ) of the nine justices on the S
Orlov [11]

Answer:

scotus[8]

Explanation:

scotus[8] gives the last name because there are 9 elements stored in scotus array

3 0
3 years ago
Select the term below which is a protocol that provides a method for software components to communicate, interact, and share dat
KATRIN_1 [288]

Answer:

B. Application programming interface

Explanation:

An application programming interface (API) is an interface or communication protocol between different parts of a computer program intended to simplify the implementation and maintenance of software. An API may be for a web-based system, operating system, database system, computer hardware, or software library.

8 0
2 years ago
14. Which of the following is NOT likely to be one of the future development gaming industry?
wariber [46]

Answer:

D. All of the above.

Explanation:

Form what I've seen recently, games have a lot of impact on society nowadays, so it wouldn't be a surprise they were going to be pushed to the everyday life system! Just an opinion.

4 0
2 years ago
FREE POINTS JUST ANSWER MY LATEST TWO QUESTIONS PLEASE
Mekhanik [1.2K]

Answer:

Look down below for answer!

Explanation:

1. The internet has backup files and a greater authoritative figure can easily see the history on the photo, etc. Some apps have save files no matter what and can track the post, photo, and when and why it was deleted. The impression the photo left on people may not be left either.

2. The zoo can be breaking the law because even though they store the information safely, they do not have the visitors consent to having their information.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Help asap. 10 points.
    8·2 answers
  • Can someone please help??
    12·1 answer
  • Please answer this a due tomorrow!!!
    5·1 answer
  • Can somebody do an Algorithm 2 for more?<br> (Python)
    15·1 answer
  • Reesa works for a large real estate company. She is responsible for installing and supporting the company's internet systems, in
    5·1 answer
  • Keeping memos on your checks is important because they
    12·1 answer
  • Find the distance between the points.<br><br><br>(5,-2),(-6,-2)
    12·1 answer
  • This unintelligent brain of mine decided to charge my phone overnight thinking that nothing bad will happen ;-; the next morning
    11·1 answer
  • An electronics company develops a line of augmented reality headsets for use in interactive 3d media applications using 5g mmwav
    7·1 answer
  • Identify a characteristic that is a disadvantage of cloud-based hosting.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!