Course Solutions Uncategorized (Solved) : 1 Show Calculation Complexity Ciz Function O Static Void Ciz Int M Int 1 Q34204238 . . . .

(Solved) : 1 Show Calculation Complexity Ciz Function O Static Void Ciz Int M Int 1 Q34204238 . . . .

 

1) Show the calculation complexity of cizfunction as O.

static void ciz(int m) {

    for(int i=1; i<=m; i++)

      System.out.print(“X”);

}

2) By using the answer to 1, Show thecalculation complexity of main function as O.

import java.util.Scanner;

public static void main(String[] arg) {

    int n;

    Scanner oku = new Scanner(System.in);

    System.out.print(“N=”);

    n=oku.nextInt();

    for(int m=1; m<=n; m++) {

      ciz(m);

      System.out.println();

    }

}

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post