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?
Yes, std::list::splice() allows you to concatenate two std::list's in constant time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With