xanadu - btree
This commit is contained in:
parent
e69708fefd
commit
3c9770e9d1
|
@ -94,9 +94,9 @@
|
||||||
((cond ((>= i (- len 1));;last node
|
((cond ((>= i (- len 1));;last node
|
||||||
(do ((j 0 (+ j 1)))
|
(do ((j 0 (+ j 1)))
|
||||||
((= j len) (display "node not found.") 0)
|
((= j len) (display "node not found.") 0)
|
||||||
(add-rec str (vector-ref j tree))))
|
(search-rec str (vector-ref j tree))))
|
||||||
((and (string<? str (vector-ref tree i))
|
((and (string<? str (((vector-ref tree i)'get-data)))
|
||||||
(string>? str (vector-ref tree (+ i 1))))
|
(string>? str (((vector-ref tree (+ i 1))'get-data))))
|
||||||
(display "node not found in tree.") 0)
|
(display "node not found in tree.") 0)
|
||||||
((string=? str (vector-ref tree i))
|
((string=? str (vector-ref tree i))
|
||||||
(display "string found in tree.") str)
|
(display "string found in tree.") str)
|
||||||
|
@ -123,9 +123,7 @@
|
||||||
)))
|
)))
|
||||||
((string=? str (vector-ref tree i))
|
((string=? str (vector-ref tree i))
|
||||||
(set! i (vector-length tree)))
|
(set! i (vector-length tree)))
|
||||||
(else (display "never reached."))))
|
(else (display "never reached.")))))
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
||||||
(define (add str)
|
(define (add str)
|
||||||
(add-rec *tree))
|
(add-rec *tree))
|
||||||
|
|
Loading…
Reference in New Issue