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
Damm [24]
3 years ago
12

"3. When we have two sorted lists of numbers in non-descending order, and we need to merge them into one sorted list, we can sim

ply compare the first two elements of the lists, extract the smaller one and attach it to the end of the new list, and repeat until one of the two original lists become empty, then we attach the remaining numbers to the end of the new list and it's done. This takes linear time. Now, try to give an algorithm using O(n log k) time to merge k sorted lists (you can also assume that they contain numbers in non-descending order) into one sorted list, where n is the total number of elements in all the input lists. Use a heap for k-way merging."
Mathematics
1 answer:
iren [92.7K]3 years ago
5 0

Answer:

Since we extract n elements in total, the algorithm for the running time for K sorted list is O (n log k+ k) = O (n log k)

Step-by-step explanation:

To understand better how we arrived at the aforementioned algorithm, we take it step by step

a, Construct a min-heap of the minimum elements from each of "k" lists.

The creation of this min-heap will cost O (k) time.

b) Next we run delete Minimum and move the minimum element to the output array.

Each extraction takes O (log k) time.

c) Then insert into the heap the next element from the list from which the element was extracted.

Now, we note that  since we extract n elements in total, the running time is

O (n log k+ k) = O (n log k).

So we can conclude that :

Since we extract n elements in total, the algorithm for the running time for K sorted list is O (n log k+ k) = O (n log k)

You might be interested in
What is 2+2? I’m not sure how to answer that properly
Alenkinab [10]

Answer:

2+2

2(1+1)

2(2)

2×2

4

Thus, 4 is the answer

8 0
3 years ago
Read 2 more answers
Please answer this please
motikmotik

Answer:

Step-by-step explanation:

6 0
2 years ago
Read 2 more answers
ות
Ulleksa [173]

Answer:

dont use this

Step-by-step explanation:

oinf+euiv=4

7 0
3 years ago
Square root of 192 simplified
Sonja [21]
You must factoring the number 192, you will get 192=2^6*3, so you have square root(2^6*3)=2^(6/2)*root(3) applying enhancing property.
Solve the exponent and you get =2^3*root(3)= 8*root(3)
8 0
3 years ago
2. A local baseball stadium has a total of 2,414 seats, with 221 seats reserved for season ticket holders.
kogti [31]
2414 total seats.......221 reserved.....x = non-reserved.....y = remaining seats

y = 2414 - (x + 221)
y = 2414 - x - 221
y = 2193 - x <=====
5 0
2 years ago
Other questions:
  • A reminder of 1 more in the process of doing synthetic division tells you that you have found a root of the polynomial function
    12·1 answer
  • Which of the following best describes the relationship between the variables on the scatter plot below?
    10·1 answer
  • The answer choices are
    15·1 answer
  • Solve for x 72-12x=32-x
    7·1 answer
  • Angeline made a dish with 5 1/3 cups of pasta. One serving is 0.2 cups. How many servings of pasta were in the dish Angeline mad
    8·1 answer
  • Elizabeth uses 23.25 ounces of granola and 10.5 ounces of raisins for 15 servings of trail mix. If each serving contains the sam
    13·2 answers
  • A test is worth 60 points. Multiple-choice questions are worth 2 points, and
    8·1 answer
  • How do I get the area of a circle?<br>​
    12·2 answers
  • Find the area of a circle with radius, r = 5.64m.
    9·1 answer
  • ?? math-domain and range
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!