Question: Can someone help me to write using factorial to modify this algorithms?? Thanks in advance Exercise 2.2. The algorithm Algorithm MySart (Algorithm 4) is iterative.
Exercise 2.2. The algorithm Algorithm MySart (Algorithm 4) is iterative. Modify it to make it as a recursive algorithm. Algorithm 4 Algorithm MySqrt(n). Input: An natural number n. Output: Lv/m 1: low = 1 // Low value of guess 2: high-n l/ High value of guess 3: while true do 4: m(low + high)/2] //current estimate for value of square root 5: if (mid * miK n) and ((mid + 1) * (mid + 1) > n) then 6: Output mid and STOP // this is the answer 7: else if (mid mid n) then 9: low mid 10: else 11: 12: //mid > lvii high mid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
