Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,36 +1,20 @@
templates quicksort
templates partial
def first: $(1);
def last: $(2);
def pivot: $@quicksort($first);
@: $(1) + 1;
$(2) -> #
when <..~$@> do
def limit: $;
@quicksort($first): $@quicksort($limit);
@quicksort($limit): $pivot;
[ $first, $limit - 1 ] !
[ $limit + 1, $last ] !
when <?($@quicksort($) <$pivot~..>)> do
$ - 1 -> #
when <?($@quicksort($@) <..$pivot>)> do
@: $@ + 1; $ -> #
quicksort templates
partition templates
@ set [];
pivot is $(1);
[$(2..)... -> #]!
$pivot !
$@ !
when <|..$pivot> do
$ !
otherwise
def temp: $@quicksort($@);
@quicksort($@): $@quicksort($);
@quicksort($): $temp;
@: $@ + 1; $ - 1 -> #
end partial
@: $;
[1, $@::length] -> #
$@ !
when <?($(1) <..~$(2)>)> do
$ -> partial -> #
..|@ set $;
end partition
[$ -> #] !
when <|[](1..)> do
$ -> partition -> # !
when <~|[]> do
$ !
end quicksort
[4,5,3,8,1,2,6,7,9,8,5] -> quicksort -> !OUT::write
[4,5,3,8,1,2,6,7,9,8,5] -> quicksort !

View file

@ -0,0 +1,36 @@
templates quicksort
templates partial
def first: $(1);
def last: $(2);
def pivot: $@quicksort($first);
@: $(1) + 1;
$(2) -> #
when <..~$@> do
def limit: $;
@quicksort($first): $@quicksort($limit);
@quicksort($limit): $pivot;
[ $first, $limit - 1 ] !
[ $limit + 1, $last ] !
when <?($@quicksort($) <$pivot~..>)> do
$ - 1 -> #
when <?($@quicksort($@) <..$pivot>)> do
@: $@ + 1; $ -> #
otherwise
def temp: $@quicksort($@);
@quicksort($@): $@quicksort($);
@quicksort($): $temp;
@: $@ + 1; $ - 1 -> #
end partial
@: $;
[1, $@::length] -> #
$@ !
when <?($(1) <..~$(2)>)> do
$ -> partial -> #
end quicksort
[4,5,3,8,1,2,6,7,9,8,5] -> quicksort -> !OUT::write

View file

@ -0,0 +1,37 @@
quicksort templates
partial templates
first is $(1);
last is $(2);
pivot is $@quicksort($first);
@ set $first + 1;
$last -> # !
when <|..~$@> do
limit is $;
@quicksort($first) set $@quicksort($limit);
@quicksort($limit) set $pivot;
[ $first, $limit - 1 ] !
[ $limit + 1, $last ] !
when <|?($@quicksort($) matches <|$pivot~..>)> do
$ - 1 -> # !
when <|?($@quicksort($@) matches <|..$pivot>)> do
@ set $@ + 1; $ -> # !
otherwise
temp is $@quicksort($@);
@quicksort($@) set $@quicksort($);
@quicksort($) set $temp;
@ set $@ + 1; $ - 1 -> # !
end partial
@ set $;
[1, $@::length] -> !#
$@ !
when <|?($(1) matches <|..~$(2)>)> do
$ -> partial -> !#
end quicksort
[4,5,3,8,1,2,6,7,9,8,5] -> quicksort !