[funds-cvs] r118 - trunk/funds/src/trees

abaine at common-lisp.net abaine at common-lisp.net
Sat Aug 4 14:18:29 UTC 2007


Author: abaine
Date: Sat Aug  4 10:18:29 2007
New Revision: 118

Modified:
   trunk/funds/src/trees/avl.lisp
Log:
Moved stitch-avl-tree to stitch-tree file.

Modified: trunk/funds/src/trees/avl.lisp
==============================================================================
--- trunk/funds/src/trees/avl.lisp	(original)
+++ trunk/funds/src/trees/avl.lisp	Sat Aug  4 10:18:29 2007
@@ -34,7 +34,7 @@
   (< -2 (height-difference t1 t2) 2))
 
 (defun balance (key value left right)
-  (let ((height-difference (- (tree-height left) (tree-height right))))
+  (let ((height-difference (height-difference left right)))
     (if (< -2 height-difference 2)
 	(stitch-avl-tree :key key :value value :left left :right right)
 	(let* ((heavy-side (if (plusp height-difference) :left :right))
@@ -60,9 +60,3 @@
 		      side new-inside
 		      (other-side side) new-outside)))
 
-(defun stitch-avl-tree (&key root (key (bt-key root)) (value (bt-value root))
-			 (left (make-avl-leaf)) (right (make-avl-leaf)))
-  (make-instance 'avl-tree
-		 :key key :value value
-		 :left left :right right
-		 :height (parent-height left right)))



More information about the Funds-cvs mailing list