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
A 12 inch line segment is divided into two parts. Which of the following lengths result in a ratio closest to the golden ratio,
Marta_Voda [28]

Answer:

2:4

Step-by-step explanation:

I remember doing this is my class

8 0
1 year ago
RCX)=2VX SCx) = x(RSX4=
aev [14]

Given the two functions:

\begin{gathered} R(x)=2\sqrt[]{x} \\ S(x)=\sqrt[]{x} \end{gathered}

We need to find (RoS)(4). THis is the functional composition. We take S(x) and put it into R(x) and then put "4" into that composed function. Shown below is the process:

(RoS)(x)=2\sqrt[]{\sqrt[]{x}}

When we plug in "4", into "x", we have:

\begin{gathered} (RoS)(x)=2\sqrt[]{\sqrt[]{x}} \\ (RoS)(4)=2\sqrt[]{\sqrt[]{4}} \\ =2\sqrt[]{2} \end{gathered}

3 0
1 year ago
BRAINIEST ANSWER <br> FIND THE VOLUME AND ROUND TO THE NEAREST TENTH :))) <br> Please help
kolezko [41]

Answer: 3,150 ft.

Step-by-step explanation: multiply all sides together

3 0
3 years ago
Michael and Lindsey are saving money. Michael begins with $20 and saves $5 per week. Lindsey begins with no money, but saves $10
True [87]
Let
x----------> number of weeks
y----------> saved money

we now that

<span>Michael begins with $20 and saves $5 per week
so
y=20+5x------> equation 1

and
</span><span>Lindsey begins with no money, but saves $10 per week
</span><span>y=10x-------> equation 2

</span><span>the number of weeks it will take for Lindsey and Michael to save the same amount of money is when equation 1 is equals to equation 2
</span>
therefore
20+5x=10x------> 10x-5x=20------> 5x=20-----> x=20/5-----> x=4 weeks

the answer is 
4 weeks
3 0
2 years ago
Which is equivalent to (3 + 2i)(3 + 2i)
Olegator [25]
(3+2i) squared I think
4 0
3 years ago
Other questions:
  • 3 (p+9q-2+9) +14p<br> Simplify
    6·1 answer
  • FIRST GETS BRAINLLEST If each 12 feet on the scale drawing below equals 3 cm, what is the actual length of the green line?
    11·2 answers
  • This type of medicine is still practiced today.
    6·1 answer
  • Please help i need<br> help
    13·1 answer
  • The owner of a dress shop ordered 33 dresses from a new designer. The designer's dresses now make up to 30% of all dresses in th
    8·1 answer
  • −|9| = −9 True or False
    5·2 answers
  • All the ice cream sold has exactly one flavor and one treat. If a chocolate ice cream is picked at random, what is the probabili
    6·1 answer
  • Is 36.81 more than 36 or it is close to 37 than 36?
    14·1 answer
  • 3, 12, 48, 192<br> 9th term:<br> 11th term:<br> What is the 11th term plz help
    6·1 answer
  • 4. A publisher wants to figure out how thick their new book will be. The book has a front
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!