Question: Q4. Write the recursive algorithm Find which to find[i]=ifor given a sorted array of distinct integers [1,2,...,]where is a odd number. Find recursion relation and

Q4. Write the recursive algorithm Find which to find[i]=ifor given a sorted array of distinct integers [1,2,...,]where is a odd number. Find recursion relation and running time of this algorithm. (Hint:This algorithm is a Divide and Conquer approach and first call: Find (A,1,n)) Q4. Write the recursive algorithm Find which to find[i]=ifor given a sorted

1 N 3 4 7 Total NAME-SURNAME: STUDENT ID: Duration: 110 Minutes Q5. (a) Write a recursive function that finds the sum of integers 1 to n. (10P) (b) Calculate the running time of the function you wrote. (10) Q1. a) Run the following algorithm for input A=. What is A when the algorithm terminates. Show each iteration. (10P) b) Find the running time of the algorithm in O/big 0) notation. (5P) Algorithm (A,1,1) for i = 1 ton-1 for j = n down to i + 1 if A[i] > Aj - 1] exchange A[] with Aj - 1] Q6. In the following algorithm, the parameter x is the root of a binary search tree. What does the following algorithm do in the following BST? Explain what it does? (10) 1. y = TreeMin(x) 2. print key [y] 3. 3 = TreeMax (x) 4. while key [y]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!