jbarrette9305 jbarrette9305
  • 23-08-2019
  • Computers and Technology
contestada

A complete traversal of an n node binary tree is a(n)____ "operation if visiting a node is O(1)for the iterative implementation

A. O(1)

B.O(n)

C.O(logn)

D.O(n2)

Respuesta :

ExieFansler ExieFansler
  • 30-08-2019

Answer:

B.O(n).

Explanation:

Since the time complexity of visiting a node is O(1) in iterative implementation.So the time complexity of visiting every single node in binary tree is O(n).We can use level order traversal of a binary tree using a queue.Which can visit every node in O(n) time.Level order traversal do it in a single loop without doing any extra traversal.

Answer Link

Otras preguntas

Which formulas represent one ionic compound and one molecular compound?
What is the function of the pituitary gland?
what are the best tips for correcting punctuation?
Represent 23/-4 on number line
write an equation for each condition 1) The line with a slope of 7 and a y-intercept of -1( in slope-intercept form) 2) The line that passes through (1,-5) and
A ball falls, rebounds to 72% of its previous height and falls again. After two bounces, the ball reached a height of 25cm. From what height was the ball droppe
how did hitler change the lives of workers
The mean of 20 numbers is 18. If 3 is added to each of the first ten numbers, find the mean of the new set of 20 numbers.
A 10.0-milliliter sample of NaOH(aq) is neutralized by 40.0 milliliters of 0.50 M HCl. What is the molarity of the NaOH(aq)?
how to plot m>0 on a number line