Question: 1) Show the calculation complexity of ciz function as O. static void ciz(int m) { for(int i=1; i

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();

}

}

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!