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
What command enables you to initialize quotas on a file system?
jeka57 [31]
 Quotas can be enabled by mounting a partition with the usrquota (and optionally the grpquota) mount option(s).Normally this is done by editing /etc/fstab and adding usrquota to the mount options part of the entry for some filesystem.Then that <span>filesystem must be remounted ("mount -o remount filesystem").</span>
4 0
3 years ago
The force of impact is____.
sattari [20]
A.the speed which can comer a curve
8 0
3 years ago
Read 2 more answers
What is used in an ipv6 for local device to learn the layer 2 ethernet address of a device that is on a remote nonlocal vlan?
zavuch27 [327]
The devices in IPv6 only need to learn the Layer 2 Ethernet address of a neighbor that is directly connected, and only if they need to communicate with each other on that local network. If the device you are trying to connect to is remote, you will forward the packet to your default gateway’s Layer 2 address.
NDP (Neighbor Discovery Protocol) is used to learn local neighbors’ Layer 2 Ethernet addresses when needed.
ARP is an IPv4 method to learn a local device’s Layer 2 address.
The RIPng (RIP next generation) is RIP version that support of IPv6 networking..
3 0
3 years ago
Which of these devices can completely stop broadcasts from being passed on across the network? routerswitchaccess ponthub
cestrela7 [59]

Answer

An Access point can completely stop broadcasts from being passed on across the network.

Explanation.

An Access point is a hardware type that is part of local area network which has capability of allowing wireless communication from devices through a wireless stand,which connects in between devices and the network. A good example of these devices are routers that allows wireless devices to connect to a wireless network.So when it is passed on across a network an Access point can completely stop.

8 0
3 years ago
Read 2 more answers
What is known as networking in the IT field?
Sidana [21]

Answer:

r u Kate tell me plz I love u baby tell me please

4 0
3 years ago
Other questions:
  • In the 2000s, Venezuelan President Hugo Chàvez instituted economic policies that caused smuggling and hoarding of food. What did
    15·1 answer
  • Write a program that will calculate the following function:
    14·1 answer
  • Software that people commonly use in the workplace to make their lives easier is called
    15·1 answer
  • What does nat stand for? network access trigger network administration timetable network address translation network association
    13·1 answer
  • Witch word in the sentence is a noun? the food he is cooking smells delicious.
    7·1 answer
  • Under what category of programs and apps do screen savers and backup programs fall?
    10·1 answer
  • Microsoft presentation software tool is called
    10·2 answers
  • ____ a British mathematician devolved the concept of a programmable digital computer and worked with Ada Lovelace to design the
    13·1 answer
  • Let f(w) = 2w^3 - 5. Let z = 2. What is f(z)?​
    6·1 answer
  • A___ is a placeholder where you can enter text to manipulate and give new graphical effects.​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!