0
Java program to sort the array elements using hard coded values not runtime values
What's the if () logic?
14 Answers
+ 1
Your question is unclear, but I'm assuming you want to sort an array of numbers. There are many algorithms that can do this at varying efficiencies. Try looking up sorting algorithms, and see if you can find one that suits your needs.
+ 1
I don't get it.. What not clear? Mention what you didn't get. If I could find why would I post? I want for hard coded not runtime.. Okay?
+ 1
I couldn't find a code for hard coded.. If anyone knows pls send the code.
+ 1
You want to sort an array that is hard coded and not input during runtime, right? It should be simpler doing it hard coded. Once you have your array, perform a bubble sort or insertion sort on it. Those are simple sorting algorithms that are decently efficient for small arrays
+ 1
Well TQ but can't we solve it with if () condition? If so how?
+ 1
Yeah but my doubt is in the if () loop condition taken is I>j but that doesn't satisfy.. We have to take the reverse condition then the action should be performed.. Like do you get what am saying.
+ 1
And if you're quite good or pro in java would you mind giving me your FB id or anything cause I'm not able ask doubts here wholeheartedly..
+ 1
Am already.. TQ for the suggestion. Well I got solve it for a while and be back of I have any queries.
0
My whole doubt is in if loop and the swapping statements
0
I mean I can't ask with typing everything.. Got to ask through audio
0
That's fine but can't we do with for loop instead of for each? Y