You will need to recurse on n4 rather than n-1 thats


programming language is JAVA:

Write a recursive method

static int intSquareRoot(int n) {} // return the biggest number whose square is <= n. Assume n >= 0.

Use recursion. No loops allowed. You will need to recurse on n/4 rather than n-1. That's because the method is called with some big values . If you recurse on n-1 those values will generate a StackOverflowError.

Of course Math.sqrt() or other Math class methods are not to be used in your implementation. You're just coding this using recursion and elementary operations .

Implementation Hint: intSquareRoot(n) is close to intSquareRoot(n/4) * 2. (Either equal to it or one more than it. You can tell which one, by squaring something.)

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: You will need to recurse on n4 rather than n-1 thats
Reference No:- TGS02901355

Expected delivery within 24 Hours