Question: The complexity of both methods (Method 1 and Method2) are O(n) public void Method1() 1 for(int i=1;i < n; i++) for(int z=1; 2 <

The complexity of both methods (Method 1 and Method2) are O(n) public

 

The complexity of both methods (Method 1 and Method2) are O(n) public void Method1() 1 for(int i=1;i < n; i++) for(int z=1; 2 < n; z++) } System.out.println(z): System.out.println("Hello"); public void Method2() for(int i=1; i

Step by Step Solution

3.53 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

In both Method1 and Method2 we have loops that run with an upper bound o... View full answer

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 Programming Questions!