Na podstawie:
Kod: Zaznacz cały
type lista=^element;
element=record
pole: integer;
next :lista
end;
head to wskaźnik do początku listy h.
Kod: Zaznacz cały
procedure porzadek (h:lista)
var
u:lista;
begin
h:=head;
while h^.next<>nil do
begin
if h^.next^.pole mod 2=0 then
h:=h^.next
else
begin
u:=h^next;
h^.next:=u^.next;
u^.next:=head;
head:=u;
h:=h^.next;
end;
end;
end.