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
Pleaseee tell me if im right!! I already solved and my answer is 84 square units, but im not sure.. pleaseee help me
yawa3891 [41]

Answer:

84

Step-by-step explanation:

12*5=60

4*6=24

60+24=84

8 0
2 years ago
Read 2 more answers
What is , 12-1x0+4÷2???
kolbaska11 [484]
2 is the answer because if you subtract 12 to 1 it will be 11 and time by 0 and it will be 0 add by 4 and divide it by 2 and it will be 2.

8 0
3 years ago
Read 2 more answers
If CDE ~ GDF, find ED
qaws [65]

Answer:

10

Step-by-step explanation:

\triangle CDE \sim \triangle GDF.. (given) \\\\\therefore \frac{CD}{GD} =\frac{DE}{DF}.. (csst) \\\\\therefore  \frac{15}{x+3} =\frac{3x+1}{4}\\\\ \therefore   \: 15 \times 4 = (x + 3)(3x + 1) \\  \\ \therefore   \: 60 = 3 {x}^{2}  + x + 9x + 3 \\  \\ \therefore  3 {x}^{2}  + 10x + 3 - 60 = 0 \\ \therefore  3 {x}^{2}  + 10x  - 57 = 0 \\ \therefore  3 {x}^{2}  + 19x - 9x  - 57 = 0 \\ \therefore   \: x(3x + 19) - 3(3x + 19) = 0 \\\therefore   \:  (3x + 19)(x - 3) = 0 \\ \therefore   \: 3x + 19 = 0 \:  \: or \:  \: x - 3 = 0 \\  \therefore   \: x =  -  \frac{19}{3}  \:  \: or \:  \: x = 3 \\  \because \: x \: can \: not \: be \:  - ve \\ \therefore   \: x = 3 \\ ED = 3x + 1 = 3 \times 3 + 1  \\ \huge \red{ \boxed{ ED= 10}}

7 0
3 years ago
Write 6.75 as a mixed number.
KonstantinChe [14]

Answer:

Question 1 6 1/2

Step-by-step explanation:

Question 2 289/50

4 0
3 years ago
Read 2 more answers
Negative x minus 5 equals negative 11 what is x?<br> -x-5=-11
sergejj [24]
-x - 5 = -11

add 5 to both sides

-x - 5 + 5 = -11 + 5

-x = -6

x = 6
6 0
3 years ago
Other questions:
  • Solve each equation using the quadratic formula. Find the exact solutions.<br><br> 6n^2 + 4n = -11
    15·2 answers
  • Point B is collinear with A and C and partitions AC in a 3:4 ratio. B is located at (4,1) and C is located at (12,5). Find the c
    9·1 answer
  • What’s the answer ????
    9·1 answer
  • Consider the irrational number 73 . Between what two integers is the value of this number? A) 6 and 7 B) 7 and 8 C) 8 and 9 D) 9
    7·1 answer
  • write an equation: 1) the sum of an integer and the next consecutive integer is 37. what is the integer? 2) the product of a who
    8·1 answer
  • 74,271 in expanded form using exponents
    6·1 answer
  • A veterinarian needs to know an animal's weight in kilograms if 20 lb is about 9 kg in a dog weighs 30 lb use a ratio table to f
    11·1 answer
  • 2) Write an equation for the polynomial represented by the graph below.
    15·1 answer
  • What are all the zeros of the function f(x) = 4x2 + 8x + 3?<br> Please help!!
    14·1 answer
  • Circle A is dilated by a scale factor of 2.5 to form circle B. If the diameter of circle B is 12, what is the diameter of circle
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!