How to arrange array in half Ascending and Half Descending order | Java

Опубликовано: 04 Октябрь 2024
на канале: Extreme Programmer
6,173
87

Hello Everyone!!

I have created a program which is frequently asked in TCS Pre-selection aptitude round in Command line section.
To print the length in half ascending and half descending.
-------------------------------------------------------------------------
Input : 2,3,2,5,7,5,6,3
Output : 2,2,3,3,7,6,5,5
-------------------------------------------------------------------------
How to do that?
we have to use Swap function to sort array in ascending order.
By using formula:
Temp=a;
a=b;
b=Temp;
More detailed explaination is there in the video!!
-------------------------------------------------------------------------
Thank you!!!

Please support my channel by Liking my videos, Sharing it as well as Subscribing it!!
-------------------------------------------------------------------------
#instapickup
#javaprogram
#java
#programmingconcepts