Alternate Sorting in java

Your are given with an array, now you need to show the output as -first maximum number followed by first minimum number followed by second maximum number and second minimum number and so on....


Input
7   ----Array size
1      -------------
2                      |
3                      |
4                      |---Array elements
5                      |
6                      |
7      ------------
Output:
7
1
6
2
5
3
4

Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Profit and Loss