i need an explain for the complexity of this code

Правка en1, от 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);

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Radiohead___ 2025-03-03 01:01:40 4 Tiny change: 'nmultiset st ; int x ; ' -> 'nmultiset ms; int x ; '
en1 Английский Radiohead___ 2025-03-03 01:00:22 393 Initial revision (published)