Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Radix Sort #1

Closed
nordlow opened this issue Mar 4, 2015 · 2 comments
Closed

Add Radix Sort #1

nordlow opened this issue Mar 4, 2015 · 2 comments

Comments

@nordlow
Copy link

nordlow commented Mar 4, 2015

I have a radix sort implementation at

https://github.com/nordlow/justd/blob/master/intsort.d#L92intsort.d

which beats Phobos own Quicksort by a factor 1.5 to 4 depending on element type (Intergral or FloatingPoint).

Run the unittest and see for yourself.

Not that I've made it work for floating point too using the functions at

https://github.com/nordlow/justd/blob/master/intsort.d#L58

that realizes bijections between

  • uint32 <=> float
  • uint64 <=> double

Nobody (including me) has had the time to get it into Phobos.

If you feel like you can included it here aswell.

The two most important todos are:

  • Figure out a way to template-parameterize radixSortImpl to make it work on aggregate element types when the comparison function can be expressed as an data-member-accessor of the aggregate. For example if ElementType is a struct S { int x, y; } and comparison function "a.x < b.x".
  • If possible implement a generic sorting algorithm that automatically selects the best suitable in-Place sorting algorithm based on types of the input parameters (range and comparsion/accessor function). This currently means isIntegral, float, double, and as above mentioned aggregates sorted on a member or combination of members whose bijection can fit into 8, 16, 32 or 64 bits.
@Xinok
Copy link
Owner

Xinok commented Apr 26, 2015

I appreciate it but I'd like to keep the code in this repository as my own. Otherwise, since I don't have my own implementation of radix sort, I could provide a link to your code in the README so others can find it. I know the README is huge; I've been meaning to move the module descriptions into separate files which would give your link greater prominence.

Also, sorry for the late response. I haven't given any attention to this repository lately as it's been on the back burner for some time.

@Xinok
Copy link
Owner

Xinok commented May 4, 2015

I've pushed a draft of a new README and provided a link to your radix sort code. I'll replace the old README once I'm done restructuring this repository.

@Xinok Xinok closed this as completed May 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants