1 / 7

FOR i := 0...N-1 DO summa := summa + A[i] tulo := tulo * A[i] ENDFOR

FOR i := 0...N-1 DO summa := summa + A[i] tulo := tulo * A[i] ENDFOR. FOR i := 1 ... N DO FOR j:= 0 ... N-1 DO maara := maara + 1 ENDFOR ENDFOR. FOR i := 0 ... N DO A[i] := 0 ENDFOR FOR i := 0 ... N-1 DO FOR j:= 1 ... N DO A[i] := A[i] + j * i ENDFOR ENDFOR.

faunia
Download Presentation

FOR i := 0...N-1 DO summa := summa + A[i] tulo := tulo * A[i] ENDFOR

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FOR i := 0...N-1 DO summa := summa + A[i] tulo := tulo * A[i] ENDFOR

  2. FOR i := 1 ... N DO FOR j:= 0 ... N-1 DO maara := maara + 1 ENDFOR ENDFOR

  3. FOR i := 0 ... N DO A[i] := 0 ENDFOR FOR i := 0 ... N-1 DO FOR j:= 1 ... N DO A[i] := A[i] + j * i ENDFOR ENDFOR

  4. FOR i := 1 ... N DO IF i mod 2 = 0 THEN osam := i / 2 taulu[i] := osam ELSE taulu[i] := i ENDIF ENDFOR

  5. MODULE kertoma (n) returns n:n kertoma IF n <= 1 THEN RETURN 1 ELSE RETURN n * kertoma(n-1) ENDIF ENDMODULE

  6. MODULE haku(A[], x, N) RETURNS indeksi alku := 0 loppu := N-1 WHILE alku <= loppu DO keski := (alku + loppu) / 2 IF A[keski] < x THEN alku := keski + 1 ELSE IF A[keski] > x THEN loppu := keski – 1 ELSE RETURN keski ENDIF ENDIF ENDWHILE ENDMODULE

  7. MODULE fib(N) RETURNS N:s fibonacci IF N <=1 THEN RETURN 1 ELSE RETURN fib(N-1) + fib(N-2) ENDIF ENDMODULE

More Related