class Stack
instance variables
stack : seq of int := [];
operations
public
Reset : () ==> ()
Reset () ==
stack := [];
public
Pop : () ==> int
Pop() ==
def res = hd stack in
(stack := tl stack;
return res)
pre stack <> []
post stack~ = [RESULT]^stack;
public Push: int ==> ()
Push(elem) ==
stack := stack ^[elem];
public
Top : () ==> int
Top() ==
return (hd stack);
end Stack
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet)
¤
|
schauen Sie vor die Tür
Fenster
Die Firma ist wie angegeben erreichbar.
Die farbliche Syntaxdarstellung ist noch experimentell.
|