Skip to content

nes1983/radixsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

radixsort

General purpose Radix sort in go.

General purpose means that you can sort anything, not just int arrays.

You're supposed to use it like this:

type cell struct {
	rowKey, colKey uint
}

func (s []cell) SortKey(pos, priority int) (key int, ok bool) {
	switch priority {
		case 0:
			return s[pos].rowKey, true
		case 1:
			return s[pos].colKey, true
		default:
			return 0, false
	}
}

func (s []cell) Len() { return len(s) }
func (s []cell) Swap(i, j int) { s[i, j] = s[j, i] }

var cells []cell
cells = ...

radix.Sort(cells)

This should outperform the standard sort package, and does in my benchmarks. Alas, it isn't quite done.

About

General purpose Radix sort in go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages