aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/BBTREE.pht
blob: 2effaf85530d8fe34bcca8ef2c30e39d670a5793 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
\begin{patch}{BalancedBinaryTreeXmpPagePatch1}
\begin{paste}{BalancedBinaryTreeXmpPageFull1}{BalancedBinaryTreeXmpPageEmpty1}
\pastebutton{BalancedBinaryTreeXmpPageFull1}{\hidepaste}
\tab{5}\spadcommand{lm := [3,5,7,11]\bound{lm }}
\indentrel{3}\begin{verbatim}
   (1)  [3,5,7,11]
                             Type: List PositiveInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty1}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty1}{BalancedBinaryTreeXmpPagePatch1}
\pastebutton{BalancedBinaryTreeXmpPageEmpty1}{\showpaste}
\tab{5}\spadcommand{lm := [3,5,7,11]\bound{lm }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch2}
\begin{paste}{BalancedBinaryTreeXmpPageFull2}{BalancedBinaryTreeXmpPageEmpty2}
\pastebutton{BalancedBinaryTreeXmpPageFull2}{\hidepaste}
\tab{5}\spadcommand{modTree(12,lm)\free{lm }}
\indentrel{3}\begin{verbatim}
   (2)  [0,2,5,1]
                                     Type: List Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty2}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty2}{BalancedBinaryTreeXmpPagePatch2}
\pastebutton{BalancedBinaryTreeXmpPageEmpty2}{\showpaste}
\tab{5}\spadcommand{modTree(12,lm)\free{lm }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch3}
\begin{paste}{BalancedBinaryTreeXmpPageFull3}{BalancedBinaryTreeXmpPageEmpty3}
\pastebutton{BalancedBinaryTreeXmpPageFull3}{\hidepaste}
\tab{5}\spadcommand{t := balancedBinaryTree(\#lm, 0)\bound{t }\free{lm }}
\indentrel{3}\begin{verbatim}
   (3)  [[0,0,0],0,[0,0,0]]
            Type: BalancedBinaryTree NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty3}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty3}{BalancedBinaryTreeXmpPagePatch3}
\pastebutton{BalancedBinaryTreeXmpPageEmpty3}{\showpaste}
\tab{5}\spadcommand{t := balancedBinaryTree(\#lm, 0)\bound{t }\free{lm }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch4}
\begin{paste}{BalancedBinaryTreeXmpPageFull4}{BalancedBinaryTreeXmpPageEmpty4}
\pastebutton{BalancedBinaryTreeXmpPageFull4}{\hidepaste}
\tab{5}\spadcommand{setleaves!(t,lm)\bound{t1 }\free{t }}
\indentrel{3}\begin{verbatim}
   (4)  [[3,0,5],0,[7,0,11]]
            Type: BalancedBinaryTree NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty4}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty4}{BalancedBinaryTreeXmpPagePatch4}
\pastebutton{BalancedBinaryTreeXmpPageEmpty4}{\showpaste}
\tab{5}\spadcommand{setleaves!(t,lm)\bound{t1 }\free{t }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch5}
\begin{paste}{BalancedBinaryTreeXmpPageFull5}{BalancedBinaryTreeXmpPageEmpty5}
\pastebutton{BalancedBinaryTreeXmpPageFull5}{\hidepaste}
\tab{5}\spadcommand{mapUp!(t,_*)\bound{t2 }\free{t1 }}
\indentrel{3}\begin{verbatim}
   (5)  1155
                                  Type: PositiveInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty5}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty5}{BalancedBinaryTreeXmpPagePatch5}
\pastebutton{BalancedBinaryTreeXmpPageEmpty5}{\showpaste}
\tab{5}\spadcommand{mapUp!(t,_*)\bound{t2 }\free{t1 }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch6}
\begin{paste}{BalancedBinaryTreeXmpPageFull6}{BalancedBinaryTreeXmpPageEmpty6}
\pastebutton{BalancedBinaryTreeXmpPageFull6}{\hidepaste}
\tab{5}\spadcommand{t\bound{t3 }\free{t2 }}
\indentrel{3}\begin{verbatim}
   (6)  [[3,15,5],1155,[7,77,11]]
            Type: BalancedBinaryTree NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty6}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty6}{BalancedBinaryTreeXmpPagePatch6}
\pastebutton{BalancedBinaryTreeXmpPageEmpty6}{\showpaste}
\tab{5}\spadcommand{t\bound{t3 }\free{t2 }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch7}
\begin{paste}{BalancedBinaryTreeXmpPageFull7}{BalancedBinaryTreeXmpPageEmpty7}
\pastebutton{BalancedBinaryTreeXmpPageFull7}{\hidepaste}
\tab{5}\spadcommand{mapDown!(t,12,_rem)\bound{t4 }\free{t3 }}
\indentrel{3}\begin{verbatim}
   (7)  [[0,12,2],12,[5,12,1]]
            Type: BalancedBinaryTree NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty7}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty7}{BalancedBinaryTreeXmpPagePatch7}
\pastebutton{BalancedBinaryTreeXmpPageEmpty7}{\showpaste}
\tab{5}\spadcommand{mapDown!(t,12,_rem)\bound{t4 }\free{t3 }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch8}
\begin{paste}{BalancedBinaryTreeXmpPageFull8}{BalancedBinaryTreeXmpPageEmpty8}
\pastebutton{BalancedBinaryTreeXmpPageFull8}{\hidepaste}
\tab{5}\spadcommand{leaves \%\bound{t5 }\free{t4 }}
\indentrel{3}\begin{verbatim}
   (8)  [0,2,5,1]
                          Type: List NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty8}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty8}{BalancedBinaryTreeXmpPagePatch8}
\pastebutton{BalancedBinaryTreeXmpPageEmpty8}{\showpaste}
\tab{5}\spadcommand{leaves \%\bound{t5 }\free{t4 }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch9}
\begin{paste}{BalancedBinaryTreeXmpPageFull9}{BalancedBinaryTreeXmpPageEmpty9}
\pastebutton{BalancedBinaryTreeXmpPageFull9}{\hidepaste}
\tab{5}\spadcommand{squares := [x**2 rem m for x in \% for m in lm]\bound{t6 }\free{t5 }}
\indentrel{3}\begin{verbatim}
   (9)  [0,4,4,1]
                          Type: List NonNegativeInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty9}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty9}{BalancedBinaryTreeXmpPagePatch9}
\pastebutton{BalancedBinaryTreeXmpPageEmpty9}{\showpaste}
\tab{5}\spadcommand{squares := [x**2 rem m for x in \% for m in lm]\bound{t6 }\free{t5 }}
\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPagePatch10}
\begin{paste}{BalancedBinaryTreeXmpPageFull10}{BalancedBinaryTreeXmpPageEmpty10}
\pastebutton{BalancedBinaryTreeXmpPageFull10}{\hidepaste}
\tab{5}\spadcommand{chineseRemainder(\%,lm)\free{t6 }}
\indentrel{3}\begin{verbatim}
   (10)  144
                                  Type: PositiveInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{BalancedBinaryTreeXmpPageEmpty10}
\begin{paste}{BalancedBinaryTreeXmpPageEmpty10}{BalancedBinaryTreeXmpPagePatch10}
\pastebutton{BalancedBinaryTreeXmpPageEmpty10}{\showpaste}
\tab{5}\spadcommand{chineseRemainder(\%,lm)\free{t6 }}
\end{paste}\end{patch}