Consider n elements that are equally distributed in k stacks. In each stack, elements of it are arranged in ascending order (min is at the top in each of the stack and then increasing downwards). Given a queue of size n in which we have to put all n elements in increasing order. What will be the time complexity of the best known algorithm?
Answers
Answered by
0
Answer:
Consider n elements that are equally distributed in k stacks. In each stack, elements of it are arranged in ascending order (min is at the top in each of the stack and then increasing downwards). Given a queue of size n in which we have to put all n elements in increasing order.
Answered by
2
Explanation:
Here is your answer
In nlogk it can be done by creating a min heap of size k and adding all the top – elements of all the stacks. After extracting the min , add the next element from the stack from which we have got our 1st minimum..Mark as Brainliest
Similar questions
Math,
5 months ago
Math,
5 months ago
Biology,
5 months ago
Accountancy,
11 months ago
Computer Science,
11 months ago
English,
1 year ago