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

rearrange the equation so b is the independent variable a-7=3(b+2)
ASAP PLEASEA sampling of 30 million particles coming from an exhaust vent contained 60 sulfur dioxide molecules. What is another way of expressing this concentr
How can agriculture and irrigation be connected Please help me
Find the Mid point of (-5,-9) (-7,-4)
Write an informal letter to your friend, telling about your vacation in a Spanish-speaking country. You have to write about 100 words, using past indefinite. Yo
PLEASE HELPPP _______________ is when the bronchial tubes swell up. This is usually cause by some sort of allergy, but exercise and stress can also cause the a
Are modern whales different from whales of the past?
Sleeping infants should be directly observed by
4. The area of a regular hexagon is 50 in. Find the length of a side. Round your answer to the nearest tenth.
a girl scout troop sold cookies. if the girls sold 5 more boxes the second week than they did the first, and if they doubled the sales of the second week for th