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
The sum of three numbers is 10. The first number minus the second number plus the third is 6. The first minus the third is 2 mor
GenaCL600 [577]
So the answer is 6,0,4.

3 0
3 years ago
Hey therapy was conducted to see how many people ride a bus to school every day. 160 people reported that they ride the bus to s
xeze [42]

Answer:

200 people

Step-by-step explanation:

Let: the number of people who surveyed be: x

Therefore, (160/x) x 100=80%

=> x=(160x100)/80

=>x=16000/80

=>x= 200

Thus, 200 people surveyed.

Mark as brainliest

4 0
3 years ago
Below is a probability distribution for the number of failures in an elementary statistics course. X 0 1 2 3 4 P(X=x) 0.41 0.18
faust18 [17]

Answer:

a) P(X=2)= 0.29

b) P(X<2)= 0.59

c) P(X≤2)= 0.88

d) P(X>2)= 0.12

e) P(X=1 or X=4)= 0.24

f) P(1≤X≤4)= 0.59

Step-by-step explanation:

a) P(X=2)= 1 - P(X=0) - P(X=1) - P(X=3) - P(X=4)= 1-0.41-0.18-0.06-0.06= 0.29

b) P(X<2)= P(X=0) + P(X=1)= 0.41 + 0.18 = 0.59

c) P(X≤2)= P(X=0) + P(X=1) + P(X=2)=0.41+0.18+0.29= 0.88

d) P(X>2)=P(X=3) + P(X=4)=0.06+0.06= 0.12

e) P(X=1 or X=4)=P(X=1 ∪ X=4) = P(X=1) + P(X=4)=0.18+0.06= 0.24

f) P(1≤X≤4)=P(X=1) + P(X=2) + P(X=3) + P(X=4)=0.18+0.29+0.06+0.06= 0.59

3 0
3 years ago
Read 2 more answers
Write the prime factorization of 42. Use exponents when appropriate and order the factors from least to greatest
jeka94
42: 2,3,7
2 x 3 x 7 = 42

4 0
2 years ago
Read 2 more answers
A friend provides 100 pieces of supporting evidence for a mathematical statement. What is the minimum number of counterexamples
seraphim [82]

Answer:

1 true good statement can prove his friend wrong.

Step-by-step explanation:

Answer is 1.

7 0
3 years ago
Other questions:
  • find the dimensions of a rectangle whose width is 4 miles less than its length and whose area is 96 square miles
    9·1 answer
  • You owe 1200 on your credit card which charges 1.5 per month
    11·1 answer
  • Find the area (in square feet) of a trapezoid with height h and bases b1 and b2.
    11·2 answers
  • Lena has some eggs. She uses 3/5 of the eggs to make waffles and scrambled eggs. She uses 2/3 of the eggs she took to make waffl
    5·2 answers
  • Please Help?? Emergency!! I will give extra points and mark you brainiest.
    8·1 answer
  • Sue is upholstering a rectangular ottoman that measures 21 centimeters by 18 centimeters by 15 centimeters. What will be the tot
    11·1 answer
  • Select the correct comparison.
    9·1 answer
  • (PLEASE HELP BRO THIS IS DUE TMR)
    5·1 answer
  • Ben and Landon took turns driving on a 820 mile road trip. Ben averaged 60 miles per hour and Landon averaged 56 miles per hour.
    12·2 answers
  • Kkkkkkkkkk HELPPPP RNNNNNNNN
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!