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

Simplify 4 + (-3) - 2 x (-6 )
Which is not a major political theory
who introduced kidney transplantation
3000 equals how many ones
the constitutional amendment giving the states freedoms and control is amendment number 2,4,6,8,or10
What is unit form for 4 tens + 6 tens
Name the Ray that PQR and SQR share
How can biologists help meet the needs of people who live in hot, dry environments?
A truck travels 205 miles in 3 1/2 hours. To the nearest tenth, what is the average speed of the delivery truck? Enter your answer in the box.
Explain the difference between a seasonal worker and a migrant worker.