Article View: free.it.visual-basic
Article #3426Re: ordinamento
From: Sergio(R)
Date: Mon, 15 Jul 2002 20:23
Date: Mon, 15 Jul 2002 20:23
32 lines
2327 bytes
2327 bytes
On Mon, 15 Jul 2002 11:27:53 GMT, "lorenzo" <sirio32-togli il txt tra le
lineette se mi vuoi rispondere in pers-@iol.it> wrote:
>hai ragione, � ora che mi metta a studiare dall'inizio. Il sito � molto
>interessante lo consiglio a chiunque. � un peccato che non ci sia un
>capitolo sugli ordinamenti, mi sembra che a livello informatico sia uno dei
>crucci pi� tosti da affrontare, comunque grazie, partir� da li.
E' un problema piuttosto comune. Uno dei piu' veloci e' quello con
l'algoritmodi Metzner. Questa e' la versione in QB, se vuoi farlo con una
CALL, convertirlo e' abbastanza semplice.
REM ******************* Sort *********************************
N% = NumMax%: M% = Y% + 1
SRT001:
M% = INT(M% / 2): IF M% = 0 THEN RETURN
J% = 1: K% = N% - M%
SRT002:
IF J% > K% THEN GOTO SRT001
I% = J%
SRT003:
IF I% < 0 THEN GOTO SRT004
IF TABSOR$(I% + M%) < TABSOR$(I%) THEN GOTO SRT005
SRT004:
J% = J% + 1: GOTO SRT002
SRT005:
SWAP TABSOR$(I%), TABSOR$(I% + M%)
I% = I% - M%: GOTO SRT003
--
Ciao
Sergio�
Technical Details
Message-ID:
<qba6jughm6brec6ad3h2eubj5fbfu0mirb@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!twister1.libero.it.POSTED!not-for-mailReferences:
<iQyX8.71896$vm5.2619539@news2.tin.it> <m3QX8.30667$K_4.710864@twister1.libero.it> <qmuY8.79906$vm5.2917479@news2.tin.it> <_HwY8.41277$7N3.949074@twister2.libero.it> <ZkyY8.81216$vm5.2949830@news2.tin.it>Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII X-Google-Thread: f94ee,bb98a523e4be6de2 X-Google-Attributes: gidf94ee,public X-Google-ArrivalTime: 2002-07-15 13:24:58 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!twister1.libero.it.POSTED!not-for-mail From: "Sergio(R)" <sergio_digiorgi@tin.it> Newsgroups: free.it.visual-basic Subject: Re: ordinamento Reply-To: sergio.digiorgi@tin.it Message-ID: <qba6jughm6brec6ad3h2eubj5fbfu0mirb@4ax.com> References: <iQyX8.71896$vm5.2619539@news2.tin.it> <m3QX8.30667$K_4.710864@twister1.libero.it> <qmuY8.79906$vm5.2917479@news2.tin.it> <_HwY8.41277$7N3.949074@twister2.libero.it> <ZkyY8.81216$vm5.2949830@news2.tin.it> X-Newsreader: Forte Agent 1.9/32.560 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 32 Date: Mon, 15 Jul 2002 20:23:13 GMT NNTP-Posting-Host: 62.98.171.34 X-Complaints-To: abuse@inwind.it X-Trace: twister1.libero.it 1026764593 62.98.171.34 (Mon, 15 Jul 2002 22:23:13 MET DST) NNTP-Posting-Date: Mon, 15 Jul 2002 22:23:13 MET DST Organization: [Infostrada]