Question: CSCl 3 3 5 HW 4 Name: ID: Below are the pseudo codes of 3 algorithms. Alg 1 ( n ) : i f n

CSCl 335 HW 4
Name:
ID:
Below are the pseudo codes of 3 algorithms.
Alg1(n):
ifn=0
else return 1
end return 2**Alg1(n-1)
Alg2(n):
]=[0
Alg3(n):
if n=0
return 1
else
m=[n2]
p=Alg3(m)
p=p**p
if n is odd
else
return 2**p
return p
end
end
a) What does each algorithm compute?
b) What is the running time of each algorithm.
2. Tower of Hanoi is a mathematical puzzle where we have three rods(rodA,B,C) and n disks.
The objective of the puzzle is to move the entire stack from rodA to rodC, obeying the
 CSCl 335 HW 4 Name: ID: Below are the pseudo codes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!