Question

Consider the following functions: int min(int x, int y) { return x < y ? x : y; } int max(int x, int y) { return x < y ? y :

1 0
Add a comment Improve this question Transcribed image text
Answer #1

The min is called 1 times
The max is called 1 times
the incr is called 89 times as we are iterating from 10-99
the square is called 89 times as we are iterating from 10-99

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Consider the following functions: int min(int x, int y) { return x < y ? x...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that contains a main function, a “double custom_operator_function(int op_type, double x, double y)”,...

    Write a program that contains a main function, a “double custom_operator_function(int op_type, double x, double y)”, a “double min(double,double)”, a double max(double x,double y), and a double pow(double x, int y). The main function is used to call the custom operator function. Next, the custom operator function calls the min/max/pow functions based on the op_type. From the main, call the custom operator function with the three inputs 1/-3/5, 2/4/5, and 3/4/5. Print the result of each input to screen. i)...

  • (a) Consider the following C++ function: 1 int g(int n) { 2 if (n == 0)...

    (a) Consider the following C++ function: 1 int g(int n) { 2 if (n == 0) return 0; 3 return (n-1 + g(n-1)); 4} (b) Consider the following C++ function: 1 bool Function (const vector <int >& a) { 2 for (int i = 0; i < a. size ()-1; i ++) { 3 for (int j = i +1; j < a. size (); j ++) { 4 if (a[i] == a[j]) return false; 5 6 } 7 return...

  • XCORE Question 1 Consider the following program void Elint x, int y Y = y +...

    XCORE Question 1 Consider the following program void Elint x, int y Y = y + 1 cout<<x<<"*«y << endl; void nain) 1 int i, a13): all) = 15; a 2) - 203 a13) = 25; cout <i«"" <all) <<"" << a12) << ""« a[3] << endl; cout <i<** <all) << "" << a12) <<""« a[3] << endl; What values of the variable and array A are printed with the following rules. a parameters are passed by value bi parameters...

  • QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x,...

    QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x, int& y); int Doughnut(int y, int z); int main( ) {             int a = 1;             int b = 2;             int c = 3;             int d = 4;             Pancake(a, b, c);             Waffle(b, c);             Pancake(d, c, b);             d = Doughnut(b, a);             return 0; } void Pancake(int x, int& y, int z) {             y += 3;            ...

  • Question 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x...

    Question 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x += i; return x; What value is returned by a function call fun(1)? B In C, static variables can only be initialized by literals, not functions. For example, this is allowed: static int x = 5; But this is not allowed: static int x = compute_initial(); Why would this be the case? A Because you can never initialize a variable using a function, even...

  • 4. Let f: X Y +R be any real valued function. Show that max min f(x,y)...

    4. Let f: X Y +R be any real valued function. Show that max min f(x,y) < min max f(x,y) REX YEY yey reX

  • Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void)...

    Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void) { x = x + 2; y = y + 4; } void bar(void) { int x = 10; y = y + 3; foo( ); cout << x << endl; cout << y << endl; } void baz(void) { int y = 7; bar( ); cout << y << endl; } void main( ) { baz( ); } What output does this program...

  • sity functions. Exercise 6.46. Let X, Y be independent random variables with density functions fx and fy. Let T- min(X,...

    sity functions. Exercise 6.46. Let X, Y be independent random variables with density functions fx and fy. Let T- min(X, Y) and V max(X, Y). Use the joint density function fr v from equation (6.31) to compute the marginal density functions fr of T and fv of V

  • int xyz( char[] X, char[] Y, int m, int n ) { int L[][] = new...

    int xyz( char[] X, char[] Y, int m, int n ) { int L[][] = new int[m+1] [n+1]; for (int i=0; i<=m; i++){ for (int j=0; j<=n; j++){ if (i == 0 Ilj == 0) L[i][j] = 0; else if (x[i-1] == Y[j-1]) L[i][j] = L[i-1][j-1] + 1; else L[i][j] max(L[i-1][j], L[i][j-1]); مه } ...//more code follows Given the code fragment above, select the best descriptive phrase from the list below. Bottom-up. Recursive. Top-down.

  • Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double...

    Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double number-25.0: int main) f int x-18, y-20; cout<c"Before: x- kex<" and y-eyecendl; Fundxy 1// end of main void Funcfint a, int b) int sum a+b; a-200; b-300; numberanumber+1.0 Which of the statements below are correct? (Select only the correct answers. There may be more than one) D A The statement double number-25.0; declares a global variable number B. The variables x and y are...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT