Sign in to follow this  

Linked Lists - Sentinel nodes

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading wikipedia about Sentinel nodes. It describes them but how exactly do they work? Does anyone have an example, just wondering for perhaps a more indepth explaination or diagram of some sort explaining a sentinel node.

Share this post


Link to post
Share on other sites
In general: They are nodes that mean special things.

For example:

SENTINEL -> NODE_1 -> NODE_2

This way, there is always a "head" node, the sentinel. Some lists have a tail sentinel that specifies that the end of the list has been reached. You can sort of imagine them like bookends.

Also: Not to be confused with these

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A sentinel is just a special node that is used as a marker. Usually you use it to mark a special node like 'nil'. It's just a node you have selected out to be the sentinel, which you can than test for. In C you would probably just test against the addresses of pointers to see if it was the sentinel.


if(pointer == sentinel)
{ ... }


Share this post


Link to post
Share on other sites

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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