Homework Solution: c static void p0(int [] A) { for (int i = 0: i 0: j–) System.out.print ln (A[i]): } public static v…

    . Dterine the big running tine with respect to n of tlogn) or(int :1cA.lengthii*+) Syatem.out.printlaCA b) publie static vold pi(int o for (int 1-o,cA.iengt) n Systea. out-Printin ati] 2. Systen.outprintin CATA) c) public static void pacint.) :4,length;1++) er (int i for (int j-i:j<10000 j-j2)n*z on System.out printin(A) for (int p-0ipCA.Leagthip+) Systes.out.printlaCA[p)) public static void p3Cint AC for (int 1-0:1KA. Jength:14) oun) Syates.out.printin(A3]) pablic atatie woid p4Cint yaten.out. or(int isO ; i«A·length ; i-1+A-length/17) rindaat订 public static void ps(int )t for (int 1-0;1cA.length)n for (int j 0;jsA.1eagth;j++) .oin) for(int k#A-length i kolk-k-2) Syatea.out.printinCAD g) public static void p(int i-laa·length;eiti Syates.out.priatin(a( for (int public static void p7Cint ) for (int i-oisa:length.1.1engthi++)- Systes CA(j]): { ) public,static void p8dat。A){ For (int i1iica.length A.length: 123) Syatem.out.printin AL public statievoidpoint。A){ for ( Syates: out : print laatoni
    Determine the big-O running time with respect to n of each of the following methods: public static void p0(int [] A) { for (int i = 0: i 0: j--) System.out.print ln (A[i]): } public static void p1(int [] A) { for (int i = 0: i 0: j = j/2) System.out.print ln (A[i]): for (int p = 0: p

    Expert Answer

     
    a) O(n^2)

    . Dterine the bulky general tine with i-elation to n of tlogn) or(int :1cA.lengthii*+) Syatem.out.printlaCA b) publie static vold pi(int o coercion (int 1-o,cA.iengt) n Systea. extinguished-Printin ati] 2. Systen.outprintin CATA) c) national static useless pacint.) :4,length;1++) er (int i coercion (int j-i:j<10000 j-j2)n*z on System.extinguished sculpturein(A) coercion (int p-0ipCA.Leagthip+) Systes.out.printlaCA[p)) national static useless p3Cint AC coercion (int 1-0:1KA. Jength:14) oun) Syates.out.printin(A3]) pablic atatie woid p4Cint yaten.out. or(int isO ; i«A·prolixity ; i-1+A-length/17) rindaat订 national static useless ps(int )t coercion (int 1-0;1cA.length)n coercion (int j 0;jsA.1eagth;j++) .oin) coercion(int k#A-prolixity i kolk-k-2) Syatea.out.printinCAD g) national static useless p(int i-laa·length;eiti Syates.out.priatin(a( coercion (int national static useless p7Cint ) coercion (int i-oisa:length.1.1engthi++)- Systes CA(j]): { ) national,static useless p8dat。A){ Coercion (int i1iica.prolixity A.length: 123) Syatem.out.printin AL national statievoidpoint。A){ coercion ( Syates: extinguished : sculpture laatoni

    Determine the bulky-O general era with i-elation to n of each of the subjoined methods: national static useless p0(int [] A) { coercion (int i = 0: i 0: j–) System.out.sculpture ln (A[i]): } national static useless p1(int [] A) { coercion (int i = 0: i 0: j = j/2) System.out.sculpture ln (A[i]): coercion (int p = 0: p

    Expert Counter-argument

     

    a) O(n^2)
    b) O(n)
    c) The aggregate enumerate of loops are n*2 + n = O(n^2)
    d)O(n^2)
    e)O(n)-
    f)O(n^3)
    g)The extinguisheder loop is general coercion n eras still the secret loop j is getting incremented with j = j*j.j starts with single and j*j dross 1. So the secret loop is never fulfilment.
    h) O(n^3)
    i) O(n^2)
    j) log(n)