I have a question about using the java collection (Stack, Lists, etc.). I have taken the basic and intermediate programming classes in C++ and Java. I am about to start a class in C++ focus in data structures. Now I have already read up, or have had some exposure to the to this topic before in java, but I still have not truly seen how you use Stack, Lists, and such is used in the development of an out-the-self application in a situation such as memory management of a accounting package, or video game. So, where do you use them in the real world.
We use queues all the time for message processing. the sending applications can all write to the queue, and there messages get interleaved (i.e. message 1 is from application 'a', message 2 is from 'b', message 3 from 'a', 4 from 'c', etc).
But all the messages from application 'a' have to be processed in order. the program that reads and process the messages pulls them off in order.
using a queue allows many applications to write at whatever rate they want to the queue, and the processing application to read them off at whatever rate it wants to.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
These data structures are used *everywhere*, literally (although you didn't mention maps, which are also ubiquitous). Google maps: a route is a list of waypoints. Games: there's a list of sprites (and a prioritized queue of events). Shopping *list*. *List* of account transactions. *List* of memory references. *Maps* of file system entries.
*List* of things that use collections.
Joined: Jun 24, 2008
Okay! Thanks for the focus adjustment on this topic. I will make sure that I pay full attention in regards to these topics in the Data Structure course.
also, remember that learning should be cyclical. your prof. will say "this is important, but you won't necessarily understand why yet". It took me a few years before I really understood why/how using interfaces was a good idea. I did it, because they told me to, but i wasn't sure why. As i learned more about other things, i gradually realized why they are so powerful.
it's the same with data structures. You may not see an immediate need for one, and it may seem odd that anybody would ever come up with such a thing. Just remember that someone, somewhere needed EXACTLY THAT, and other soon realized it would solve their problems too. Almost all of them will seem silly, until you need EXACTLY THAT.
some of it you just have to take on faith.
subject: Question: Where and when should I use the collection (Lists, Stack, etc . . .)