Question: Q 1 Runtime 2 Points Grading comment: / / This method returns whether or not a pair of numbers, / / num 1 and num

Q1 Runtime
2 Points
Grading comment:
// This method returns whether or not a pair of numbers,
// num1 and num2, are between 1-m and 1-n, respectively
boolean findPair(int num1, int num2, int m, int n){
for (int i =1; i <= m; i++){
if (num1== i){
for (int j =1; j <= n; j++){
if (num2== j){
return true;
}
}
}
}
return false;
}
Question 1.1 Worst-case runtime
Q1.1 Worst-case runtime
1 Point
Grading comment:
What is the worst case runtime of findPair?
Choice 1 of 5:O(m+n)
Choice 2 of 5:O(m*n)
Choice 3 of 5:O(m/n)
Choice 4 of 5:O(m)
Choice 5 of 5:O(n)

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!