ds.ListSort

ListSort

package haxe-ds

Available on all platforms

ListSort provides a stable implementation of merge sort through its sort method. It has a O(N.log(N)) complexity and does not require additional memory allocation.

Static methods

static inline sort<T> (list:T, cmp:T ‑> T ‑> Int):T

Sorts List lst according to the comparison function cmp, where cmp(x,y) returns 0 if x == y, a positive Int if x > y and a negative Int if x < y.

This operation modifies List a in place and returns its head once modified. The prev of the head is set to the tail of the sorted list.

If list or cmp are null, the result is unspecified.

static inline sortSingleLinked<T> (list:T, cmp:T ‑> T ‑> Int):T

Same as sort but on single linked list.

© 2005–2016 Haxe Foundation
Licensed under a MIT license.
http://api.haxe.org/haxe/ds/ListSort.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部