- replace timsort with go's sort

pull/21/head
Emir Pasic 8 years ago
parent c874c09c6d
commit 2ccfba5f93

@ -902,9 +902,11 @@ func main() {
### Sort
Sort uses timsort for best performance on real-world data. Lists have an in-place _Sort()_ method. All containers can return their sorted elements via _GetSortedValues()_ call.
Sort is a general purpose sort function.
Internally they use the _utils.Sort()_ method:
Lists have an in-place _Sort()_ function and all containers can return their sorted elements via _containers.GetSortedValues()_ function.
Internally these all use the _utils.Sort()_ method:
```go
package main
@ -928,7 +930,6 @@ Container specific operations:
```go
// Returns sorted container''s elements with respect to the passed comparator.
// Does not effect the ordering of elements within the container.
// Uses timsort.
func GetSortedValues(container Container, comparator utils.Comparator) []interface{}
```

@ -38,7 +38,6 @@ type Container interface {
// GetSortedValues returns sorted container's elements with respect to the passed comparator.
// Does not effect the ordering of elements within the container.
// Uses timsort.
func GetSortedValues(container Container, comparator utils.Comparator) []interface{} {
values := container.Values()
if len(values) < 2 {

@ -28,7 +28,7 @@ package examples
import "github.com/emirpasic/gods/utils"
// SortExample to demonstrate basic usage of basic sort (timsort)
// SortExample to demonstrate basic usage of basic sort
func SortExample() {
strings := []interface{}{} // []
strings = append(strings, "d") // ["d"]

@ -138,7 +138,7 @@ func (list *List) Clear() {
list.elements = []interface{}{}
}
// Sort sorts values (in-place) using timsort.
// Sort sorts values (in-place) using.
func (list *List) Sort(comparator utils.Comparator) {
if len(list.elements) < 2 {
return

@ -214,7 +214,7 @@ func (list *List) Clear() {
list.last = nil
}
// Sort sorts values (in-place) using timsort.
// Sort sorts values (in-place) using.
func (list *List) Sort(comparator utils.Comparator) {
if list.size < 2 {

@ -195,7 +195,7 @@ func (list *List) Clear() {
list.last = nil
}
// Sort sort values (in-place) using timsort.
// Sort sort values (in-place) using.
func (list *List) Sort(comparator utils.Comparator) {
if list.size < 2 {

Loading…
Cancel
Save