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

Автор marius135, 12 лет назад, По-английски

I am interested in knowing if there is a data structure that can offer better than O(log n) average complexity and offers the following 2 operations:

Increment x-> V[x] = 1 (all elements are initially 0) Query (1->y) all query are 1 based...

I know I will have O(n) increases and O(n) queries and want better than O(n log n) total time...

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

»
12 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

What is the "query" operation doing — summing, checking if anything in the range is a set bit, or something else entirely?