/*internal method to perform top-down splay the last accessed node becomes the new root this method may be overridden to use different splaying algorithmhoweverthe splay tree code depends on the accessed item going to the root is the target item to splay around is the root of the subtree to splay *void splayconst comparable xbinarynode binarynode *lefttreemax*righttreeminstatic binarynode headerheader left header right nullnodelefttreemax righttreemin &headernullnode->element /guarantee match forifx element ifx left->element rotatewithleftchildt )ift->left =nullnode break/link right righttreemin->left trighttreemin tt ->leftelse ift->element ift->right->element rotatewithrightchildt )ift->right =nullnode break/link left lefttreemax->right tlefttreemax tt ->rightelse breaklefttreemax->right ->leftrighttreemin->left ->rightt->left header rightt->right header leftfigure top-down splaying method