Linked list

Hi Everyone,

Can someone explain how to sort a linked list?

Thanks for help.
Can we assume that you know sorting and linked lists?

You can swap values as necessary, just like when sorting other containers.

However, if value copy is expensive, then you could swap by relinking nodes. That would rely on remove and insert list operations.
I know how it works, but the implementation in C++ troubles me.
Ok.
The implementation possibilities depend on the features of the list. On std::list a non-copying swap would use list::splice.
Topic archived. No new replies allowed.