Jump to content
xisto Community
Sign in to follow this  
ashish_m_k

Link List .... Its a link list problem...

Recommended Posts

uh... as a general rule, link lists aren't circular, they just go in a chain until you get to the end. this is useful for stuff like dynamic memory management. Most of the time I don't think that a circular link list would be very effective, let alone worth the extra code it would require.Is there a specific type of link-list you are talking about? Please make the question a little more specific.

Share this post


Link to post
Share on other sites

It is simple. Here are the steps.1. Start with one link. Let us say head. Keep this in a temp var.2. Traverse the list, going to next link.3. At each link, check weather it is same as head (Compare it with temp var)4. If you find a link same as head, it is circular (you came to where you started from)5. If you reach the end of list, it is not circular.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.