English
Source / code snippets

Lexikalisch aufsteigende Permutation eingegebener Strings: "Knuth-Shuffle"

 

p.specht


Window Title "Lexikographisch aufsteigende Permutation eingegebener Worte"
' (F) P. woodpecker 2011, V1.02beta in XProfan11.2a free, without Gewähr!
Declare t$,t$[],n&,k&,j&,u&,v&,e%,z&,q$

WHILE 1:CLS:e%=1:z&=0:q$=" "

    print " Info: really ALLE Permutationen go here only then supplied, wenn"
    print " The items To Beginn in lexikalisch aufsteigender follow indicated go!    "
    print "Example: 1|3|3|4|4.. or Alfons Berta Charly Emil Gustav"
    print " input the items Please with space or | as Trenner:\n"
    input t$:print:t$=trim$(t $):t$=translate $(t$,"  "," "):case instr("|",t$):q$="|"
    t$=translate $(t$," ","|"):t$[]=explode(t$,"|"):n&=SizeOf(t $[])
    print "--- Start ex the angegebenen Lexikal-Permutation ---"

    While e%

        inc z&
        casenot q$="|":print " ";

        WhileLoop n&

            print t$[&Loop-1];:case &Loop=n&:continue
            print q$;

        EndWhile

        print

        if n&<2:e%=0:break:endif

            k&=n&-2

            While t$[k&]>=t $[k&+1]

                Dec k&
                case k&<0:break

            EndWhile

            if k&<0:e%=0:break:endif

                j&=n&-1

                While t$[j&]<=t $[k&]

                    dec j&

                EndWhile

                t$=t $[k&]:t$[k&]=t $[j&]:t$[j&]=t$
                u&=k&+1:v&=n&-1

                While u&<v&

                    t$=t $[u&]:t$[u&]=t $[v&]:t$[v&]=t$
                    inc u&:dec v&

                EndWhile

            EndWhile

            print "-------------- spent Lines:",z&,"-----------------"
            WAITINPUT

        ENDWHILE

        END
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
04/11/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

605 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