posted 18 years ago
Hi, welcome to the ranch!
In a few words here are some structures that might be what you're looking for. I was a music major, not CS, so the names may not be what your instructor or the other ranchers call them ...
Linked list: Each node holds something interesting and a reference to another node often called "next". You keep a reference to the first one. To get to any other node you follow the "next" pointers. The last node in the list has next == null or sometimes points back to the first one for a "circular" list.
Doubly linked list: Liked linked list but also has a reference to "prior". You can work your way back and forth in the list.
Binary tree: Each node holds a key and a value, a reference to another node whose key is "less than" this one, and a reference to a node whose key is "more than" this one. These references are often called "left" and "right". To find a given key you start at the top. If the node's key is greater than the one you want you go left, if the node's key is less than the one you want you go right.
Tree: Each node hods a value and a collection of any number of references to child nodes. You get this kind of thing when you parse XML or HTML.
Most of these structures are provided for you in the standard libraries. But it is great fun and education to build your own. Try a linked list. See if you can add new nodes to the end, print them all out, insert or delete nodes in the middle. If you want to give it a try, the "ranch way" is to give it a try and if you get stuck show us what you made so far.
Have fun!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi