subject

You are given a min-heap containing n data items, along with a data item x and a positive integer k. Your task is to design an algorithm that runs in time O(k) and answers the following question: are there at least k items in the heap that are less than x?
Of course, you could go through the entire heap and just count the number of items that are less than x, but this would take time proportional to n. The challenge is to design an algorithm whose running time is O(k) by somehow using the heap property.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
question
Computers and Technology, 22.06.2019 09:50
What is a rush associated with alcohol?
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Which excel file extension stores automated steps for repetitive tasks?
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
You know the right answer?
You are given a min-heap containing n data items, along with a data item x and a positive integer k....
Questions
question
Mathematics, 10.09.2019 19:30
Questions on the website: 13722367