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
The Towers of Hanoi Problem Towers of Hanoi problem is described. There are three pegs on which disks are "threaded" (there are holes in the disks to allow them to be placed on

Q. Define the Circular shifts ? Circular shifts ROTATE RIGHT andROTATE LEFT. Bits shifted out at one end of word are not lost as in a logical shift however are circulated back

Classify computer systems according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also

Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as the integer that is the product 2a3b. Give



Q. Terminates a particular PVM process? int pvm_kill( int tid ) Terminates a particular PVM process. tid Integer task identifier of PVM process to be killed (not itself).

What do you mean by complexity of an algorithm? The term complexity is used to define the performance of an algorithm. Typically performance is calculated in terms of time or s

Explain the Trackball and Thumbwheel devices  Joysticks A joystick consists of a small, vertical lever (called the stick) mounted on a base that is used to steer the screen

Define Memory Latency? It is used to refer to the amount of time it takes to transfer a word of data to or from the memory.