Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,43 +0,0 @@
with Gnat.Heap_Sort_G;
procedure Integer_Sort is
-- Heap sort package requires data to be in index values starting at
-- 1 while index value 0 is used as temporary storage
type Int_Array is array(Natural range <>) of Integer;
Values : Int_Array := (0,1,8,2,7,3,6,4,5);
-- define move and less than subprograms for use by the heap sort package
procedure Move_Int(From : Natural; To : Natural) is
begin
Values(To) := Values(From);
end Move_Int;
function Lt_Int(Left, Right : Natural) return Boolean is
begin
return Values(Left) < Values (Right);
end Lt_Int;
-- Instantiate the generic heap sort package
package Heap_Sort is new Gnat.Heap_Sort_G(Move_Int, Lt_Int);
begin
Heap_Sort.Sort(8);
end Integer_Sort;
requires an Ada05 compiler, e.g GNAT GPL 2007
with Ada.Containers.Generic_Array_Sort;
procedure Integer_Sort is
--
type Int_Array is array(Natural range <>) of Integer;
Values : Int_Array := (0,1,8,2,7,3,6,4,5);
-- Instantiate the generic sort package from the standard Ada library
procedure Sort is new Ada.Containers.Generic_Array_Sort
(Index_Type => Natural,
Element_Type => Integer,
Array_Type => Int_Array);
begin
Sort(Values);
end Integer_Sort;

View file

@ -1,22 +0,0 @@
PROGRAM-ID. sort-ints.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 array-area VALUE "54321".
03 array PIC 9 OCCURS 5 TIMES.
01 i PIC 9.
PROCEDURE DIVISION.
main-line.
PERFORM display-array
SORT array ASCENDING array
PERFORM display-array
GOBACK
.
display-array.
PERFORM VARYING i FROM 1 BY 1 UNTIL 5 < i
DISPLAY array (i) " " NO ADVANCING
END-PERFORM
DISPLAY SPACE
.

View file

@ -1,9 +1,9 @@
import system'routines;
import extensions;
public program()
public Program()
{
var unsorted := new int[]{6, 2, 7, 8, 3, 1, 10, 5, 4, 9};
auto unsorted := new int[]{6, 2, 7, 8, 3, 1, 10, 5, 4, 9};
console.printLine(unsorted.clone().sort(ifOrdered).asEnumerable())
Console.printLine(unsorted.clone().sort(ifOrdered).asEnumerable())
}

View file

@ -1,2 +0,0 @@
include sort.e
print(1,sort({20, 7, 65, 10, 3, 0, 8, -60}))

View file

@ -1 +0,0 @@
34,12,23,56,1,129,4,2,73 | Sort-Object

View file

@ -1 +0,0 @@
sort [2 4 3 1 2]

View file

@ -1,29 +0,0 @@
/*REXX program sorts an array (using E─sort), in this case, the array contains integers.*/
numeric digits 30 /*enables handling larger Euler numbers*/
@. = 0; @.1 = 1
@.3 = -1; @.5 = 5
@.7 = -61; @.9 = 1385
@.11= -50521; @.13= 2702765
@.15= -199360981; @.17= 19391512145
@.19= -2404879675441; @.21= 370371188237525
#= 21 /*indicate there're 21 Euler numbers.*/
call tell 'unsorted' /*display the array before the eSort. */
call eSort # /*sort the array of some Euler numbers.*/
call tell ' sorted' /*display the array after the eSort. */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
eSort: procedure expose @.; parse arg N; h=N /*an eXchange sort.*/
do while h>1; h= h%2 /*define a segment.*/
do i=1 for N-h; j=i; k= h+i /*sort top segment.*/
do while @.k<@.j /*see if need swap.*/
parse value @.j @.k with @.k @.j /*swap two elements*/
if h>=j then leave; j= j-h; k= k-h /*this part sorted?*/
end /*while @.k<@.j*/
end /*i*/
end /*while h>1*/
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell: say copies('', 65); _= left('',9); w= length(#)
do j=1 for #; say _ arg(1) 'array element' right(j, w)"="right(@.j, 20)
end /*j*/
return

View file

@ -1,26 +0,0 @@
/*REXX program sorts (using E─sort) and displays a list of some interesting integers. */
Bell= 1 1 2 5 15 52 203 877 4140 21147 115975 /*a few Bell " */
Bern= '1 -1 1 0 -1 0 1 0 -1 0 5 0 -691 0 7 0 -3617' /*" " Bernoulli " */
Perrin= 3 0 2 3 2 5 5 7 10 12 17 22 29 39 51 68 90 /*" " Perrin " */
list= Bell Bern Perrin /*throw them all ───► a pot. */
say 'unsorted =' list /*display what's being shown.*/
#= words(list) /*nice to have # of elements.*/
do j=1 for # /*build an array, a single */
@.j=word(list, j) /* ··· element at a time.*/
end /*j*/
call eSort # /*sort the collection of #s. */
$=; do k=1 for #; $= $ @.k /*build a list from the array*/
end /*k*/
say ' sorted =' space($) /*display the sorted list. */
exit /*stick a fork in it, we're all done.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
eSort: procedure expose @.; parse arg N; h= N /*an eXchange sort.*/
do while h>1; h= h % 2 /*define a segment.*/
do i=1 for N-h; j= i; k= h + i /*sort top segment.*/
do while @.k<@.j /*see if need swap.*/
parse value @.j @.k with @.k @.j /*swap two elements*/
if h>=j then leave; j= j - h; k= k - h /*this part sorted?*/
end /*while @.k<@.j*/
end /*i*/
end /*while h>1*/
return