Author: abaine Date: Wed Jun 20 12:37:53 2007 New Revision: 29
Modified: trunk/funds/src/trees/avl-tree.lisp Log: Changed left-insert and right-insert to provide for test and order arguments.
Modified: trunk/funds/src/trees/avl-tree.lisp ============================================================================== --- trunk/funds/src/trees/avl-tree.lisp (original) +++ trunk/funds/src/trees/avl-tree.lisp Wed Jun 20 12:37:53 2007 @@ -29,14 +29,14 @@ :value value :left (avl-left tree) :right (avl-right tree))) - ((funcall order key (avl-key tree)) (left-insert tree key value)) - (t (right-insert tree key value)))) + ((funcall order key (avl-key tree)) (left-insert tree key value test order)) + (t (right-insert tree key value test order))))
-(defun left-insert (tree key value) +(defun left-insert (tree key value test order) "The AVL tree that results when the given key-value pair is inserted into left sub-tree of the given AVL tree. Only non-empty avl-trees should be supplied as arguments." - (let ((left (avl-insert (avl-left tree) key value)) + (let ((left (avl-insert (avl-left tree) key value :test test :order order)) (right (avl-right tree))) (if (imbalanced left right) (if (left-heavy left) @@ -52,11 +52,11 @@ :left left :right right))))
-(defun right-insert (tree key value) +(defun right-insert (tree key value test order) "The AVL tree that results when the given key-value pair is inserted into the right sub-tree of the given AVL tree. Only non-empty avl-trees should be supplied as the tree argument." - (let ((right (avl-insert (avl-right tree) key value)) + (let ((right (avl-insert (avl-right tree) key value :test test :order order)) (left (avl-left tree))) (if (imbalanced left right) (if (right-heavy right)