Question: 1. import java.util.Scanner; 2. public class root 3. { 4. public static void main(String args) 5. { 6. Scanner input = new Scanner(System.in); 7. double

 1. import java.util.Scanner; 2. public class root 3. { 4. public

1. import java.util.Scanner; 2. public class root 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. number = a; 14. 15. while (Math.abs(a-(number/a))>=0.25) { 16. a = (a+(number/a))/2; 17. } 18. a = Math.floor(a); 19. System.out.println(int) a); 20. } 21. } a = 2: In Big O notation, what is the run-time of this algorithm as a function of the input n? Select one: a. O(log n) O b. 0(1) OC. Odlog n) + O(log n) 0 d. O(n) e. (2 log n)

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!