GreyMaster's blog

By GreyMaster, history, 11 years ago, In English

Hello.

I need a little help about set data structure. Is it possible that access the i-th element of a set with O(1) ?

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
11 years ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

First of all, you cannot access an element of a std::set with less complexity than O(log(n)). And also you cannot access the i-th element of a set. But you can do this with a little trick.