[Include] Double-Sort
#1

"Double-Sort"

Introduction
This is a basic sorting algorithm i wrote recently.
You can either sort the array by ascending or descending order.

Other Sorting Algorithms (In PAWN) Sorting Algorithms (Wikipedia)
http://en.wikipedia.org/wiki/Sorting_algorithm

Test Script
removed since there are faster sorting algorithms out there.
Reply
#2

How about more than 2 ?
Reply
#3

More than 2 of what?
Reply
#4

Oh sorry, I thought its a sort by two arrays, because I didn't see a float(double) and the name hinted to one of the two.

So, its a regular sort (?)
Reply
#5

Yeah you got me confused for a while. Yes, it's a regular sort!
Reply
#6

eciN, but, can you give me some speed test? (I cant do it, because my PC dont work).
Reply
#7

There is already a sorting include for pawn in the CRF, https://github.com/codectile/CRF-Lib...er/c_arlib.inc
Reply
#8

Quote:
Originally Posted by EnzoMetlc
Посмотреть сообщение
eciN, but, can you give me some speed test? (I cant do it, because my PC dont work).
Sure, i'll provide speed tests on the main post in a short while.

Quote:
Originally Posted by ******
Посмотреть сообщение
This looks like BubbleSort, which is a VERY slow sorting algorithm, and is recursive, which PAWN is not good at. Have you tried this on an array of, say 1000 unsorted elements? I'm pretty sure the server will run out of memory, after a long time. I suggest you read up on the algorithmic complexity of bubblesort vs quicksort.
Been re-writing it a few times and it should not resemble bubble-sort as much now.

And yes, i noticed it didn't work on arrays of bigger sizes (1000~ +), unfortunately....

I've been reading briefly about sorting algorithms but i haven't wrapped my head around what makes quicksort so much faster (yet).

Quote:
Originally Posted by codectile
Посмотреть сообщение
There is already a sorting include for pawn in the CRF, https://github.com/codectile/CRF-Lib...er/c_arlib.inc
CRF? Never heard of it before.
Reply
#9

Developing a fundamental algorithm for array sorting requires excellent mathematics skills. Editing/re-inventing (as ****** said) algorithms can have a very bad impact on the results.
Reply
#10

Mainly because of educational purposes for me atleast, i like to learn things by re-inventing the wheel as you said. And ofcourse it's a positive thing if someone else reads my code and learns something from it.

I'm confident i'll be able to make a better sorting function in the future, once i have more knowledge on the subject.

And as i referred to more efficient sorting algorithms in the main post, then i really don't see what the problem is.

With that being said, i do understand your way of thinking aswell, making faster and more efficient code than those existing would be a bigger contribution.
Reply
#11

Good Job!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)