Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions