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
Martin uses his power saw every 15 seconds.How many times did he use it in one hour ?​
Alina [70]

Answer:

  1. 60<em><u>÷</u></em><em><u>15</u></em><em><u> </u></em><em><u>=</u></em><em><u>4</u></em><em><u> </u></em>

<em><u>Therefore</u></em><em><u> </u></em><em><u>Martin</u></em><em><u> </u></em><em><u>uses</u></em><em><u> </u></em><em><u>his</u></em><em><u> </u></em><em><u>power</u></em><em><u> </u></em><em><u>saw</u></em><em><u> </u></em><em><u>4</u></em><em><u> </u></em><em><u>times</u></em><em><u> </u></em><em><u>in</u></em><em><u> </u></em><em><u>one</u></em><em><u> </u></em><em><u>hour</u></em><em><u> </u></em>

7 0
3 years ago
Read 2 more answers
Doctor florens needs 25 g of salt for each student to do an experiment she has 1.2 kg of salt on hand she has a total of a 128 s
erik [133]
The first thing I would do is convert that 1.2 kilograms of salt to grams; that would ensure that all the units are the same so we can perform calculations on them.

1.2kg = 1200g


Next, I would find out how many students can do the experiment with 1200g of salt, by finding it how many 25g are in 1200g (by dividing them).

\frac{1200g}{25g}=48students


That means we still have 80 students left to provide salt for (128 - 48).
Therefore, he needs an additional 80 amounts of 25g of salt.

Therefore he needs:
80students*25g = 2000g = 2kg
5 0
4 years ago
I need help it’s for a very hard test
Mumz [18]

Answer:

C

Step-by-step explanation

This has a factor of 6% or 0.06. But, you are adding and not subtracting so it is 1.06. ( If you multiply by a number less than 1 then it is actually dividing) So C is the only on that is correct.

6 0
3 years ago
Paul purchased 3 video games for $17.25 each. Which expression is the best choice to help him determine the total amount of mone
mr_godi [17]

Answer:

The answer is C or (3) × (17.25) = 51.75; He spent $51.75.

Step-by-step explanation:

i say this because 17.25 time 3 equal 51.75

6 0
3 years ago
Solve this system of linear equations.separate the x- and y-value with a comma. -6x=-4-y -7x=-22+y.
scZoUnD [109]

Answer:

(2,8)

Step-by-step explanation:

Add them together to get rid of the y.

-6x = -4 - y

-7x = -22 + y

=

-13x = -26

Then solve for x.

-13x/-13 = -26/-13

x = 2

Now plug in the x value into either equation and solve for y.

-7(2) = -22 + y

-14 = -22 + y

-14 + 22 = -22 + 22 + y

8 = y

So...

x = 2

y = 8

(2,8)

8 0
3 years ago
Read 2 more answers
Other questions:
  • Kari thinks, "x is the difference between 87 and 34.25 is this true or not?
    8·1 answer
  • How do I combine like terms for 5y-8-y
    7·2 answers
  • 2. If m &lt;1 = 43, what is m &lt;4?
    10·1 answer
  • How would you determine the distance between (6,8) and (2,-3)
    7·1 answer
  • The Hendersons have just bought a home that requires some monthly yard maintenance. They are trying to decide if they should hir
    5·2 answers
  • RULE OF FOUR: Multiple Representations of Math
    11·1 answer
  • An aircraft is cruising at 720 km/h and covered 1000 km. How far would it travel in the same period of time is the speed increas
    12·1 answer
  • In the United States, voters who are neither Democrat nor Republican are called Independent. It is believed that 11% of voters a
    6·1 answer
  • Kevin used to run a mile in 9.4
    9·1 answer
  • If a1=<br> 1 and an=<br> (an-1)^2 + 2 then find the value of a4
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!