set stl Question 3

Last Updated :
Discuss
Comments

What is the main difference between a set and a vector in the STL?

A set is an ordered container, while a vector is an unordered container.

A set stores only unique elements, while a vector can store duplicate elements.

A set has constant time complexity for element insertion, while a vector has linear time complexity.

A set has constant time complexity for element access, while a vector has linear time complexity.

Share your thoughts in the comments