JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
Custom Data type sort ? can be done in java | Reply
yes
Custom data types can also be sorted using java Collection
just need to override the methods like CompareTo .... stuff ,
java uses merge sort ,though a good sorting of order N are there y do u think so ?
Re: Custom Data type sort ? can be done in java (response to post by bpcrao) | Reply
It's a long-known result that if the only information you can get is based on comparisons (compareTo, etc) then the optimal time it takes to sort a list of N items is O(N lg N). Now, given more information, there are faster methods, but a generic sort algorithm cannot take that into account.

For examples of how extra information helps, look up radix sort, bucket sort, and counting sort. And if you really want a challenge, look up the O(n lg lg n) integer sorting algorithm by Andersson et al :)
Re: Custom Data type sort ? can be done in java (response to post by antimatter) | Reply
My favorite of those O( n log log n ) is the using van Emde Boas tree. It's simple to understand too, for some definition of simple..
RSS