Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write an algorithm that returns the sum of first m elements of an array S. 2. Write an algorithm that outputs the smallest
1. Write an algorithm that returns the sum of first m elements of an array S. 2. Write an algorithm that outputs the smallest and largest values in the array S which has m unique elements. 3. Write an algorithm that reverses the order of the array s[1], s[2],...,s[n]. 4. Given an array s[1], s[2],...,s[n] such that n >1 and s[i] s[i+1] for all i. Write an algorithm that insert an input value x into the array so that s[i] s[i+1] for all i. 5. Order the following functions according to their order of growth (from the lowest to the highest). n!, 5 lg(n+ 100)0, 22n, n + 3n + 1, nlgn, 3n 6. Prove the following assertion: If f(n) = 0(g(n)), then g(n) = N(f(n)). 7. Prove that lg(nk + c) = 0(lgn) for every fixed k > 0 and c > 0. 8 (1) If f(n) = 2n + 1, prove that f(n) = 0(n). If f(n) = 2n+2, prove that f(n) = 0(2"). (ii) (iii) If f(n) = 3 lg n + 2, prove that f(n) = 0(lgn).
Step by Step Solution
★★★★★
3.41 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
1 Pseu...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started