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,37 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Non_Continuous is
type Sequence is array (Positive range <>) of Integer;
procedure Put_NCS
( Tail : Sequence; -- To generate subsequences of
Head : Sequence := (1..0 => 1); -- Already generated
Contiguous : Boolean := True -- It is still continuous
) is
begin
if not Contiguous and then Head'Length > 1 then
for I in Head'Range loop
Put (Integer'Image (Head (I)));
end loop;
New_Line;
end if;
if Tail'Length /= 0 then
declare
New_Head : Sequence (Head'First..Head'Last + 1);
begin
New_Head (Head'Range) := Head;
for I in Tail'Range loop
New_Head (New_Head'Last) := Tail (I);
Put_NCS
( Tail => Tail (I + 1..Tail'Last),
Head => New_Head,
Contiguous => Contiguous and then (I = Tail'First or else Head'Length = 0)
);
end loop;
end;
end if;
end Put_NCS;
begin
Put_NCS ((1,2,3)); New_Line;
Put_NCS ((1,2,3,4)); New_Line;
Put_NCS ((1,2,3,4,5)); New_Line;
end Test_Non_Continuous;

View file

@ -1,69 +0,0 @@
Function SubSequence ( [Array] $S, [Boolean] $all=$false )
{
$sc = $S.count
if( $sc -gt ( 2 - [Int32] $all ) ) {
[void] $sc--
0..$sc | ForEach-Object {
$gap = $_
"$( $S[ $_ ] )"
if( $gap -lt $sc )
{
SubSequence ( ( $gap + 1 )..$sc | Where-Object { $_ -ne $gap } ) ( ( $gap -ne 0 ) -or $all ) | ForEach-Object {
[String]::Join( ',', ( ( [String]$_ ).Split(',') | ForEach-Object {
$lt = $true
} {
if( $lt -and ( $_ -gt $gap ) )
{
$S[ $gap ]
$lt = $false
}
$S[ $_ ]
} {
if( $lt )
{
$S[ $gap ]
}
}
) )
}
}
}
#[String]::Join( ',', $S)
} else {
$S | ForEach-Object { [String] $_ }
}
}
Function NonContinuous-SubSequence ( [Array] $S )
{
$sc = $S.count
if( $sc -eq 3 )
{
[String]::Join( ',', $S[ ( 0,2 ) ] )
} elseif ( $sc -gt 3 ) {
[void] $sc--
$gaps = @()
$gaps += ( ( NonContinuous-SubSequence ( 1..$sc ) ) | ForEach-Object {
$gap1 = ",$_,"
"0,{0}" -f ( [String]::Join( ',', ( 1..$sc | Where-Object { $gap1 -notmatch "$_," } ) ) )
} )
$gaps += 1..( $sc - 1 )
2..( $sc - 1 ) | ForEach-Object {
$gap2 = $_ - 1
$gaps += ( ( SubSequence ( $_..$sc ) ) | ForEach-Object {
"$gap2,$_"
} )
}
#Write-Host "S $S gaps $gaps"
$gaps | ForEach-Object {
$gap3 = ",$_,"
"$( 0..$sc | Where-Object { $gap3 -notmatch ",$_," } | ForEach-Object {
$S[$_]
} )" -replace ' ', ','
}
} else {
$null
}
}
( NonContinuous-SubSequence 'a','b','c','d','e' ) | Select-Object length, @{Name='value';Expression={ $_ } } | Sort-Object length, value | ForEach-Object { $_.value }

View file

@ -1,33 +0,0 @@
'Non-continuous subsequences - VBScript - 03/02/2021
Function noncontsubseq(l)
Dim i, j, g, n, r, s, w, m
Dim a, b, c
n = Ubound(l)
For s = 0 To n-2
For g = s+1 To n-1
a = "["
For i = s To g-1
a = a & l(i) & ", "
Next 'i
For w = 1 To n-g
r = n+1-g-w
For i = 1 To 2^r-1 Step 2
b = a
For j = 0 To r-1
If i And 2^j Then b=b & l(g+w+j) & ", "
Next 'j
c = (Left(b, Len(b)-1))
WScript.Echo Left(c, Len(c)-1) & "]"
m = m+1
Next 'i
Next 'w
Next 'g
Next 's
noncontsubseq = m
End Function 'noncontsubseq
list = Array("1", "2", "3", "4")
WScript.Echo "List: [" & Join(list, ", ") & "]"
nn = noncontsubseq(list)
WScript.Echo nn & " non-continuous subsequences"