CircSLelement<E> implements a circular singly linked list element in BRIDGES and is inherited from SElement<E>



How does the CircSLelement<E> work?

CircSLelement<E> stands for Circular Singly Linked Element and is a type of container that has one link, pointing to another SLelement<E>. So an CircSLelement<E> "knows" who it is pointing at but it does not know who is pointing at it(if any).



In the above example, CircSLelement1 points to CircSLelement2. Calling getNext() on CircSLelement1 will return a link to CircSLelement2, and calling getNext() on CircSLelement2 will return a link to SLelement3. CircSLelement3 points to CircSLelement1. Calling getNext() on CircSLelement3 will return a link to CircSLelement1.

Also notice that there is no getPrev(). CircSLelement2 has no idea what element came before it. So, you CANNOT go backwards.


See also

This tutorial gives an introduction to the usage of cicular singly linked list. You can find the complete documentation of the features in the Doxygen documentation of the following classes and functions:

  1. CircSLelement [Java] [C++] [Python]
  2. Element [Java] [C++] [Python]
  3. ElementVisualizer [Java] [C++] [Python]
  4. LinkVisualizer [Java] [C++] [Python]
  5. Color [Java] [C++] [Python]

CircSLelement - An Example BRIDGES program

Example Details

Here's the final code:

Java
C++
Python

	  

	  

	  

Bridges Visualization

Well done! You’ve just created your Bridges Circular Singly Linked List project!