Deleted
Printable View
Deleted
I'm not sure if I'm missing something but I don't think that'll work. Your loop's exit condition is based on Midpoint but you haven't maintained that within the loop so it will never exist. In fact it will simply keep iterating until EndPoint drops off the beginning of the index or StartPoint drops off the end, at which point you'll get an error.
I'm also not aure what you're trying to do. Are you just swapping the order of your array? In which case it's not doing that either. It will bubble the bottom element to the top and the top to the bottom but the intermediate elements won't actually move. They'll temporarily shift one place toward their nearest boundary as the original boundary element passes them but they'll get shifted back again when the other other original boundary element goes past in the other direction.
Am I missunderstanding what you're doing here?
edit>Also, I don't understand what you're doing to set the midpoint in the first place. If you're looking for the median element in teh array you want (StartPoint+EndPoint)/2 (and then accomodate the fact that there be an even number of elements so no single median element) rather than StartPoint-EndPoint*2. Using your formula will result in a positive int when called from AllDescending and a negative when called from AllAscending. So given your Loops exit criteria this will do nothing when called from AllAscending and crash with an "Index out of Bounds" when called from AllDescending.
What does your source code really do, can it make coffee by itself and then all you do is just place in the cup, and then press a button???
LOL
I am just kidding, this source code really looks like VB.NET and then that is really cool. Because of the fact of the matter that many people like myself have stayed on the programming platform of the late 1990's. Which I am beginning to give up, right about now...
So then what I was trying to say here, in this post. What does your snippet of source code, really do???
I am very interested in that fact!!
Even I must admit that the above creation of mine was a bad idea, which is why I deleted it.