Question: The following problems all concern an input array of integers, possibly with duplicate entries. Which of them can be solved using a single invocation

The following problems all concern an input array of integers, possibly with

 

The following problems all concern an input array of integers, possibly with duplicate entries. Which of them can be solved using a single invocation of a sorting subroutine followed by a single pass over the sorted array? (Choose all that apply.) a) Compute the minimum gap between any pair of array elements. b) Compute the number of distinct integers contained in the array. c) Compute a "de-duplicated version of the input array, meaning an output array that contains exactly one copy of each of the distinct integers in the input array. d) Compute the mode (the most frequently appearing integer) of the array. If there is a tie and there are two or more modes, the algorithm should return all of them. e) For this part, assume that the array's integers are distinct and that the array has odd length. Compute the median of the arraythe "middle element," with the number of other elements less than it equal to the number of other elements greater than it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

b Compute the number of distinct integers contained in the array c Com... View full answer

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 Programming Questions!