How do you find out if a linked-list has an end, Computer Engineering

By 2 pointers you can find it. One of them goes 2 nodes each time. The second one goes at 1 node each time. If there is a cycle, the one that goes 2 nodes every time will eventually meet the one that goes slower. If that is the case, then you will identify the linked-list is a cycle.

 

 

Posted Date: 4/8/2013 5:21:02 AM | Location : United States







Related Discussions:- How do you find out if a linked-list has an end, Assignment Help, Ask Question on How do you find out if a linked-list has an end, Get Answer, Expert's Help, How do you find out if a linked-list has an end Discussions

Write discussion on How do you find out if a linked-list has an end
Your posts are moderated
Related Questions
What is chattering as applied to mechanical switches used in digital systems and why do they occur?  What is its effect on the functioning of a sequential circuit? Ans Chat

Class Program { static void Main() { int[] MyPrimeNumbers = {1,2,3,5,7}; // Use the Count() and Sum() Standard Query Operators to // compute the count an whole su

Data Dependency It indicates to the situation in which two or more instructions share same data. The instructions in a program are able to be arranged based on relationship o

Level of a node The root is at level zero and the level of the node is 1 more than the level of its parent

De Morgan's Laws Continuing with the relationship between  ∧  and  ∨ , we can also use De Morgan's Law to rearrange sentences involving negation in conjunction with these conne

Rentrag has decided to replace all of the computers currently being used by all of the business and office staff. He has asked you to recommend a set of specification for computers

AI Applications Search is a important element of an AI system, and search functions are executed on huge quantities of complicated structured data by means of unstructured in

Memory Organization - Computer architecture: BASIC CONCEPTS: Address space - 16-bit : 216 = 64K mem. locations - 32-bit : 232 = 4G mem. locations -          40-b

Define Flash Memory. It is an approach same to EEPROM technology. A flash cell is based on a one transistor controlled by trapped charge just like an EEPROM cell.

Q. Determine what part of global array to work on thread number? #include void subdomain(float x[ ], int istart, int ipoints) { int i; for (i = 0; i x[istart+