Question: MATLAB!! HELP!! implement and compare the runtime performance of the following square root algorithms (without using the built-in function sqrt). PART A Implement a naive
MATLAB!! HELP!!
implement and compare the runtime performance of the following square root algorithms (without using the built-in function sqrt).
PART A
Implement a naive brute-force algorithm that finds the square root of n, rounded down to the closest integer, by testing every integer between 1 and n. Your result should be equivalent to floor(sqrt(n)). Also add counter k that is incremented during each iteration of the loop, to keep track of the iterations. Provide the algorithm as a function with signature [root, k] = sqrt a(n). Show the result for n = 10^8
PART B
Implement a brute-force algorithm that finds the square root of n rounded down to the closest integer by testing every integer starting at 1 and stopping immediately when the square root is found. Your result should be equivalent to floor(sqrt(n)). Again, add the counter and provide the algorithm as a function with signature [root, k] = sqrt b(n). Show the result for n = 10^8
PART C
Recall Newtons method . Using a loop of your choice, calculate the square root of 10^8 using Newtons method. Stop the loop if the current approximation error is less than 0.5. Again add the counter, and provide the algorithm as a function with signature [root, k] = sqrt c(n). Show the result for n = 10^8
PART D

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
