From ba29af551d7cf5c21a418da6e30617e39ae0f09b Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Wed, 12 Feb 2014 12:06:44 +0100 Subject: [PATCH] polinoml - postaviclan - reorganizovan redosled ispitivanja --- kodovi/polinomi/POLINOML.MOD | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/kodovi/polinomi/POLINOML.MOD b/kodovi/polinomi/POLINOML.MOD index 6de5165..4bc9ce6 100644 --- a/kodovi/polinomi/POLINOML.MOD +++ b/kodovi/polinomi/POLINOML.MOD @@ -83,36 +83,35 @@ BEGIN prethodni := cilj; cilj := cilj^.veza; END; - IF cilj = NIL THEN - IF k#0.0 THEN + (* da li upisujemo vrednost ili sklanjamo clan *) + IF k#0.0 THEN + (* da li menjamo clan ili pravimo novi *) + IF (cilj # NIL) AND (cilj^.st = st) THEN + cilj^.k:=k; + ELSE NEW(cilj); cilj^.k := k; cilj^.st := st; cilj^.veza := NIL; IF p = NIL THEN p := cilj; + ELSIF prethodni = NIL THEN + cilj^.veza := p^.veza; + p := cilj; ELSE + cilj^.veza := prethodni^.veza; prethodni^.veza := cilj; END; END; - ELSIF cilj^.st=st THEN - IF k # 0.0 THEN - cilj^.k:=k; - ELSE + ELSE + (* da li postoji ovakav clan *) + IF (cilj # NIL) AND (cilj^.st = st) THEN IF p = cilj THEN p := p^.veza; ELSE prethodni^.veza:= prethodni^.veza^.veza; END; - DISPOSE(cilj); - END; - ELSE - IF k # 0.0 THEN - NEW(cilj); - cilj^.k := k; - cilj^.st := st; - cilj^.veza := prethodni^.veza; - prethodni^.veza := cilj; + DISPOSE(cilj); END; END; END PostaviClan; -- 2.25.1