1.
2.
Find the tight bound on the run time for problem 1 and 2
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
1)
We can write the recurrence as
T(n)=T(n/3)+T(2*n/3)+cn
Note: Brother According to HomeworkLib's policy we are only allowed to answer first part if there are many. So, I request you to post other part as separate posts.
Kindly revert for any queries
Thanks.
1. 2. Find the tight bound on the run time for problem 1 and 2 void...
Using C++ please explain What is the Big-O time complexity of the following code: for (int i=0; i<N; i+=2) { ... constant time operations... Select one: o a. O(n^2) O b. O(log n) c. O(n) O d. 0(1) What is the Big-O time complexity of the following code: for(int i=1; i<N; i*=2) { ... constant time operations... Select one: O O a. O(n^2) b. 0(1) c. O(n) d. O(log n) O What is the Big-O time complexity of the following...
This is for C in Linux: Problem 1: Given the following recursive function: void recursiveFunction( int m ) printf("%d", m); if( m <= 0 ) return; if( n + 2 == 0 ) recursiveFunction( m - 1); else recursiveFunction( m - 2); What is the output when the following functions are called with these parameters? recursiveFunction( 5 ); recursiveFunction( 10 ); recursiveFunction( 0);
Problem 1. Select the running time of each function. void print_array (int* A, int n) for (int í 0; i < n; ++i) cout << A[i] << endl; void print_array pairs (int* A, int n) for (inti 0; i < n; ++i) for (int j 0; j < n; ++j) cout << Ai] ALj]< endl; void print_array_start(int* A, int n) for (int i 0; i < 100 ; ++i) cout << A[i] << endl; void print_array_alt (int* A, int n)...
computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int 10 for(= 0; i < 101) printf("d", 1); A. 10 times B. 1 time C. It will run forever D. 0 times 2. What will be the output of this program? #include <stdlib.h> #include <stdio.h> int main() int a = 100, b = 200, C = 300; if(!a >= 500) b = 300; C = 400; printf("%d, 8d, &d", a, b, c); return 0;...
Give a big-Oh characterization, in terms of n,of the running time for each of the following code segments (use the drop-down): - public void func1(int n) { A. @(1). for (int i = n; i > 0; i--) { System.out.println(i); B. follogn). for (int j = 0; j <i; j++) System.out.println(j); c.e(n). System.out.println("Goodbye!"); D.@(nlogn). E.e(n). F.ein). public void func2 (int n) { for (int m=1; m <= n; m++) { system.out.println (m); i = n; while (i >0){ system.out.println(i); i...
homework c++ find the error/correction void Showval (int n) for (int i = 0; i<10;-) cout <<n [i; )
Describe the worst case running time of the following pseudocode functions in Big-Oh notation in terms of the variable n. Show your work b) void func(int n) { for (int i = 0; i < n; i = i + 10) { for (int j = 0; j < i; ++i) { System.out.println("i = " + i); System.out.println("j = " + j);
11) What is the output of the following Che statements? void Exam(int N) { int list1[3] { 2, 4, 6); if (NX2 - 0) cout << listi[N - 1); else cout << listi[N 5):) void main() { int list[3] - (1, 3, 5); Exam(list[2]);} A) 2 B) 4 C) 6 D) 3 12
6) What is the final value of variable num after executing the following statements? void Exam(int & N) A)13 ( T++ ¢ut << < 1 ) B)12 void main() (int num-10; C) 11 for (int i - 0; i < 3; i.) Exam (num). D) 10
Write as a shell script Write as a shell script # include <stdio.h> int main (void) {int area_code, prefix, number; printf("Enter phone number [(999) 999-9999]:"); scanf("(%d)%d-%d", &area_code, & prefix, & number); printf("You entered %d-%d-%d \n", area_code, prefix, number); return 0;}