I know that a simple vector int has O (1) random access time, since it is easy to calculate the position of the x-th element, since all elements have the same size.
Now what happens to the string vector?
Since the length of the strings is different, it cannot have O (1) random access time, right? If possible, what is its logic?
Thank.
Update:
The answers are very clear and concise, thank you all for your help. I accepted Joy's answer because it is simple and easy to understand.
source
share