what are the conditions for a circular linked list if there is only one data left in it?
current.getNext() == head && ???
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
what are the conditions for a circular linked list if there is only one data left in it?
current.getNext() == head && ???
Excuse me?
// Json
It'd point to itself (analogy: dog chasing it's tail). However, if you have a circularly linked list, it'd have no head, or everything could be the head (depending on how you're looking at it).
May I ask why would you want a circularly linked list?
thanks helloworld922
this circularly linked list is just an assignment my lecturer gave me. im suppose to create a linked list classes that input 6 data and remove every 3rd data continuously in the linked list until 1 remain.
e.g. 1 2 3 4 5 6 remove 3
1 2 4 5 6 remove 6
1 2 4 5 remove 4
1 2 5 remove 2
1 5 remove 5
1
i figured out the solutions already. thanks anyway (=
Hello student123xyz. Welcome to the Java Programming Forums
You did post in the correct forum, the tips & tutorials forum is more for tutorial code snippets. I would of moved the thread to here anyway
I'm glad you have your solution. Please in future mark your threads as solved. I have done it for you this time..
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.