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 distance between these points (1,-2),(9,13)
Answer this for 50 points + brainliest
30 times 30 equals what
How many g of a medication should be provided if 400 mg is prescribed?
Alan deposits $10 per month into his savings account. Which expression could represent the amount he saves, in dollars, in y years?
What is the last thing Dana remembers before she wakes up?
had changed. A bold, expanding America was spreading its wings, daring the old world order to challenge its newfound might. When Theodore Roosevelt became presi
the Navajo are an indigenous group of people who live in the Southwestern United States. Explain how a book about the Navajo written by a historian would be dif
What is the surface area of the cylinder with height 7 in and radius 7 in? Round your answer to the nearest thousandth
Who all go to Carroll high School in Monroe louisiana