Golden Sun Hacking Community

General Hacking => Assets & Discussion => Coding => Topic started by: Daddy Poi's Oily Gorillas on 21, December, 2014, 11:40:39 AM

Title: Sorting algorithm
Post by: Daddy Poi's Oily Gorillas on 21, December, 2014, 11:40:39 AM
What sorting algorithm would be best if one was used for an editor? (For example, say you wanted to show HP of all enemies from least to greatest.)

I have thought of making an array where each entry would point to the item that would come next....
Basically to prevent the need to "insert" things into a list that would cause one to need to move everything down.
There's one trade-off to that, maybe... And it makes it harder to find where an item would go into the list faster?

Either way, there's not enough entries in the lists for it to matter...

Anyway, notes can be kept here, and I shall link to this interesting topic!  http://en.wikipedia.org/wiki/Sorting_algorithm
Title: Re: Sorting algorithm
Post by: Salanewt on 21, December, 2014, 11:46:38 AM
I guess whatever would be the fastest one, since it would mitigate the lag in other areas somewhat.
Title: Re: Sorting algorithm
Post by: Daddy Poi's Oily Gorillas on 21, December, 2014, 11:52:16 AM
Finding the fastest one is what the topic was about.

Chances are, only the Text sorting one would likely need to be fast. (12k+ lines) But even then, if you manage the data in RAM... , maybe not? (Could possibly consider having an index for each character to the location of the corresponding list of text as well. That works well with bytes, but when you get to 32-bit data-types, that could be an out-of-memory problem. ; I guess a 256 entry list could still be used for the more significant bits... and perhaps which bits are checked could be determined by what numbers are used in the list. (So in the beginning of the sort, the 256 would be for the least significant bits until large numbers are used, then the entry list would be cleaned up. Having a big number in the beginning, though, might make that method less useful.)

Best compression and best sorting are two huge puzzles that are seemingly alike, but different.