Perform a detailed complexity analysis of the main method. In this case, it is necessary to analyze the complexity of the methods sub1 and sub2. Use asymptotic notation to indicate the best and worst...

Perform a detailed complexity analysis of the main method. In this case, it is necessary to analyze the complexity of the methods sub1 and sub2. Use asymptotic notation to indicate the best and worst case. The size() method returns the number of elements in a list.public void main(ArrayList args){<br>sub1( );<br>double x, у, z;<br>for(int i = (1000 + args.size( )); i >= 0; i--){<br>x = (double)i/2; y = (double)x/2; z = (double)x+y;<br>System.out.print(z);<br>}<br>sub2(args);<br>}<br>public void sub1( ){<br>double x, у, 2;<br>for(int i = 1000; i >= 0; i--){<br>x = i/2; y = x/2; z = x+y;<br>System.out.print(z);<br>}<br>}<br>public void sub2(ArrayList args ){<br>for(int i = 0; i < Math.pow(args.size(), 10); i++){<br>System.out.println( = 0; i--){ x = (double)i/2; y = (double)x/2; z = System.out.print(z); } %3D (double)x+y; } "/>
Extracted text: public void main(ArrayList args){ sub1( ); double x, у, z; for(int i = (1000 + args.size( )); i >= 0; i--){ x = (double)i/2; y = (double)x/2; z = (double)x+y; System.out.print(z); } sub2(args); } public void sub1( ){ double x, у, 2; for(int i = 1000; i >= 0; i--){ x = i/2; y = x/2; z = x+y; System.out.print(z); } } public void sub2(ArrayList args ){ for(int i = 0; i < math.pow(args.size(),="" 10);="" i++){="" system.out.println(="" "hello="" world");="" }="" for(int="" i="0;" i="">< args.size();="" i++){="" system.out.print(args.get(i));="" }="" double="" x,="" у,="" z;="" for(int="" i="1000" +="" math.pow(args.size(),="" 10);="" i="">= 0; i--){ x = (double)i/2; y = (double)x/2; z = System.out.print(z); } %3D (double)x+y; }

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here