| |
|
|
p.specht
| there's gefinkelte Such- and Sortieralgorithmen, The next to simple Suchvektoren too The contents the Datenfelder self respect. If a man z.B. one telephonedirectory aufschlägt for a word with "Z..." to search, becomes it presumably not in front, not center, sonder sooner far hinten to search begin. Algorithms How z.B. "FastSearch" meet in XProfan but on two Problems: differently as in C++ or in Assembler can Strings not rasch and simply as Zahlenwerte read go. The second problem position thereby too the in PCs used "verkehrte" INTEL-Zahlenformat dar. likes his, that it there Tricks gives, The me not yet famous are. In preparation for Fastsearch-Algorithmus (for vorsortierte, gleichverteilte Files) have I me einstweilen folgendermaßen beholfen:
Window Title "Distanzen between String-Anfängen (first 4 characters) detect."
'(DW) Demoware/Testware 2015-01 by P.woodpecker, Wien (AT); without each Gewähr!
Window Style 24:Window 0,0-%maxx,%maxy-40:randomize
var n&=40
declare stra$[n&-1],tmp$,i&,j&,vec&,su$,tmp&
print "\n your Basiswort (z.B. 1-4 characters their Vornamens) Please: ";
input su$:su$=lower$(su$)
print "\n Generierung of ";n&;" alphabetical Zufalls-Strings the length [1..8], ... ";
whileloop 0,n&-1:tmp$="":whileloop 1+rnd(6):tmp$=tmp$+chr $(97+rnd(26))
endwhile :stra$[&Loop]=tmp$:endwhile
Print "\n The order Überprüfbarkeit now to Stringdistanzwerten sortiert go."
whileloop 0,n&-1:i&=&Loop
whileloop 0,n&-1:j&=&Loop
if ASC4(stra$[i&]) < ASC4(stra$[j&])' if stra$[i&] < stra$[j&] 'Sort-Test
tmp$=stra$[i&]:stra$[i&]=stra$[j&]:stra$[j&]=tmp$
endif
endwhile
endwhile
' spending:
whileloop 0,n&-1:j&=&Loop
print tab(3);chr $(34)+stra$[j&]+chr $(34);\
tab(14);" is of ";chr $(34)+su$+chr $(34);tab(35);st$(int( ASC4(stra$[j&])-ASC4(su$)));\
tab(50);" possible 4-chain removes."
endwhile
waitinput
end
proc ASC4 :parameters x$
'Stringwert the first four ASCII-characters ermittlen (fit in a Long-Variable)
declare x&',xl&:xl&=if(len(x$)<4,len(x$),4)
select if(len(x$)<4,len(x$),4)
caseof 0:x&=0
caseof 1:x&=byte(addr(x$),0)<<23
caseof 2:x&=byte(addr(x$),1)<<15 | byte(addr(x$),0)<<23
caseof 3:x&=byte(addr(x$),2)<<7 | byte(addr(x$),1)<<15 | byte(addr(x$),0)<<23
caseof 4:x&=byte(addr(x$),3)>>1 | byte(addr(x$),2)<<7 | byte(addr(x$),1)<<15 | byte(addr(x$),0)<<23
otherwise :print "select error"
endselect :return x&
endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/12/21 ▲ |
|
|
|