How many times the above statement will be executed? Write down the Big-O for the above statement? Write down the name of the growth rate.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

Q1/

a. Consider the following statements.

{

     for(int k=0; k < A; k++) {

System.out.println(k);

         }

     for(int i=0; i < A; i++) {

       for(int j=0; j < A; j++) {

       System.out.println(i);

       System.out.println(j);

               } }

  1. How many times the above statement will be executed?
  2. Write down the Big-O for the above statement?
  3. Write down the name of the growth rate.

 b. Order the following functions by asymptotic growth rate – Big-O (from slower to faster): 

            30n + 15,  6logn,  3n3 + 60n2, 50n2

 

Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Hiring Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning