Give an example of either iterative or recursive algorithm that has Ө( log n) running time. Give detailed time performance analysis (recurrence relation for recursive)
Give an example of either iterative or recursive algorithm that has Ө( log n) running time....
(a) Give the pseudo-code for a recursive algorithm called Find_Smallest(A, n) that returns the value of the smallest element in an array of n integers called A. Assume the elements in the array are at locations A[1]..A[n]. (b) Give a recurrence T(n) for the running time of your algorithm. (c) Solve the recurrence in part (b)
Give an algorithm with the following properties. • Worst case running time of O(n 2 log(n)). • Average running time of Θ(n). • Best case running time of Ω(1).
Consider the following recursive algorithm for computing the sum of the first n cubes: S(n) = 13 + 23 + … + n3. (a) Set up a recurrence relation for the number of multiplications made by this algorithm. (b) Provide an initial condition for the recurrence relation you develop at the question (a). (c) Solve the recurrence relation of the question (a) and present the time complexity as described at the question number 1. Algorithm S n) Input: A positive...
EC2 (5 Points): The running time of Algorithm Ais (1) n? + 1300, and the running time of another Algorithm B for solving the same problem is 112n - 8. Assuming all other factors equal, at what input sizes) would we prefer one algorithm to the other? 7.5 EC3 (2.5 Points): What is the recurrence relation (an equation that recursively defines) of the Towers of Hanoi problem? Remember, the base case is T(1) = 1 BIVAAI EE11
07-15 pts) Develop a recursive version of the Bubble Sort algorithm. (a) Write the pseudo code of the algorithm and justify that it is recursive and works correctly Write the recurrence relation for the algorithm and solve it using one of the two approaches discussed in class, as appropriate. Solve the recurrence relation and show that the time complexity of the recursive algorithm is θ(n).
7. What is the worst-case running time complexity of an algorithm with the recurrence relation T(N) = 2T(N/4) + O(N2)? Hint: Use the Master Theorem.
Consider the merge sort algorithm. (a) Write a recurrence relation for running time function for the merge sort. (b) Use two methods to solve the recurrence relation. (c) What is the best, worst and average running time of the merge sort algorithm? Justify your answer.
The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access to a global list of distinct integers a_1, a_2,..., a_n. procedure search(i, j, x : i,j, x integers, 1 < i < j < n) if a_i = x then return i else if i = j then 4. return 0 else return search(i + 1, j, x) Prove that this algorithm correctly solves the searching problem when called with parameters i = 1...
give an example of an arithmetic sequence that is found in the real world. find the common difference and write a recursive and iterative rule for the sequence. then give an example of a geometric that is found in the real world. find the common ratio and write ac recursive and iterative rule for the sequence. use a rule to find any term.
The algorithm for the Closest Point Pair problem (that we discussed in class) is careful to ensure that it does O(n) work outside of the recursive calls. In this problem, I want to investigate the consequences of not being this careful, on the running time of algorithm for his problem. Specifically, suppose that instead of sorting the points initially (outside the recursion), we sort the points as needed (by x-coordinate and by y-coordinate) inside the recursive calls. (a) Write down...