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

John left his home and walked 3 blocks to his school , as shown in the accompanying graph. What is one possible interpretation of the section of the graph from
write the fraction with the greatest value 7/10, 1/5, 9/10
What two numbers multiply to get 54 and add to get 36?
the tens digit of a two digit number is twice the units digit. The sum of the digits is twelve. Find the original number.
Why is rosa parks an important and inspirational woman?
Christine baked a pumpkin pie. She ate 1/6 of the pie. Her brother ate 1/3 of it , and gave the left overs to his friends . What fraction of the pie did he gave
In a class of 14 boys and 16 girls 3 children were absent. What fraction of the children was (a)absent (b)present
variables give three possible values for n numbers GCF 9,n 3
if T (n) =3n-1 what is the 3rd term
The factor that affects how easily an electron can be removed from an atom is the A. surrounding atoms. B. temperature of the environment. C. size of the atom.