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

Brand A scooter has a top speed that goes 2 miles per hour faster than Brand B. if after hours, Brand A scooter traveled 24 miles, at what rate did Brand B scoo
what is 30% of $650.00
The perimeter of a sheet of paper is 38cm. If the width is 8 cm what is the length of the paper?
What was Ramses the second leadership style
What were the main policies and changes set forth by the Congress of Vienna (1814-15)?
Round $6.6666 to the nearest cent
Iron is a solid, grey metal. Oxygen is a colorless gas. When iron and oxygen chemically combine , rust is made. Rust has a reddish brown color. Why does rust di
The first compact microwave ovens were sold in 1960. Everybody didn’t use them until the 1980’s.a. comma b. and c. or d. but e. because which one would be
How would you find the zeros of the function by rewriting the function in intercept form? Ex: y=x^2-12x+32
which two numbers multiply to give you 100 and add to give you 10