Time difference between count and find

Правка en3, от Jbi, 2024-01-06 01:52:37

Hey cf ppl,

I was just wondering why set.count() works a lot faster than using vector.find(), from personal coding experience

This question seems to have already been answered on stack overflow, but it gave a what I thought as an incorrect answer, telling me that vector.find() would run faster than set.count() because it breaks as soon as it reaches the first occurence while set.count() would continually iterate through the whole array.

Thanks

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Jbi 2024-01-06 01:52:37 0 (published)
en2 Английский Jbi 2024-01-06 01:50:36 11 Tiny change: 'ering why many times set.count' -> 'ering why set.count' (saved to drafts)
en1 Английский Jbi 2024-01-06 01:50:04 506 Initial revision (published)