<p>plzz guid me</p><p><br/></p>
We need at least 9 more requests to produce the answer.
1 / 10 have requested this problem solution
The more requests, the faster the answer.
Consider the following algorithm: procedure algo (int m, int n) if (n==1) return m else return m + algo(m, n-1) Find algo 12, 4 using above algorithm.
#include <stdio.h> int josephus(int n, int k) { if (n == 1) return 1; else /* The position returned by josephus(n - 1, k) is adjusted because the recursive call josephus(n - 1, k) considers the original position k%n + 1 as position 1 */ return (josephus(n - 1, k) + k-1) % n + 1; } // Driver Program to test above function int main() { int n = 14; int k = 2; printf("The chosen place...
Given algorithm- procedure factorial (n: nonnegative integer) if n = 0 then return 1 else return n*factorial(n-1) {output is n!} Trace the above algorithm when it is given n = 7 as input. That is, show all steps used by above algorithm to find 7!
How to prove G(n)=n+1 in this algorithm? 1. if (n 0) 2. return 1 3. else if (n1) f 4. return 2 5. else if (n 2) 6. return 3 7. else if (n3) t 8. return 4 else f 9. int OGnew int[n 11 10. G[O]1 12. G[2]3 13. G[3]4 14. int i:-4 15. while (i<n) t 16. if (i mod 20) else ( 20. return G[n] 1. if (n 0) 2. return 1 3. else if (n1) f...
b) Consider the following code. public static int f(int n) if (n == 1) return 0; else if (n % 2 == 0). return g(n/2); else return g(n+1); public static int g(int n) int r = n % 3; if (r == 0) return f(n/3); else if (r == 1) return f(n+2); else return f(2 * n); // (HERE) public static void main(String[] args) { int x = 3; System.out.println(f(x)); (1) (5 points) Draw the call stack as it would...
7. Consider the following proposed sorting algorithm supersort (int n, int start, int end, keytype SI1)1 if(n > 1) { if (SIstart] > S[end]) swap SIstart] with Stend]; supersort(n-l, start, end-1, s) supersort (n-1, start+, end, S) a) 3 pts) Give a recurrence relation (with initial condition) that describes the complexity of this sort algorithm b) (4 pts) Solve the recurrence froma) c) (3 pts) Is supersort guaranteed to correctly sort the list of items? Justify your answer. (A formal...
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...
4. Sort the following compounds by chemical reaction rate. (12) (1) SN1 reaction (consider the stability of carbocation) CH (a) CH,CH,CH,CH,Br, (CH),CBr, CH,CH,CHB A B C Order: > > (b) OCH.CH,Br. OchBr , achch, BE Order: > > (2) SN2 reaction (a) CH,CH,CH,Br, (CH),CCH,Br, (CH),CHCH,B Order: -> CH, (b) CH,CH,CHBr , (CH),CBr, CH,CH,CH,CH,B1 Order:
Please all thank you Exercise 25: Let f 0,R be defined by f(x)-1/n, m, with m,nENand n is the minimal n such that m/n a) Show that L(f, P)0 for all partitions P of [0, 1] b) Let mE N. Show that the cardinality of the set A bounded by m(m1)/2. e [0, 1]: f(x) > 1/m) is c) Given m E N construct a partition P such that U(f, Pm)2/m. d) Show that f is integrable and compute Jo...
Please solve the above 4 questions. 1. Using the extended Euclidean Algorithm, find all solutions of the linear congruence 217x 133 (mod 329), where 0 x < 329 (Eg. if 5n, n 0,. ,6) 24 + 5n, п %3D 0, 1, . .., 6, type 24 + x< 11 2. Find all solutions of the congruence 7x = 5 (mod 11) where 0 (Eg. if 4,7 10, 13, type 4,7,10,13, none. or if there are no solutions, type I 3....
(1 point) Find the QR factorization of 4 -14 6 -14 12 -21 M = ME