Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Marie-Laure Potet/   (verschiedene Autoren Version 0.7©)  Datei vom 3.4.2011 mit Größe 1 kB image not shown  

Quelle  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(8usage 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 in Prozent
C=79 H=97 G=88

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-06-14) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.