aboutsummaryrefslogtreecommitdiff
path: root/src/input/bstree.input.pamphlet
blob: 2a190caf67ae3adf205f4522c2af78895514a1eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input BSTREE.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
<<*>>=


-- Input generated from BinarySearchTreeXmpPage
)clear all

lv := [8,3,5,4,6,2,1,5,7]
t := binarySearchTree lv
emptybst := empty()$BSTREE(INT)
t1 := insert!(8,emptybst)
insert!(3,t1)
leaves t
split(3,t)
insertRoot: (INT,BSTREE INT) -> BSTREE INT
insertRoot(x, t) ==
    a := split(x, t)
    node(a.less, x, a.greater)
buildFromRoot ls == reduce(insertRoot,ls,emptybst)
rt := buildFromRoot reverse lv
(t = rt)@Boolean
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}