Forum

> > Off Topic > First node (the head) of a circular linked list
Forums overviewOff Topic overviewLog in to reply

English First node (the head) of a circular linked list

1 reply
To the start Previous 1 Next To the start

old First node (the head) of a circular linked list

hilton82
User Off Offline

Quote
I have a query about a circular linked list.

1. How do you find the first node (the head) in a circular linked list?

2. What is the practical application of a circular linked list, and why do we require it?

I searched numerous forums and websites but was unable to find appropriate answers.

Thank you for taking the time to read this.

old Re: First node (the head) of a circular linked list

ohaz
User Off Offline

Quote
1. A circular linked list has no inherent head. It's a circle. You can have lots of heads. It's probably just an external structure linking to one of the elements.
You _could_ have one "special" element (e.g. one without a value, just the links) which you could use as a head, then you could search for that one. But that's not usually done.
2. You can use it for everything where you want to keep a specific amount of entries, a new one kicks out an old one. E.g. if you want to keep the last 20 temperature values on your thermometer, you can use a circular linked list for that. Just always do head = current->next; head.temperature = current_temperature.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview