Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest

Problem Statement Suppose you have an integer array. The problem “Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest, ..” asks to rearrange the array in such a way that the smallest number comes first and then the largest number, then second smallest and then the second …

Read more

Translate »