Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  quicksort.cob   Sprache: Cobol

 

       Identification Division.
       Program-Id. quicksort is recursive.
       author. Robert Sedgewick.
      * Quicksort
      * aus Algorithmen p148 
       Data Division.
       Working-Storage Section.
         78 N           value 1000.
         77 v     pic 9(4).
         77 t     pic 9(4).
         77 i     pic 9(4).
         77 j     pic 9(4).
       Linkage Section.
         01 a     pic 9(1) occurs N.
         77 l     pic 9(4).
         77 r     pic 9(4).
       Procedure Division using a l r.
        if r>1 then
          move a(r) to v
          subtract 1 from l giving i
          move r to j
          Move 0 to a(1)
          Perform until j<=i
                  with test after
            Perform until a(i)>=v
                    with test after
              add 1 to i
            end-perform
            Perform until a(j)<=v
                    with test after
              subtract 1 from j
            end-perform
            move a(i) to t
            move a(j) to a(i)
            move t to a(j)
          end-perform  
          move a(i) to a(j)
          move a(r) to a(i)
          move t to a(r)
          subtract 1 from i giving t
          call quicksort using a i t
          add 1 to i giving t
          call quicksort using a t r
        end-if  
       End-Program quicksort.
  

Messung
CHZG
869710094

¤ Dauer der Verarbeitung: 0.7 Sekunden  ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,835
#Domains=906,746