logo

Crowdly

Browser

Add to Chrome

Read carefully the following program: import java.util.Scanner; public class...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Read carefully the following program:

  1. import java.util.Scanner;

  2. public class submission1

  3. {

  4.     public static void main(String[] args)

  5.     {

  6. Scanner input = new Scanner(System.in); 

  7. double number = input.nextDouble();

  8. double a = 2;

  9. while (Math.abs(a-(number/a))>=0.25) {

  10. a = (a+(number/a))/2;

  11. }

  12. a = Math.floor(a);

  13. if (a * a > number) a = a -1;

  14. if ((a+1) * (a+1) <= number) a = a +1;

  15.         System.out.println((int) a);

  16.     }

  17. }

In Big O notation, what is the run-time of this algorithm as a function of the input size n?

100%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.kent.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome