Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Java) Algorithm complexity (a) System.out.println(a); j = 1; while(j

(Java) Algorithm complexity

(a)

System.out.println("a");

j = 1;

while(j<=n*n*n){

for(i=1;i<= n;i *= 2){

System.out.println(i);

}

j++;

}

Time = ? (Hint: how many iteration?)

Big O notation?

(b)

for(i=1;i<= 600;i++){

for(k=1;k<= n ; k++){

System.out.println(i*k);

}

}

for(i = 1;i<= n;i++){

System.out.println(i*50);

}

Time = ?

Big O notation?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

5 What are the ongoing challenges for HRM?

Answered: 1 week ago

Question

4 What typifies the first and second waves of HRM?

Answered: 1 week ago