They do? That's odd! WHat about queues and stacks and all the other uses that have nothing to do with sorting?
Originally Posted by Mozza314
Ding ding ding (warning bells)
I even remember when I learned about linked lists my lecturer (who I think was rather old-school, e.g. didn't like std::string and told us to prefer cstrings!),
Did he also say that cars are red? That statement is equally true.
he said that linked lists store sorted data. What's with that?
No, if you never modify it after it is set up and sorted then an array would definitely be better.
It's not efficient to maintain a sorted list. It would only make sense to me to use a list for sorted data if you put the data in there once, then sort it, and don't modify it.
Not a matter of "should", but that's just what it does. It is sometimes the best thing to use and sometimes not. Much higher overhead than a sorted array.
A multiset should be used to maintain sorted data, right?