i need an explain for the complexity of this code

Revision en1, by Radiohead___, 2025-03-03 01:00:22

Hello everyone, I hope you are doing well, can anybody explain to me why this code costs O(n) on sets and multiset but in the other side it costs O(log(n)) on the sorted vectors.

the code ->

multiset st ; int x ; auto it = upper_bound(ms.begin() , ms.end() , x) ;

between this code cost O(log(n)) auto it = ms.upper_bound(x);

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Radiohead___ 2025-03-03 01:01:40 4 Tiny change: 'nmultiset st ; int x ; ' -> 'nmultiset ms; int x ; '
en1 English Radiohead___ 2025-03-03 01:00:22 393 Initial revision (published)