# Algorithm Analysis

*label*Computer Science

*timer*Asked: Mar 28th, 2017

### Question Description

Consider a set S of n ï‚³ 2 distinct numbers all greater than zero in unsorted order. For each of the problems below:

â€¢ Give an algorithm to determine two distinct numbers x and y in the set S that satisfy the condition(s) of the problem.

â€¢ Your algorithm must be specified using pseudocode in the style of the text.

â€¢ You must justify that your algorithm has the requested run time.

a. in O(n lg n) time, determine x, y ïƒŽ S such that x ï‚¹ y and x y w z ï€ ï‚£ ï€ for all w, z ïƒŽ S such that w ï‚¹ z. (20 pts)

b. in O(n) time, determine x, y ïƒŽ S such that x y w z ï€ ï‚³ ï€ for all w, z ïƒŽ S for all w, z ïƒŽ S such that w ï‚¹ z. (20 pts)

This question has not been answered.

Create a free account to get help with this and any other question!