Question: 1 . ( 1 2 , 5 points ) Given functions ( ) = , 2 ( ) = , , prove that; 1 0
points Given functions prove that; a in b in points You are given an array A of integers and an integer k Design and write the pseudocode for a n worstcase algorithm that finds a sequence of elements placed in consecutive indexes of the array whose sum is k Return the beginning index of the sequence. Return if there is no such sequence in A such that their sum is equal to k Do a time complexity analysis on your algorithm. points Assume that we are given an array of integers. Our aim is to find the most frequent element the element that appears the most number of times, not necessarily consecutively in this array. Design and write the pseudocode for a bruteforce n worstcase algorithm. Do a complexity analysis to show that your algorithm is n What about your algorithms best case and average case behaviors? points Design and write the pseudocode for an algorithm to rearrange elements of a given array of n real numbers so that all its negative elements precede all its positive elements. You should use an extra array of the same size with the input array in your algorithm, ie the space complexity of the algorithm, considering the input itself as an intrinsic part of the problem and hence we assume that it does not contribute to the space complexity should be linear n Your algorithm should work in linear time complexity as well. Prove that the time complexity of your algorithm is n What about best case, and average case time complexities? points Closest pair problem on a single dimension. We have n points sprinkled on the xaxis of our cartesian space ie ycoordinates of all of the points are zero We want to find the distance between the closest of these two points, ie the minimum distance between all point pairs on the xaxis. Devise a divideandconquer algorithm that finds the distance between the two closest points among n distinct points spread on the xaxis. The input to your algorithm is an array of values, COMP Analysis of Algorithms Fall HW # points Due Date: th Nov, Wednesday : representing the xcoordinate values of the given points no need for ycoordinates, since all are zero and your algorithm should return the minimum distance between any point pairs. Do a complexity analysis of your algorithm and indicate its time complexity. Support your analysis by proper arguments about the characteristics of the problem. Algorithm closestPairOneDimension PnComputes the minimum distance between the closest pair of n points placed on the xaxis, with the divideandconquer technique. Input: An array representing n points on xaxis. Output: The distance between the closest point pair. points Consider the following algorithm. Algorithm whatIsn if n then return if n then return return nn whatIsn a What does this algorithm compute? b Which strategy does it follow to solve the problem? c What is the timecomplexity of this algorithm? What is its basic operation? Comparison, Multiplication, Addition? Does your complexity analysis depend on which basic operation you choose? Please explain and validate your answer
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
