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

Just answer please explain if you want
m^2-6m-55can you show the steps please
can someone help please it would be greatly appreciated
Answer the question about the story “On the Gulls' Road.” Which of the following is a theme of the story? A. The dead will be forgotten. B. People can never e
What is the slope of these two points? (76,73) & (58,59) Plz have an explanation....
My homework says determine the value of y that makes each equation true for all values of x what do they mean
at cvs you bought a magazine for $6 and some candy for $3 each. you spent a total of $18. how many candies did you buy
Patricia, Hugo and Sun work at a music store. Each week, Patricia works three more than twice the number of hours that Hugo works. Sun works 2 less than Hugo.
How does the image most support the central idea of this text
Write the equation of a circle with a center at (0, 8) and a radius of 9.