Pseudocode for detecting loops in a linked list:
// keep track of which linked list nodes we've visited
set nodesVisited
// our list
linkedlist list
// current working node
node current = list.root
while current.next is not null
if nodesVisited contains current.next
we found a loop!
else
nodesVisited.add( current )
current = current.next
// if we get here without finding a loop, then there are no loops
Complete Working code And illustrative pictures can be found here about linked lists
http://www.programmerinterview.com/index.php/data-structures/how-to-find-if-a-linked-list-is-circular-or-has-a-cycle-or-it-ends/
LINEAR STRAIGHT CIRCULAR CURVED
A doubly linked list allows traversal in both directions (forward and backward) by having each node point to both its next and previous nodes. A circular linked list is a type of linked list where the last node points back to the first node, forming a circular structure. This allows continuous traversal through the elements without a definitive end.
You'll need to use a doubly-linked circular list, since otherwise when you pop off the tail element you'll need to whizz all the way round the list to find its predecessor. See the links section for an implementation of a doubly-linked circular list.
A linked list is circular if the tail of the list points to the head. The easiest way to check this is to check whether the pointer of the tail is a null pointer. If it is, then the list is not circular.
I would say that there is no such thing as a circular queue. The point of a circular data structure is to allow the end to loop around to the beginning. Since you can only remove items from the beginning of a queue or add them to the front, having these two items linked has no purpose nor benefit.
The Josephus problem is a problem to locate the place for the last survivour. It shows the power of the circular linked list over the singly linked lists.
if the last node contains the address of head node instead of null then it is a circular linked llist...
image is shared
To determine if a linked list is circular, you can use the Floyd's cycle detection algorithm. This algorithm involves using two pointers moving at different speeds through the list, and if there is a cycle, the two pointers will eventually meet at the same node. If they don't meet and one of the pointers reaches the end of the list, then the list is not circular.
You may only traverse the linked list in one direction, and unless the linked list is also circular, you must always start from the root node and walk through each additional node until you find the desired value.
In a circular linked list every node is connected to another node. In a non-circular linked list. There are definitely starting and ending nodes are lacking an incoming and outgoing link, respectively.
write pseudocode for link list