1. Engineering
  2. Computer Science
  3. 1 show the calculation complexity of ciz function as o...

Question: 1 show the calculation complexity of ciz function as o...

Question details

1) Show the calculation complexity of ciz function 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 the calculation 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();

    }

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution