Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Cobol/Test-Suite/SQL P/dml100-186/     Datei vom 4.1.2008 mit Größe 11 kB image not shown  

Quellcode-Bibliothek binsearch.cob   Sprache: Cobol

 
       Identification Division.
       Program-Id. binsearch.
       Author. Marie-Lautre Potet.
      * aus "Cours Semantique et analyse
      * de programmes"  
      * Verimag-Projekt Grenoble, France  
       Data Division.
       Working-Storage Section.
          77 k    pic S9(8).
          77 u    pic S9(8).
          77 m    pic S9(8).
       Linkage Section.
          01 t    pic S9(8) usage is pointer.
          01 n    pic S9(8).
          01 v    pic S9(8).
          01 ret  pic S9(8).
       Procedure Division using t, n, v returning ret.
         move 0 to k
         subtract 1 from n giving u
         perform until k>u
           compute m=k+(u-k)/2
      *   m elment 0..n-1
           if (t(m)<v)
             add m 1 giving k
           else if t(m)>v then
             subtract 1 from m giving u
           else 
            move m to ret
            stop run
           end-if end-if 
         end-perform.
         move -1 to ret
      * ((0<=res<n and t(res)=v) or 
      * (res=-1 and (forall i.0<=i<n =>
      * t(i) not equal v)) and t'=t
      * and n'=n and v'=v 
       End-Program binsearch.

Messung V0.5
C=79 H=97 G=88

¤ 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.0.13Bemerkung:  (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 und die Messung sind noch experimentell.