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.

Results 1 to 5 of 5

Thread: circular linked list

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default circular linked list

    what are the conditions for a circular linked list if there is only one data left in it?

    current.getNext() == head && ???


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: circular linked list

    Excuse me?

    // Json

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: circular linked list

    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?

  4. #4
    Junior Member
    Join Date
    Aug 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: circular 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 (=

  5. #5
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: circular linked list

    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.

Similar Threads

  1. Java program which can list all files in a given directory
    By JavaPF in forum Java Programming Tutorials
    Replies: 8
    Last Post: July 9th, 2013, 03:38 AM
  2. Which collection is best to do mathematical operation on it?
    By Sterzerkmode in forum Java Theory & Questions
    Replies: 1
    Last Post: May 7th, 2009, 04:48 AM
  3. ClassCastException in Double Linked List toString
    By Rastabot in forum Collections and Generics
    Replies: 2
    Last Post: April 24th, 2009, 11:48 AM
  4. Recursive function based on Linked list
    By rosh72851 in forum Collections and Generics
    Replies: 1
    Last Post: March 9th, 2009, 06:23 PM
  5. String substring, concatenation operation on linked list
    By oaks12 in forum Collections and Generics
    Replies: 1
    Last Post: January 15th, 2009, 07:12 AM