answersLogoWhite

0

A possibility is tagging. Example:

typedef struct ListElem {

struct ListElem *next;

int tag;

int value;

} ListElem;

int Check (ListElem *l)

{

static int tagn= 0;

++tagn;

for (; l; l= l->next) {

if (l->tag==tagn) return -1; /* loop */

l->tag= tagn;

}

return 0;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

W difference between a linear linked list and a circular linked list?

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.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


What is the difference between linked list and Ordinary list?

A list is an abstract data structure, usually defined as an ordered collection of data. A linked list refers to a specific implementation of a list in which each element in the list is connected (linked) to the next element.


Difference between circular and single linklist?

A regular linked list will have a pointer to the start of the list, with each node pointing to the next node, and finally the last node points to NULL. In a circular linked-link, the last node will point to the first node, making the list circular. This requires extra checks to ensure that you don't end up going into an infinite loop while traversing the list.


What is difference between linked list and singly linked list?

Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.

Related Questions

How do you detect the linked list is full?

A linked list cannot be 'full'. You might run out of memory, though.


How can you find out if a linked list is circular?

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/


W difference between a linear linked list and a circular linked list?

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.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


Which is the easy insertion operator single linked-list or double-linked list?

It is easier to insert into a singly linked list.


What is the difference between linked list and Ordinary list?

A list is an abstract data structure, usually defined as an ordered collection of data. A linked list refers to a specific implementation of a list in which each element in the list is connected (linked) to the next element.


How you can delete the node with smallest data from a linked list?

I'm currently doing the same homework problem in c++, my best guess right now is to use some function such as max element size or sizeof(object) and then if and then statements or a for loop to go through the list to delete the smallest linked node.


What is non-integer linked list?

Linked list of strings, for example.


What is the difference between doubly linked list and circular linked list?

A doubly linked list is a linked list in which each node knows where both of its neighbors are.A circular linked list is a linked list in which the "tail" of the list is linked to the "root". (Note that both the tail and root of the list are undefined/arbitrary in a circular linked list)Doubly linked lists are actually not necessarily related to circular linked list (aside from both being based on a linked list structure). In fact, you can have a circular doubly linked list, where each node knows where both of its neighbors are andwhere the list wraps around to connect to itself.


What is difference between linked list and singly linked list?

Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.


Difference between circular and single linklist?

A regular linked list will have a pointer to the start of the list, with each node pointing to the next node, and finally the last node points to NULL. In a circular linked-link, the last node will point to the first node, making the list circular. This requires extra checks to ensure that you don't end up going into an infinite loop while traversing the list.


Where linked list using?

linked list are used for creation of stack,queues to use memory in optimum manner linked list are used as they are dynamic in nature

Trending Questions
Was trevithick the first ever to build the steam train? How is the hardness of steel rated in en? In the high pressure side of the large copper tube there is a blue filter that has two valves like bicycle intertubes have on them What are they and can the filter be removed for cleaning? Why do you need a clean room for integrated circuit design? Is there a dictionary or list of rotary tool bits and what they are used for? What is a sentence with contrive in it? When surfing the web the browser interprets the HTML command found in a document file and displays it as? Is the B programming language a high or low level programming language? What are the difficulties in evaluating foreign projects? What is the shell script program for adding five digit numbers? How can PVC be both hard and soft? What is the Mild steel tensile strength in KNmm2? Is surgical steel the same quality as titanium for naval piercings? Does TIMER IC 4020BP replace CD4020? Which are practical examples of how people in the developed world could make a big difference in how much water they use? Why did they invent shoes? How do engineers find out where in a well comes from? In a lawn irrigation system is a closed loop piping system instead of the dead end piping system for the pop-up oscillating sprinkler heads more effective in preventing heads from emerging from grade? Does window 7 come with a c plus plus compiler already installed? What to do to change c to c plus plus in turbo c plus plus?