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
types of lock

Q. Explain the Fetch Cycle? The beginning of every instruction cycle is the fetch cycle and causes an instruction tobe fetched from memory.   The fetch cycle comprises four

The salient features of hyper threading are: i)  Improved support for multi-threaded code, permitting multiple threads to run concurrently. ii) Response time and improved rea

(a) Consider a sinusoidal signal m(t) = A cos(2πfmt) applied to a delta modulator with step size Δ. Determine the range of the step size so that slope overload will be avoided. Ass

The first digit of a decimal constant must be Decimal constants having of a set of digit, 0 to 9, preceded by an optional - or + sign.

What is a work process? A work process is where individual dialog steps are in fact processed and the work is done.  Every work process ocuurs one type of request.

Determine the benefits of developing prototype According to SOMM [96] benefits of developing prototype are as following:  1.  Communication gap between clients and software

Determine about the microprocessor A microprocessor contains at the least CPU which was the case in 1970s and early 1980s. Today they include cache memories, bus interfaces, an

Explain Stored Program Control. Stored Program Control: Modern digital computers utilize the stored programmed idea. Now, a program or a set of instructions to the computer i