Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test30
program test29; {pointer example of direct chain growth, key inf change and binary trees} type tree=^top; top=record inf:char ; left, right:tree end ; var l:tree; procedure sostavlenie2(var d:tree; element:char) ;{recursive procedure} begin if d=Nil then begin New(d) ; d^.inf:=element ; d^.left:=Nil ; d^.right:=Nil ; end else if element< d^.inf then sostavlenie2(d^.left,element) else sostavlenie2(d^.right,element) end ; function branch_search(d:tree;element:char):boolean ;{recursive function} begin if d=Nil then branch_search:=false else if d^.inf=element then branch_search:=true else if element<d^.inf then branch_search:=branch_search(d^.left, element) else branch_search:=branch_search(d^.right, element) end; begin sostavlenie2(l, 'c') ;{enrich the binary tree with element 'a'} sostavlenie2(l, 'm') ;{enrich the binary tree with element 'b'} sostavlenie2(l, 'b') ;{enrich the binary tree with element 'c'} writeln(branch_search(l,'j'));{answer - does the element 'a' present in the binary tree? TRUE} end.
run
|
edit
|
history
|
help
0
test01
imprimir_numeros_hasta_N
Enkripsi2
formato_real
3
0
звёздное небо и подсчёт кратных звёзд
Laima
Сумма пар чисел кратных и некратных 11
Banyaknya huruf vokal