Tree Algorhtims in Scheme

Tree is an abstract data structure. In scheme, it is mainly inplemented by using struct.

Binary Tree is mainly discussed here.

Difination

Using define-struct to define a Binary Tree.

;;Definition of tree structure:
;;A tree-node structure is
;;1, false, which means there is nothing in the tree, or
;;2, (make-node (s n lc rc), where s is number, n is symbol
;;   and lc, rc tree-node. 
(define-struct node (ssn name left right))

Operations on Binary Trees

Contains?

To determine whether a node is contained by a b-tree. codereveal hidden content

 
sci/cs/scheme/tree.txt · Last modified: 2006/06/22 01:20 by flanker27
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki