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

what is 3/8 as a decimal an show work
Why did Henry VIII leave the Catholic Church in the 1500s?
Putting happenings or thoughts into the proper sequence produces ______. coherence cohesion content
What is the kinetic energy of an object that has a mass of 30 kilograms and moves with a velocity of 20 m/s?
I have 3 problems that I don't understand on my home work can some one help 1) jack wants to buy a pair of trousers for $60 when he went to the store he found
A comma may be useful after introductory phrases because __________.
What is the preamble to the Constitution?
Ms. Ross has 24 students. 2/3 of her students have brown hair. The rest have blonde. How many students have brown?
use of force to move an object over a distance
In the word "claustrophobic" phob is the (5 points) root. suffix. prefix. affix.