Shayan's blog

By Shayan, 5 months ago, In English
  • Vote: I like it
  • +7
  • Vote: I do not like it

»
5 months ago, # |
Rev. 3   Vote: I like it -20 Vote: I do not like it

now not chill kids

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

wrong video isnt it?

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a container that always maintains the elements in sorted order, allows me to access any k-th largest/smallest element in O(log n) complexity, and also supports insertion and deletion of elements in O(log n) complexity? THANKS~~

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i think you are looking for this.

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      COOL

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        but be careful, orderd set is not exactly O(log(n)) but O(log(n) * constant) and this constant may cause a time limit (rarely).

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you can do it with compression and fenwick/segment tree.