all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
let rec strand_sort (cmp : 'a -> 'a -> int) : 'a list -> 'a list = function
|
||||
[] -> []
|
||||
| x::xs ->
|
||||
let rec extract_strand x = function
|
||||
[] -> [x], []
|
||||
| x1::xs when cmp x x1 <= 0 ->
|
||||
let strand, rest = extract_strand x1 xs in x::strand, rest
|
||||
| x1::xs ->
|
||||
let strand, rest = extract_strand x xs in strand, x1::rest
|
||||
in
|
||||
let strand, rest = extract_strand x xs in
|
||||
List.merge cmp strand (strand_sort cmp rest)
|
||||
Loading…
Add table
Add a link
Reference in a new issue