Question
1)I need help to create an acceptable pseudocode which prints out all the values less than a given value in a binary min-heap . The
1)I need help to create an acceptable pseudocode which prints out all the values less than a given value in a binary min-heap.
The given value might not be in the heap. We can assume the array representation of a binary min-heap with the first element stored at index 0.
In the general case, the algorithm should not examine every element in the heap. The algorithm does not change the heap.
2)What is the worst-case input for your algorithm? Describe both the state of the heap as well as the given value.
3)Give a tight asymptotic runtime bound for the worst case. Briefly explain your answer.
Pseudocode guidelines Pseudocode means that you don't have to write every line in Java with correct syntax. English explanations of operations are acceptable. In general, you may substitute English for any constant-time operation. The following example is not acceptable pseudocode. scan the list and count all elements less than x The following example is acceptable pseudocode. while the list has elements: increment the counter if the current element is greater than x move to the next element of the list The idea is that you don't have to give all the nitty-gritty coding details, but you should demonstrate a clear understanding of what your algorithm does and where those nitty-gritty details would have to go. To indicate blocks of code, either use braces {} or indentation levelsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started