Splay Tree insert / delete can be done in different ways . One popular way is to insert the key and splay it to the root . But there is also a different approach that I've read about , the idea is to split it into 2 trees such that the left one has values <= the insert key and the right one has value > the insert key . Same goes for the alternate delete approach , the key to be deleted is splayed to the root and then the left and right tree is merged .
But the way I understand ,
- If the insertion is in increasing order , splitting the tree would always cause the right tree to be null , thus increasing the imbalance every time any key is inserted in this order .
- Same goes for the deletion , if we always delete the maximum element in a tree , in the merge operation the right subtree will be empty . And there is a huge imbalance .
My question is that , in this alternate process , is the amortized running time also stays O(logN) ? If so , how ? I tried searching over the internet but couldn't find any answer . Any kind of intuition would be really helpful :)