Reputation: 17788
Is there a data structure, such as std::list
, that allows O(1) concatenation of one list to the end of another? I.e. the final item in list A is linked to the first item of list B?
Upvotes: 4
Views: 981
Reputation: 8036
Yes, std::list::splice() allows you to concatenate two std::list's in constant time.
Upvotes: 10