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
What is the way of retrieving information from the Internet?
TEA [102]
We have to search the desired topic on the search box in the homepage
4 0
2 years ago
Read 2 more answers
You work for a company that does network cable installations. Your company has been contracted to pull out the existing CAT 3 wi
kicyunya [14]

Answer:

RJ-11 connector.

Explanation:

RJ-11 (Registered Jack-11) also known as the phone line or modem port is a network cable having twisted wire pairs and a modular jack with two, four or six contacts. It is generally used with telephones and modem.

Hence, the other connector type that can be used with CAT 3 installations is the RJ-11 connector.

5 0
3 years ago
Write down eight points on how modern technology have effected our life ?
luda_lava [24]

Answer:

  1. Made everyday activities easy to do
  2. We have become dependant on mordern technology
  3. We use the internet for everything
  4. Meetings can be done online
  5. food can be ordered and delivered online
  6. Payments can be done using technology
  7. We pay more attention to social media
  8. Meet new people online
3 0
2 years ago
(Exhibit: Production Possibilities Curves 2) Assume that a nation is operating on production possibilities curve CD. Economic gr
Alex

Answer:

b. shift from curve CD to curve EF.

Required Details of the Question:

The image of the curve required to answer the question has been attached.

Explanation:

A production possibilities curve shows various combinations of the amounts of two goods( in this case capital and consumer goods) which can be produced within the given resources and a graphical representation showing all the possible options of output for the two products that can be produced using all factors of production.

Now the growth of an economy is best illustrated in the image by the shift from curve CD to curve EF, this means that as the nation's production capacity increases, its production possibilities curve shift outward showing an increase in production of both goods.

3 0
3 years ago
Please I need help with this !!!! <br> Complete the table given below.
UkoKoshka [18]

Answer:

  • DBMS , function - include concurrency, security, backup and recovery, integrity and data descriptions.
  • Software calculator , category - calculator
  • DTP , function - Creating, editing, saving and printing documents.
8 0
3 years ago
Other questions:
  • John would like to move from the suburbs into the city, but the rent in the city is very high. John has found an apartment he re
    13·1 answer
  • What is the purpose of filters in a data base
    11·1 answer
  • Web pages often have built-in connections, or links, to other documents, graphics, other web pages, or web sites. true or false?
    9·1 answer
  • Which of the following is an example of a federal tax? A. Social Security tax B. Sales tax C. Property tax D. Transaction tax
    8·1 answer
  • Read an integer from keyboard and then print the result of the sum obtained by adding the entered integer to the integer formed
    11·1 answer
  • Where is the thesis statement usually located in research paper?
    6·1 answer
  • Direct Mapped Cache. Memory is byte addressable. Fill in the missing fields based upon the properties of a direct-mapped cache.
    6·1 answer
  • A(n) _______________ is a collection of configuration and security settings that an administrator has created in order to apply
    14·1 answer
  • Select the correct word to complete the sentence.
    8·1 answer
  • An Excel file that contains one or more worksheets
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!