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 16:30
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 25.06.2019 03:00
Match the categories in the first column with examples in the second column. 1. good for watching movies 2. maximum power with small size 3. older style mobile devices that may or may not have internet connectivity tablet computer a.)pda b.)smart phone c.)tablet computer
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, 15.04.2021 20:40
question
Social Studies, 15.04.2021 20:40
question
Chemistry, 15.04.2021 20:40
Questions on the website: 13722360