when to splay the rules that dictate when splaying is performed are as followswhen searching for key kif is found at position pwe splay pelse we splay the leaf position at which the search terminates unsuccessfully for examplethe splaying in figures and would be performed after searching successfully for key or unsuccessfully for key when inserting key kwe splay the newly created internal node where gets inserted for examplethe splaying in figures and would be performed if were the newly inserted key we show sequence of insertions in splay tree in figure ( ( ( ( ( ( (gfigure sequence of insertions in splay tree(ainitial tree(bafter inserting but before zig step(cafter splaying(dafter inserting but before zig-zag step(eafter splaying( after inserting but before zig-zig step(gafter splaying