Data update

This commit is contained in:
Ingy döt Net 2024-07-13 15:19:22 -07:00
parent 29a5eea0d4
commit 5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions

View file

@ -0,0 +1,33 @@
type Node<T> = auto class
data: T;
prev,next: Node<T>;
end;
type
MyLinkedList<T> = class
first, last: Node<T>;
procedure AddLast(x: T);
begin
if first = nil then
begin
first := new Node<T>(x,nil,nil);
last := first
end
else
begin
var p := new Node<T>(x,last,nil);
last.next := p;
last := p;
end;
end;
procedure AddAfter(p: Node<T>; x: T);
begin
if last = p then
AddLast(x)
else begin
var pp := new Node<T>(x,p,p.next);
p.next := pp;
pp.prev.next := pp;
end
end;
end;