CantLoseNow's blog

By CantLoseNow, history, 18 months 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?
»
18 months 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.

  • »
    »
    18 months 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?