Write a recurrence relation for the run time

Assignment Help Data Structure & Algorithms
Reference no: EM131875666

Question 1.

a) Write a recursive Java function, void max( int[] A, int lo, int hi ), that finds the maximum value among the array elements A[lo], A[lo+1], . . . , A[hi], using the tournament method. (That is, find the maximums in two halves of the array and then compare them.)

b) This function can be used to find the max of an N-element array by calling max(A, 0, N-1). Write a recurrence relation for the run time, T(N ), of the function.

c) Use the Master Theorem to find T (N ). (Explain your reasoning. You shouldn't be surprised by the answer!)

Question 2.

Suppose that a recursive algorithm divides a problem of size n into 4 problems of size n/2. The amount of extra work that is done to split the problem into parts and to combine the results from processing the parts is Θ(n2). Write a recurrence relation for the run time of the algorithm and use the Master Theorem to find the run time. How does the answer change if the extra work has run time Θ(n3/2)?

Reference no: EM131875666

Questions Cloud

Pharmacological and physiological effects of substance use : Select two substances from the following and describe at least two pharmacological and physiological effect of each (200-350 words each).
How you solved the social security crisis : Based upon your research and the results of the Social Security Game, write a report that addresses how YOU solved the Social Security crisis.
Develop outline for sex-education class for a group of teens : Develop an outline for a sex-education class for a group of teens. What type of education would be most effective and why?
What is the purpose of the capital projects fund : What is the purpose of the capital projects fund? What is the purpose of the debt service fund? What is inter-period equity
Write a recurrence relation for the run time : CPSC 327 - Write a recurrence relation for the run time, T(N ), of the function and How does the answer change if the extra work has run time T(n3/2)
Describe way to how intervention is tackling teenage suicide : Describe ways as to how this intervention is tackling teenage suicide. Is the method effective? Is it prominent as a help hotline for teenagers to use in the co
What is the minimum acceptable price of this special order : Polar Manufacturing has excess capacity. For Polar Manufacturing, what is the minimum acceptable price of this special order
Purposes of computing its cash flow return on investment : What is MBA Inc.'s gross investment (GI) for purposes of computing its cash flow return on investment (CFROI)?
Analyze hps use of bribery to obtain foreign contracts : Analyze HP's use of bribery to obtain foreign contracts based on a utilitarian/consequentialist approach.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Look scheduling policy

Given that it takes 1.75 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track 15 moving toward the low- numbered tracks; and that you are using the LOOK scheduling policy

  Find the row of array a

Assuming A is already in memory, describe a method running in O(n) time (not O(n 2 ) time) for finding the row of A that contains the most 1's.

  Compare the number of comparisons needed to sort lists

Compare the number of comparisons needed to sort lists of n elements for n = 100, 1000, and 10,000 from the set of positive integers less than 1,000,000.

  Determine the sequence of pairwise matrix multiplication

Determine the sequence of pairwise matrix multiplication to use. Show the steps of the algorithm - Bellman-Ford algorithm on this graph. Show the steps of the algorithm.

  Show that such a set of truncations can always be found

Now the company's question to you is the following: Given the schedule for each ship, find a truncation of each so that condition (†) continues to hold: no two ships are ever in the same port on the same day. Show that such a set of truncations ca..

  Determining ciphertext generated by encryption

Determine ciphertext (in binary form) generated by encryption of character X?

  Code for a sequential search and a binary search

I have code for a sequential search and a binary search. I have to "add a counter for every key comparison in each search function and print out the number of key comparisons for each search."

  Implement the coordinate descent algorithm in r

Implement the coordinate descent (CD) algorithm in R. You can build up your codes as follows: Generate a training dataset and an independent testing dataset from the same model. (b) Fit the model on the training data using CD algorithm for a fixed ..

  Write algorithms to perform the following operations on it

Write algorithms to perform the following operations on it - create, insertion, deletion, for testing overflow and empty conditions.

  Design look ahead stack as a class template derived

Design Look Ahead Stack as a class template derived from a Stack class template. A look-ahead stack differs from a standard stack only in the push operation.

  Write down a cumulative 10- to 12-page paper incorporating

write a cumulative 10- to 12-page paper incorporating your prior work. solve the design problems of your virtual

  Why the compound boolean condition is needed to control

Why the compound Boolean condition is needed to control the search from the left in function split.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd