Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Волкович Максим (volkovcih.maksim.s@gmail.com), 112гр., v1.0,
- рекурсивно подсчитать число вершин с одной исходящей ветвью}
- function count(t:tree):integer;
- begin
- if t<>nil then do
- begin
- if (t^.left<>nil) and (t^.right=nil) then
- count:=1+count(t^.left);
- if (t^.left=nil) and (t^.right<>nil) then
- count:=1+count(t^.right);
- if (t^.left<>nil) and (t^.right<>nil) then count:=count(t^.left)+count(t^.right);
- end
- else count:=0;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement