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

what is the inequality of 0.3(0.3x+0.8)<-0.3
how many school text book that i can buy with 5 billion? (this is my civics homework)
sophia exerts a steady 40n horizontal force on a 8kg resting on a lab bench. the box slides against a horizontal friction of 24n. show that the box accelerates
a^3+a+a^2+1 2a^2+2ab+ab^2+b^3 ------------------------------- * ---------------------------------- a^3+a^2+ab^2+b^2 a^3+a+a^2b+b
Does sit-ups reduce belly fat?
Contrast situations where work is done with different amounts of force to situations where no work is done such as standing still???
Based on the suffix, -ant, what does the word “defiant” mean?
Name two structures found around the outside of ALL bacterial cells
v=kfovern   what does n=
Please answer any of these thanks !