template
<class _Tp>
One of the problems I'm going to have to work on is how to balance the decision trees of sorting and selection algorithms. Obviously they need to be adaptive for sorted arrays as the most likely, but beyond that I need to rely on quicksort partitioning affecting the probabilities of the subarrays. I've done the work for the threesort already, but foursort hasn't been balanced to the most probable permutations having the least number of comparisons yet. While this isn't an immediate concern, its something to keep in mind for later if I keep optimizing my sort.
It also is important to consider when designing my selection algorithms. My median of five selection algorithms can do anywhere from 4 to 8 comparisons, and my 2nd and 3rd of 4 can do anywhere from 3 to 5. I dont have the data yet for optimizing the decision trees to make the least comparisons on the most probable permutations yet (from random data after quicksort partitioning) so I'm going to have to consider this later. This is further complicated by trying to predict the most probable permutations that shellsort is going to see after a quicksort partition, so I'll have a number of interesting avenues to investigate if I really want to optimize the sort. Most likely I wont get around to it but I think its good to make a note of it now if I decide to really optimize the decision trees.
Another problem I'm encountering now that I'm not sure I'll have to deal with later is ensuring stability in selection algorithms. When I attempt to do my inplace stable sort I'm going to want to have my median finders be stable, and I'm not sure if thats going to introduce extra comparisons yet. Again, thats further down the road.
![]() | You are viewing Log in Create a LiveJournal Account Learn more | Explore LJ: Life Entertainment Music Culture News & Politics Technology |