Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Sedgewick-Algorithmen/   (Columbo Version 0.7©)  Datei vom 4.1.2008 mit Größe 1 kB image not shown  

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.
  

98%


¤ Dauer der Verarbeitung: 0.6 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.