Results 1 to 3 of 3
Thread: Jolly Sorting
- 12-17-2010, 12:59 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 81
- Rep Power
- 0
Jolly Sorting
I have to do some odd type of sorting i was wondering if i was on the right path.
consider the set of numbers {1, 5, 6, 8, 9, 2, 3, 4, 7}. An example of a jolly sort of this set would be {1, 5, 2, 4, 3, 9, 6, 8, 7}. The first two numbers of a jolly sort (if there are two or more numbers to be sorted) should be in ascending order
It is like a high low high low type of sort. I was wondering if i can make 2 arrays sort them in ascending and descending and then merge the both of them?
DO you think that would get the job done?
- 12-17-2010, 04:04 AM #2
Member
- Join Date
- Oct 2010
- Posts
- 81
- Rep Power
- 0
I have to split this array into 2 and then i think merge them into one resembling that post above..
how would i come across to split this array into 2 seperate onesJava Code:import java.util.Arrays; public class Jolly { public static void main(String[] args){ Integer[] ints = new Integer[20]; ints[0] = 1; ints[1] = 17; ints[2] = 18; ints[3] = 3; ints[4] = 8; ints[5] = 6; ints[6] = 11; ints[7] = 20; ints[8] = 19; ints[9] = 2; ints[10] = 4; ints[11] = 5; ints[12] = 12; ints[13] = 16; ints[14] = 7; ints[15] = 10; ints[16] = 14; ints[17] = 13; ints[18] = 9; ints[19] = 15; Arrays.sort(ints); } }
- 12-17-2010, 08:45 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
sorting problem
By vasug in forum Advanced JavaReplies: 2Last Post: 02-25-2010, 04:55 AM -
FIFO sorting
By fanle in forum New To JavaReplies: 3Last Post: 07-24-2009, 06:35 AM -
Sorting 10 numbers
By perito in forum New To JavaReplies: 56Last Post: 03-05-2009, 01:52 AM -
sorting
By jot321 in forum New To JavaReplies: 18Last Post: 10-02-2008, 10:30 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks