Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {procedure AddElementInList(var Prev: TPointer; Data: Integer);
- var
- Temp: TPointer;
- begin
- New(Temp);
- Temp^.Data := Data;
- Temp^.Next := nil;
- Prev^.Next := Temp;
- end;}
- {function CopyList(Start: TPointer): TPointer;
- var
- NewStart, Curr, NewElement: TPointer;
- begin
- New(Curr);
- New(NewElement);
- New(NewStart);
- Curr := Start^.Next^.Next;
- NewStart^.Next := NewElement;
- NewElement^.Data := Start^.Next^.Data;
- while (Curr <> nil) do
- begin
- AddElementInList(NewElement, Curr^.Data);
- NewElement := NewElement^.Next;
- Curr := Curr^.Next;
- end;
- CopyList := NewStart;
- end;}
- {function ReplaceElements(var PrevElem: TPointer; NextElem: TPointer; Data: Integer): TPointer;
- var
- Temp: TPointer;
- begin
- New(Temp);
- Temp^.Data := Data;
- PrevElem^.Next := Temp;
- Temp^.Next := NextElem;
- ReplaceElements := Temp;
- end;}
- {function ChangeList(Start: TPointer): TPointer;
- var
- Temp, Current, NewStart, NewElement: TPointer;
- NewData: Integer;
- begin
- New(NewStart);
- NewStart := CopyList(Start);
- New(NewElement);
- Current := Start^.Next;
- NewElement := NewStart^.Next;
- while (Current <> nil) do
- begin
- Temp := Start^.Next;
- NewData := Start^.Next^.Data;
- while (Temp <> Current) do
- begin
- NewElement := ReplaceElements(NewElement, NewElement^.Next, NewData);
- Temp := Temp^.Next;
- if (Temp <> Current) then
- NewData := Temp^.Data;
- end;
- Current := Current^.Next;
- NewElement := NewElement^.Next;
- end;
- ChangeList := NewStart;
- end;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement