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
Sliva [168]
3 years ago
5

Give an efficient algorithm to find all keys in a min heap that are smaller than a provided value X. The provided value does not

have to be a key in the min heap. Evaluate the time complexity of your algorithm
Computers and Technology
1 answer:
viva [34]3 years ago
3 0

Answer:

The algorithm to this question as follows:

Algorithm:

finding_small_element(element,Key xa) //defining method that accepts parameter

{

if (element.value>= xa) //check value

{

//skiping node

return;  

}

print(element.value);//print value

if (element.left != NULL) //check left node value

{

finding_small_element(element.left,xa); //using method

}

if (element.right != NULL) //check right node value

{

finding_small_element(element.right,xa); //using method

}

}

Explanation:

In the above pre-order traversing algorithm a method  "finding_small_element" is defined, that accepts two parameter, that is "element and ax', in which "element" is node value and ax is its "key".

  • Inside this if block is used that check element variable value is greater then equal to 0.
  • In the next step, two if block is defined, that check element left and the right value is not equal to null, if both conditions are true, it will check its right and left value. In this algorithm, there is no extra need for traversing items.
You might be interested in
on the road you are traveling,the pavement markings change from broken white lines to solid white lines between the lanes of tra
alexdok [17]
Broken lines mean you can pass. Solid lines mean you cannot pass.
8 0
3 years ago
An objective test or measurement that technology product evaluators use to compare two or more products is ____.
Crazy boy [7]
<span>An objective test or measurement that technology product evaluators use to compare two or more products is benchmark. The benchmark is set of standards which are used to compare two products. Several parameters are measured in order to compare the products and to define the weak points where improvements can be done. The obtained information form the test is used to improve performance. </span>
4 0
3 years ago
Which one of these is the range for a Class C address?
kifflom [539]

class C network addresses range from 192 to 223

6 0
3 years ago
Read 2 more answers
Write an expression that computes the difference of the variables x and y on Python.
yulyashka [42]

Answer:

x times y

Explanation: because adding the fractions would ecvlate a different b     fraction

7 0
3 years ago
Select all the mistakes in the following: There may be more than one.
sdas [7]

The if statement should have two equal signs, the elseif should be elif, and the else statement should have a colon at the end of it.  There might be more errors in the indentation but I cant know unless I see a picture of the problem. The print statement should be indented into the if, elif, and else statements.

4 0
3 years ago
Other questions:
  • Write a recursive method public static String reverse(String str) that computes the reverse of a string. For example, reverse("f
    6·1 answer
  • Under what key category do page up and page down keys fall?
    15·1 answer
  • Which is the highest level of the hierarchy of needs model?
    7·2 answers
  • What is nominal data?
    5·1 answer
  • What is your favourite video game??​
    5·2 answers
  • Which of these file formats would you choose if you had to create a very small and compact raster image for a website?
    11·1 answer
  • What is the largest computer file size, megabyte , gigabyte, terabyte
    15·2 answers
  • Write a function solution that, given an integer N, returns the maximum possible
    8·1 answer
  • Write a program to have the computer guess at a number between 1 and 20. This program has you, the user choose a number between
    9·1 answer
  • Write any two word processing software​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!