[Help] RyDeR's Quicksort Algorithm -
ApolloScripter - 12.01.2019
Hello, there's a way to make the Quicksort algorithm by RyDeR`in descending order?
https://forum.sa-mp.com/showpost.php...postcount=1737
Re: [Help] RyDeR's Quicksort Algorithm -
ApolloScripter - 12.01.2019
Quote:
Originally Posted by ******
1) RyDer didn't create the algorithm. It is by Donald Knuth (I believe).
2) Slice created a whole include for this, called md-sort. It does ascending, descending, strings, and more.
|
Forgive me for the mistake, and thanks for the info, I will look.
Re: [Help] RyDeR's Quicksort Algorithm -
ApolloScripter - 13.01.2019
Hello, I came back here to avoid creating another topic, so I'm using MD-Sort now, but I have a problem.
PHP код:
for(new i = 0; i < 500; i++)
{
SortScore[i][1] = ScoreID[i];
}
SortDeepArray(SortScore, 0, .order = SORT_DESC); // This part
for(new i = 0; i < 10; i++)
{
printf("%i", SortScore[i][1]);
}
When I put it to sort (Where checked above), it returns "0" on all the cells of the array, but when removing this, it normally returns the values of each cell, I checked using printf in the above code.
Re: [Help] RyDeR's Quicksort Algorithm -
d1git - 13.01.2019
PHP код:
enum
tempArrayEnum {
tempArraySort
};
new
tempArray[24][tempArrayEnum] = {
95, 3, 7, 2, 233, 75, 1
};
SortDeepArray(tempArray, tempArraySort, .order = SORT_DESC);
95, 3, 7, 2, 233, 75, 1, 0, 0, ...
Will become;
0, 0, 0, ..., 1, 2, 3, 7, 75, 95, 233
Loop through the array after you deep sort it, "continue" if "tempArraySort" == 0, this will give you your desired result.
Re: [Help] RyDeR's Quicksort Algorithm -
ApolloScripter - 13.01.2019
Quote:
Originally Posted by d1git
PHP код:
enum
tempArrayEnum {
tempArraySort
};
new
tempArray[24][tempArrayEnum] = {
95, 3, 7, 2, 233, 75, 1
};
SortDeepArray(tempArray, tempArraySort, .order = SORT_DESC);
95, 3, 7, 2, 233, 75, 1, 0, 0, ...
Will become;
0, 0, 0, ..., 1, 2, 3, 7, 75, 95, 233
Loop through the array after you deep sort it, "continue" if "tempArraySort" == 0, this will give you your desired result.
|
It does not work, it just skips the entire
LOOP because it's all zero.
For some reason, when I sort, the cells assume the value of
"0", but when I remove the sort function and print the cells, it normally shows the values imbuyed.