Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by Petter ( 14 years ago )
datatype ball = Void | Bt of int*ball*ball ;
val Balltree =(Bt(3,Bt(1,Bt(0,Void,Void),Bt(2,Void,Void)),Bt(7,Bt(5,Bt(4,Void,Void),Bt(6,Void,Void)),Bt(8,Void,Void))));
fun preorder Void = []
| preorder (Bt(r,L,R)) = r ::(preorder L ) @ (preorder R);
fun compare (Void,st) = st
| compare (Bt(r,L1,R1),st) = Bt(r,L1,compare(R1,st));
fun delete (Void,k) = Void
| delete (Bt(r,L,R),k) = if r = k then
compare(L,R)
else
Bt(r,delete(L,k),delete(R,k));
Revise this Paste