trees class linkedbinarytree(binarytree) """linked representation of binary tree structure "" lightweightnonpublic class for storing node class nodeslots _element _parent _left _right def init (selfelementparent=noneleft=noneright=none) self element element self parent parent self left left self right right class position(binarytree position) """an abstraction representing the location of single element "" def init (selfcontainernode) """constructor should not be invoked by user "" self container container self node node def element(self) """return the element stored at this position "" return self node element def eq (selfother) """return true if other is position representing the same location "" return type(otheris type(selfand other node is self node def validate(selfp) """return associated nodeif position is valid "" if not isinstance(pself position) raise typeerrorp must be proper position type if container is not self raise valueerrorp does not belong to this container convention for deprecated nodes if node parent is node raise valueerrorp is no longer valid return node def make position(selfnode) """return position instance for given node (or none if no node"" return self position(selfnodeif node is not none else none code fragment the beginning of our linkedbinarytree class (continued in code fragments through