Блог пользователя sdssudhu

Автор sdssudhu, история, 6 лет назад, По-английски

I was learning about treap sometime back and I was trying a few problems today. Now I am wondering if MKTHNUM can be solved using a treap. And if possible can insertion queries also be handled with it ??

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Well if you have only insertion queries — yes but it will be offline. Simply consider the insertions in reverse order. This way the insertions will become erases and it can be easily solved with Merge Sort tree with Treap or any other BST.

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Can you elaborate a bit more on the deletion part and how it can be implemented with merge sort tree?? Thanks