CantLoseNow's blog

By CantLoseNow, history, 2 years ago, In English

so i was solving a cses question and i had a confusion...why dont we sort a set or multiset before applying lower bound and upper bound? i saw some solutions and they just simply added the elements and directly applied lower bound and upper bound.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

It's because they are sorted data structures. You might want to read the references for these containers on Cppreference.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Sorted data structures = Already sorted right? also why do they have a separate lower bound and upper bound function. why not use the std:lowerbound and upperbound?