Question

II. (7 points) Consider the following bit of pseudocode: for (int k = 1; ks Ign; k++) (for (int i = 1; i r: i++) Print HelloExplain please

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

び) Gsven Code print Hetle d rep sent Logz 1. 2 be 品3( 3 o the neprinled nt ialk 2 oeso -the Hello wor ld is printed by o tme be ime kn : OL the inpd too innu 1st nne

Add a comment
Know the answer?
Add Answer to:
Explain please II. (7 points) Consider the following bit of pseudocode: for (int k = 1; ks Ign; k++) (for (int i = 1; i r: i++) Print "Hello World"; for (int j-1;jsn:j++) Print "Hello Worl...
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
  • Hey, I really need help understanding the math get the answer that is given. Please help....

    Hey, I really need help understanding the math get the answer that is given. Please help. Thanks in advance. for (int k =0; k s Ign; k++) {for (int i =0; is n2; i++) Print “Hello World"; for (int j =0; j s n; j++) Print “Hello World"; } When n = 2, how many times will “Hello World” be printed?16 When n =4, how many times will “Hello World” be printed? 66 Assuming that the print is the basic...

  • Consider the following algorithms int add.them (int n, int AI) index iふk; j=0; for (i =...

    Consider the following algorithms int add.them (int n, int AI) index iふk; j=0; for (i = 1; n; i++) jsjtA[i]; for (i = 1; n; i++) return j+ int anysqual (int n, int A) index i,j,k.m; for ( iSn i++) for G-1:jSnj++) for (k = 1; k n: k++) for (m t= 1; m n: m++) return 1 return 0 Note: The array parameter A[ I[1 in any equal is an n x n two-dimensional array. For example when n...

  • Question No.1 [CLO 1][7 marks] 1. Consider the following pseudocode: Algorithm IterativeFunction (a, b) // a...

    Question No.1 [CLO 1][7 marks] 1. Consider the following pseudocode: Algorithm IterativeFunction (a, b) // a and b are integers while (a>0) B- a/2 A a-2 end while return b; i. What is the time complexity of the IterativeFunction pseudocode shown above? ii. What is the space complexity of the IterativeFunction pseudocode shown above? 2. What is the time complexity of the following algorithm (Note that n(n+1) 2,2 n(n+1)(2n+1) 2 and ): Provide both T(n) and order, e(f(n)). int A=0;...

  • 3) [16 points total] Consider the following algorithm int SillyCalc (int n) int i; int Num, answer; if (n <=...

    3) [16 points total] Consider the following algorithm int SillyCalc (int n) int i; int Num, answer; if (n <= 4) return n 10; else { Num-SillyCalcl n/4) answer = Num + Num + 10; for (i-2; i<-n-1; ++) answer- answer+ answer; return answer; Do a worst case analysis of this algorithm, counting additions only (but not loop counter additions) as the basic operation counted, and assuming that n is a power of 2, i.e. that n- 2* for some...

  • 3) [16 points totall Consider the following algorithm: int SillyCalc (int n) { int i; int Num, answer; if (n &lt...

    3) [16 points totall Consider the following algorithm: int SillyCalc (int n) { int i; int Num, answer; if (n < 4) 10; return n+ else f SillyCalc(Ln/4) answer Num Num 10 for (i-2; i<=n-1; i++) Num + = answer + answer; answer return answer } Do a worst case analysis of this algorithm, counting additions only (but not loop counter additions) as the basic operation counted, and assuming that n is a power of 2, i.e. that n- 2*...

  • Consider the following pseudo-code: // Assume i, j, k are integers for i = 1 to...

    Consider the following pseudo-code: // Assume i, j, k are integers for i = 1 to n do for j = n-i+1 to n { k = 1; while (k*k <= j) { perform <op>; k = k + 1; } } Find an expression for f(n), the number of times is performed. Find g(n) so that f(n) is Θ(g(n)). Prove your answer.

  • 1-Is it possible to run a program without a main() function? Yes No 2- How many...

    1-Is it possible to run a program without a main() function? Yes No 2- How many main() functions can one have in a program? 2 This depends on what compiler you use. As many as you like 1 3- What does the following code fragment leave in x? char a = 'A'; int x = sizeof (a); 1 Depends on what compiler you use. 4 2 4- True or false: In a C program I can have two functions with...

  • 3. Recursive Program (6 points) Consider the following recursive function for n 1: Algorithm 1 int...

    3. Recursive Program (6 points) Consider the following recursive function for n 1: Algorithm 1 int recurseFunc(int n) If n 0, return 1. If n 1, return 1 while i< n do while j <n do print("hi") j 1 end while i i 1 end while int a recurse Func(n/9); int b recurse Func (n/9) int c recurse Func (n/9) return a b c (1) Set up a runtime recurrence for the runtime T n) of this algorithm. (2) Solve...

  • #include <iostream> #include <climits> Using namespace std; Intmain() { Int I; Int j; Cout << “For...

    #include <iostream> #include <climits> Using namespace std; Intmain() { Int I; Int j; Cout << “For this compiler: “ << endl; Cout << “integers are: “ << sizeof(int) << “bytes” << endl; Cout << “largest integers is “ <<INT_MAX << endl; Cout << “smallest integers is “ <<INT_MIN << endl; Cout << “Input two integers values “ << endl; Cin >> i >> j; Cout << endl << “You entered the following values: “ << endl; Cout << “integer “...

  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

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