1 2 3 4 5 6 7 8 9 10 11 12 13
import binarytree; picture pic,pic2; binarytree bt=binarytree(1,2,4,nil,5,nil,nil,0,nil,nil,3,6,nil,nil,7); draw(pic,bt); binarytree st=searchtree(10,5,2,1,3,4,7,6,8,9,15,13,12,11,14,17,16,18,19); draw(pic2,st,blue); add(pic.fit(),(0,0),10N); add(pic2.fit(),(0,0),10S);