Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:tree_displaying [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Tree displaying ======
 +{{tag>​trees}}
 +===== Description =====
 +Displaying a binary tree.
 +
 +**Source**: ​ PROLOG programming for artificial intelligence,​ 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.
 +===== Download =====
 +Program source code: {{tree_displaying.pl}}
 +===== Listing =====
 +<code prolog>
 +% Figure 9.17  Displaying a binary tree.
 +
 +
 +% show( Tree): display binary tree
 +
 +show( Tree)  :-
 +  show2( Tree, 0).
 +
 +% show2( Tree, Indent): display Tree indented by Indent
 +
 +show2( nil, _).
 +
 +show2( t( Left, X, Right), Indent) ​ :-
 +  Ind2 is Indent + 2,                 % Indentation of subtrees
 +  show2( Right, Ind2), ​               % Display right subtree
 +  tab( Indent), write( X), nl,        % Write root
 +  show2( Left, Ind2). ​                % Display left subtree
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/tree_displaying.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0