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
Discuss about OS as system software? OS is a large program or actually a collection of routines that is used to control the sharing of and interaction between various computer

How do active web pages work? Describe with a small example. Active Web Pages: An active document is not completely specified through the server. Instead an active documen

Q. The work function of a metal surface is 6.626 X 10-19 joule. Compute the frequency of the radiation? Work function                                     W = hγ o The fre

Explain with neat diagram the internal organization of bit cells in a memory chip. Memory cells are usually organized in the form of an array, in which every cell is capable of

converting 10 ASCII characters to excess three using mplab ide

Define the Products of Dynamic mode Dynamic model: A model of dynamic behaviour of user object.  It defines important states of user object, the way that actions depend on

Building IS into our operational processes - Information System Although information systems are becoming increasingly prevalent they are not always the correct solution to ev

Communications Parallel tasks classically need to exchange data. There are many ways in which this can be accomplished, such as, through a network or shared memory bus. The act

What is parallel adder? Draw and explain block diagram for 4 bit parallel adder. Ans: By using full adder circuit, any two bits can be added along with third input like a ca

what is transform mapping and transaction mapping?