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 is the first thing Kernel does when WinLoad turns over the starttup process to it
SashulF [63]

It activates HAL, reads more information from the registry, and builds into memory the registry key

4 0
3 years ago
The Linux operating system is widely used in industry, especially for servers. Why do you believe this is the case?
Anit [1.1K]

Answer:

Asking why Linux is used as a server operating system? It has many advantages

Explanation:

1. Linux has very small kernel footprints

It can be on a USB, embedded system and the like.

2. Requires very little hardware resource to run.

Building on the first point, Linux dos not need much jard ware resource to run implying it can be run on outdated CPUs, a low RAM size, small disk space and it would be possible - doesn't matter with Linux - bar the effect on performance.

3. Linux runs 80% of the Internet today

4. It's free

...... and so much more.

- Reference: Andrew Holcomb, Quorate

How Linux compares with other OS - like Windows or Mac?

May Help:

https://www.quora.com/What-are-the-advantages-of-Linux-as-a-server-operating-system

Recommendation: Jason Montoya and Glen Becker, BI Analyst, SAS Expert

6 0
3 years ago
Halp Computer Science
AleksandrR [38]

1st one: is memory

2nd one: is 8

8 0
3 years ago
Read 2 more answers
A married man gets a new job in a company. After three months, he meets a younger woman in the finance department and they begin
pav-90 [236]

Answer:

False ( B )

Explanation:

Of  the seven IT  infrastructure domains The USER domain was not at risk because the User Domain is not task with handling the sharing of data or Mutual communication between users in a Typical IT infrastructure.

The domain charged with such responsibility is The LAN domain because the LAN domain is charged with the sharing of information between the USERS and maintaining good mutual communication, and since the relationship has become sour, the sharing of information between the users will suffer the most and it will be at a high risk

5 0
3 years ago
When delivering digital technologies to clients, what is a best practice to make those solutions sustainable?
lidiya [134]

When delivering digital technologies to clients, a best practice is to: Recommend the client spread out their data centers to distribute energy usage globally.

<h3>What is a computational sustainability?</h3>

Computational sustainability can be defined as a process through which societal, economic, ecological and environmental resources are balanced through the use of various mathematical and computational techniques.

<h3>The importance of computational sustainability</h3>

Generally, computational sustainability helps to produce sufficient amount of energy for the world to globally distribute and support its biological systems.

In order to achieve computational sustainability, it is essential to practice the following:

  • Ensure that software applications are widespread.
  • Clients should spread out their data centers.

In conclusion, a best practice for delivering digital technologies to clients is to recommend a spread out of data centers to distribute energy usage globally.

Read more on computational sustainability here: brainly.com/question/24882256

6 0
2 years ago
Other questions:
  • Which logic gate produces an output of 1 only if both it’s inputs are 0?
    10·2 answers
  • A network engineer arrives at work and discovers that many users are having problems when attempting to connect to the company n
    9·2 answers
  • The distance at which wi-fi signals can travel ranges typically between ____ and ____.
    15·1 answer
  • While ________ is centered on creating procedures, ________ is centered on creating objects. Procedural programming, class progr
    10·1 answer
  • The internal area of 2-inch IMC is
    15·2 answers
  • Create a program asks a user for an odd positive integer. If the user gives and even number or a number that is negative it prom
    7·1 answer
  • On what basis can you categorize the generations of computers?
    11·1 answer
  • Ashton assigned a string value to a variable. Which program statement should he use?
    7·1 answer
  • Which of these is a way of making applications less vulnerable to hacking?
    7·2 answers
  • Mark just finished reading the cay and must write a book report comparing events in the book to events in his life. based on eac
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!