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 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
In both Method1 and Method2 we have loops that run with an upper bound o... View full answer
Get step-by-step solutions from verified subject matter experts
