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

How many americans died in the revolutionary war
When money is acting as a store of value, it allows an individual toA. exchange goods for other goods and services in the economy.B. transfer dollars, and there
ISDN stands for Internet Services Dynamic Network True/False
What dose impulsive me
The Financial _________ Law requires owners and operators of motor vehicles to be financially responsible for damages they cause when involved in a crash. Resp
Can someone help me out with this question??
Which equation describes the same line as y-5=-2(x+4)
A bullet moving at a speed of 152 m/s passes through a plank of wood at 128m/s. Another bullet moving at 97m/s passes through the same plank at what speed?
use the distributive property to rewrite the expression without parentheses -8(m-7)
Which event started the Korean War?