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 types of factors make up our nonliving environment?
for any point on earths surface its height above sea level is called its
what is 1+1 describe in 1 sentence with 3 words (no less no no more words than 3).
The setting of act v for Romeo and Juliet
Which could be considered an act indicating acceptance of the social contract? A. using electricity B. watching network news broadcasts C. driving on the highwa
Consider the following cross: Parent 1: YyTt Parent 2: YyTt Using the rules of probability, determine the probability that the offspring will show YyTT genotype
evaluate each expression |18||2|+|-13|=|-20|-|17|=
At the beginning of a lesson a piece of chalk is 4.875 inches long at the end of the lesson the chalk is 3.125 inches long write the two amounts and expanded fo
What type of line is the graph of x = −2?
What does the Secretary of State do?