conceptual question
I am a new student to Java with very little experience in any programming and have been assigned a project to create a singly linked circular list with no beginning or end.
My question is conceptual: If the list has no beginning or end, how do I "enter" the list to search, delete or insert. Basically, how do I tell the program where to begin?
[357 byte] By [
sophie07a] at [2007-11-27 6:53:12]

Instead of being a line like a regular LL, yours will be a circle, basically the same thing, but with the tail linked to the head. Since if you start in any place and keep iterating, you'll end up back at where you started, it doesn't matter where you start. Think of how you would count the number of horses on a carousel. Would it matter which one you started with? No, just start somewhere and keep counting until you get to the one you started on.
Editid for speling
Message was edited by:
hunter9000
http://en.wikipedia.org/wiki/Circular_list#Circularly-linked_list
In that picture, the "head" of the list is still the node with 12 in it, just like it would be in a regular LL. The "tail" is still the 37 node. The only difference is that the tail is linked to the head. Just like you would start a search at the head in a regular LL, you could start it there for the circular one.
> What if the list has just been created and there is
> no data in it so all references are null?
All references? You will just have one, the one that references any element once you have added an element to the list.
>
> Would I use something like current=current.next as a
> starting point?
No
current = null;
kajbja at 2007-7-12 18:27:55 >
