Quote:
Originally Posted by
Mozza314
Why do people talk about linked lists being sorted so much?
They do? That's odd! WHat about queues and stacks and all the other uses that have nothing to do with sorting?
Quote:
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!),
Ding ding ding (warning bells)
Quote:
he said that linked lists store sorted data. What's with that?
Did he also say that cars are red? That statement is equally true.
Quote:
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.
No, if you never modify it after it is set up and sorted then an array would definitely be better.
Quote:
A multiset should be used to maintain sorted data, right?
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.