Question: Sort the first and second half of an array Anjali likes to play mathematical tricky games .She gets n numbers for an array. Help Anjali

Sort the first and second half of an array

Anjali likes to play mathematical tricky games .She gets n numbers for an array. Help Anjali to write a Java program to sort the first half of the array in ascending order and the second half of the array in descending order. If the size of the array is 0 or lesser then display the message as "Array size should be greater then 0".

Sample Input 1:

Enter the size of an array:

5

Enter the elements:

89

23

56

12

99

Sample Output 1:

23

56

89

99

12

Sample Input 2:

Enter the size of an array:

0

Sample Output 2:

Array size should be greater then 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!