Given a tree image of the tree

To search for value 1, I do the following splay operations:

i) Zag on 7 zag_1

ii) Zag on 1 zag_2

And hence obtain 1 in the root. But why would this be incorrect?

i) Zag on 1 zag_1

ii) Zag on 1 zag_2

The final tree in this case is different.

  • $\begingroup$ Are the first two operations your attempt, and you're asking why it's wrong? Or are you comparing two different sequences of operations and asking why they don't give the same answer? $\endgroup$
    – 6005
    Sep 17 '20 at 14:42
  • $\begingroup$ @6005, I'm comparing the two different sequence, and want to know if the second tree after splaying is correct or not $\endgroup$ Oct 13 '20 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.