Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sp2014e4
//fpc 2.6.2 program HelloWorld; type Lista = ^Celda; Celda = record dato: integer; sig: Lista; end; procedure insertarOrdenado (elem: integer; var list: Lista); var actual, anterior, nuevo : Lista; begin if list=nil then begin new(list); list^.dato:=elem; list^.sig:=nil; end else begin actual:=list; anterior:=nil; while (actual<>nil) and (actual^.dato<=elem) do begin anterior:=actual; actual:=actual^.sig; end; new(nuevo); nuevo^.dato:=elem; nuevo^.sig:=actual; if anterior = nil then list:=nuevo else anterior^.sig:=nuevo; end; end; var list : lista; begin list:=nil; new(list); new(list^.sig); new(list^.sig^.sig); list^.dato:=1; list^.sig^.dato:=3; list^.sig^.sig^.dato:=6; insertarOrdenado(4,list); //writeln(list^.dato); writeln(list^.dato,',',list^.sig^.dato,',',list^.sig^.sig^.dato,',',list^.sig^.sig^.sig^.dato); end.
run
|
edit
|
history
|
help
0
jhjj
NOT a String in Pascal
Unicorn
test25
jose messias de oliveira 600623130
Исправленный NOD без массивов и алгоритма Евклида
1
Поиск вершин в горах
Calculatrice 1.0
TanTai11A2@