Sponsored Links
-->

Thursday, August 16, 2018

Axilary Lymph Node Biopsy and Sentinel Lymph Node Biopsy For ...
src: i.ytimg.com

In computer programming, a sentinel node is a specifically designated node used with linked lists and trees as a traversal path terminator. This type of node does not hold or reference any data managed by the data structure.


Video Sentinel node



Benefits

Sentinels are used as an alternative over using null as the path terminator in order to get one or more of the following benefits:

  1. Increased speed of operations
  2. Reduced algorithmic complexity and code size
  3. Increased data structure robustness (arguably)

However, sentinel nodes rely on shared memory, which requires extra code to avoid data races. This causes sentinel nodes to have poor performance on concurrent systems.


Maps Sentinel node



Examples

Search

Below are two versions of a subroutine (implemented in the C programming language) for looking up a given search key in a singly linked list. The first one uses the sentinel value NULL, and the second one a (pointer to the) sentinel node Sentinel, as the end-of-list indicator. The declarations of the singly linked list data structure and the outcomes of both subroutines are the same.

First version using NULL as an end-of-list indicator

The for-loop contains two tests (yellow lines) per iteration:

  • node != NULL;
  • if (node->key == search_key).

Second version using a sentinel node

The globally available pointer sentinel to the deliberately prepared data structure Sentinel is used as end-of-list indicator.

The for-loop contains only one test (yellow line) per iteration:

  • node->key != search_key;.

Remark

If the data structure is accessed concurrently then for a sentinel-based implementation, not only the node pointed to by first has to be protected for "read-only" by a mutex, but also the node Sentinel has to be protected for "read-write"; this extra mutex in quite a few use scenarios can cause severe performance degradation . One way to avoid it is to protect the list structure as a whole for "read-write", whereas in the first version (with end-of-list indicator NULL) it suffices to protect the list structure as a whole for "read-only" (if an update operation will not follow).

Linked list implementation

Linked list implementations, especially one of a circular, doubly-linked list, can be simplified remarkably using a sentinel node to demarcate the beginning and end of the list.

  • The list starts out with a single node, the sentinel node which has the next and previous pointers point to itself. This condition determines if the list is empty.
  • In a non-empty list, the sentinel node's next pointer gives the head of the list, and the previous pointer gives the tail of the list.

Following is a Python implementation of a circular doubly-linked list:

Notice how the add_node() method takes the node that will be displaced by the new node in the parameter curnode. For appending to the left, this is the head of a non-empty list, while for appending to right, it is the tail. But because of how the linkage is setup to refer back to the sentinel, the code just works for empty lists as well, where curnode will be the sentinel node.


Sentinel Lymph Node Mapping for Endometrial Cancer: A Modern ...
src: www.jnccn.org


See also

  • Sentinel value
  • Elephant in Cairo

SLN Detection with Fluorescence Imaging for Uterine and Cervical ...
src: www.mskcc.org


References


Source of article : Wikipedia