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
Find the simple interest on $8,000 at 4% interest for 2.5 years?
boyakko [2]

Answer:

800

Step-by-step explanation:

6 0
3 years ago
Help me with this questions please. I will give you 15 points.
alexgriva [62]

4) the answer is d

5) the answer is a

6) the answer is b

5 0
4 years ago
What is 2+6*5/8 ? I need help with this math problem , thank you.
vampirchik [111]

Hey.

I hope that you're familiar with P.E.M.D.A.S :)

applying PEMDAS :

2 + 6 × 5 ÷ 8

2 + 30 ÷ 8

32 ÷ 8 = 4

Hence, The required answer is 4

Thanks.

8 0
3 years ago
Read 2 more answers
A 25,000-gallon swimming pool needs to be completely drained for maintenance purposes.
egoroff_w [7]

Answer:

A: 1800h-25,000

B: Yes, he would have time.

Step-by-step explanation:

A:

Lets turn 30 gallons/minute into hours so we can make it easier.

18000h-25000

Then plug in h which is hours. To get your answer

B:

From May 7 at 8:00 a.m. to May 8 at 12 p.m. would be 28 hours.

So we plug in 28 for h and get our answer of 25400 gallons/hour

8 0
3 years ago
Help Pleaseee!! I need help ASAPP
Over [174]

Answer:

<h2><em><u>1.f</u></em><em><u>unction</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>linear</u></em></h2><h3><em><u>2.</u></em><em><u>(</u></em><em><u>not</u></em><em><u> </u></em><em><u>a</u></em><em><u> </u></em><em><u>function</u></em><em><u> </u></em><em><u>and</u></em></h3>

<em><u>3</u></em><em><u>.</u></em><em><u>(</u></em><em><u>function and linear</u></em><em><u>)</u></em>

Step-by-step explanation:

<em><u>please</u></em><em><u> </u></em><em><u>click</u></em><em><u> </u></em><em><u>the</u></em><em><u> </u></em><em><u>heart</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>rate</u></em><em><u> </u></em><em><u>excellent</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>pa</u></em><em><u> </u></em><em><u>brainleist</u></em><em><u> </u></em><em><u>po</u></em><em><u> </u></em><em><u>please</u></em><em><u> </u></em><em><u>☻</u></em><em><u>❤</u></em><em><u>☺️</u></em><em><u>☺️</u></em><em><u>❤</u></em><em><u>☻</u></em><em><u /></em>

4 0
3 years ago
Read 2 more answers
Other questions:
  • Please answer this question correctly for 25 points and brainliest!!
    11·1 answer
  • Ms Wallwill Roll a single number cube. What is the What is the probability she will roll an even number ?
    9·1 answer
  • Solve the problem 12 – (2 × 3)
    5·1 answer
  • Which is not in the form of a ratio​
    13·1 answer
  • Use the Distributive Property to write each expression as an equivalent algebraic expression. –9(–x + 5)
    9·2 answers
  • Linn is making cookies. Each batch of cookies
    9·1 answer
  • So I really need help. you have to set fractions equal to each other and try and find out how many prefer sweaters and whatnot.
    8·1 answer
  • What is the y intercept?​
    13·1 answer
  • A professor has 7 books they are trying to arrange on a shelf. If the professor selects 3 books at a time, how many different ar
    9·1 answer
  • What is the volume of the shape?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!