Question: SOMEONE HELP ME PLEASE NEED IT FOR A BIG ASSIGNMENT Consider an array Age with n elements representing the ages of individuals within a group


SOMEONE HELP ME PLEASE NEED IT FOR A BIG ASSIGNMENT
Consider an array Age with n elements representing the ages of individuals within a group in arbitrary order. The following algorithm (given in Java-like pseudocode) outputs indexes of two individuals that are the closest in age among pairs of individuals whose ages are stored in the array. Note that if there is more than one pair of individuals with the same age difference we simply return one such pair. In the code below, abs(x) computes the absolute value of x. For example, if Age[-25; Age[1-50: Age[2-15; Age[3-62, the algorithm will output 1 and 3 since individual 1 and 3 have age difference equals to 2, while any other pair of individuals have larger age difference
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
