karlafzamudio75491 karlafzamudio75491
  • 23-08-2019
  • Computers and Technology
contestada

the efficinecy for solving the towers of hanoi problem recursively

A.O(n2)

B. O(2n)

C.O(logn)

D.O(n)

Respuesta :

ExieFansler ExieFansler
  • 28-08-2019

Answer:

B.O(2n)

Explanation:

The time complexity of solving towers of hanoi problem recursively is O(2n) because there are two recursion calls in the solution of tower of hanoi.First recursive call to move n-1 disks to from source to helper then the user moves nth disk from source to destination after that recursion moves n-1 disks from helper to destination using source as helper rod.So each recursive call make two more recursive call this makes the time complexity be O(2n).

Answer Link

Otras preguntas

Which of the following is the least important property of a mineral? A streak B hardness C luster D color
Why do we use fractions to represent slope?
Double bonds are fat
Ms. Gorman has an extraordinary ear for subtle rhymes. Watch or reread aloud "The Hill We Climb" and listen for them. Which stood out for you? - In the title
Find the area of the circle. Round your answer to two decimal places, if necessary. A circle with a radius of 13 kilometers. 13 km $A\approx$ km $^2$
Which of the following expression is equivalent to 5 · 5 · 5 · 5 · 5 · 5? 5^5 5^6 6^5 5^7 THIS IS MATH
help pls, will mark brainliest !!!
If a = 2 then what is 3a + 1?
Post-Civil War destruction in the South included all of the following EXCEPT: a. Railroads, roads, and bridges were damaged. b. State treasuries went bankrupt.
What civilization was founded along the Indus in 2500 BCE?