English
Source / code snippets

any Kombinationen the wide k from n Elementen lists: "Knuth´s Algorithmus T"

 

p.specht

with the spending of Kombinationen the wide k from n Elementen is the slippy 'Algorithm T' angesagt; though have I it same combined with 'Algorithm X-7', sodaß one now optional aufsteigende (dflg%=0) or absteigende (dflg%=1) lexikalische Order dial can. on what The combined Indizes verweisen, remaining naturally you give over!
Window Title "Algorithm X-7 from D. Knuth´s TAOCP 7.2.1.3 p.36 Xercise 7"
' (D)2011/07 Demoware by P. woodpecker
' No warranties whatsoever. Use at your own risk!
' Improved by a decrease-flag (dflg%): 0 = increasing, nonzero = decreasing
var dflg%=0'decreasing order-flag off
Font 2
declare j%,s%,b%[],n%
Start:
CLS rgb(170,255,220)
print " Inc/Decreasing Combinations of k Elements out of N"
print " 0 for aufsteigende, 1 for absteigende Lexikalordnung?: ";:input dflg%
print " n = ";:input n%:print " k = ";:input s%
SetSize b%[],s%
s1:' Initialize

WhileLoop s%:b%[&Loop]=&Loop+n%-s%-1

    EndWhile :j%=1
    s2:' Show result ('Visit' = do something useful)

    Whileloop s%,1,-1

        if dflg%=0:print int(n%-1-b%[&Loop]);'increasing order

            else :print b%[&Loop];'decreasing order

        endif

    EndWhile

    case j%>s%:goto "Halt"' terminate if j>s
    print ",";:case %pos>(60-s%): print

    if %csrlin>20: WaitInput : cls : endif

        s3:' Decrease b(j)
        b%[j%]=b%[j%]-1

        if b%[j%]<j%

            j%=j%+1
            goto "S2"

        endif

        s4:' Reset b%[j%-1]

        while j%>1

            b%[j%-1]=b%[j%]-1
            j%=j%-1

        endwhile

        Goto "S2"
        hold:
        print:print " done. ";
        WaitInput
        Goto "Start"
        END
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
04/13/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

711 Views

Untitledvor 0 min.
N.Art07/23/21
Glubbfan06/19/21
Uwe ''Pascal'' Niemeier06/13/21
Walter04/25/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie