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
Write a menu-driven program to change a time in seconds to other units (minutes, hours, etc.).  The main script will loop to continue until the user chooses to exit.  Every time in

Which datatype cannot be used to define parameters. Type F datatype is not used to explain parameters.

Q. Convert the following from hexadecimal to binary, decimal, BCD and octal. a) 111 b) ABC.25 c) 2.C Q. Convert the following from BCD to binary, decimal, hexadecimal an

Q. Show the Major benefits of microprocessor? Microprocessor is a complete CPU on a single chip. The major benefits of microprocessor are:  Powerful butCompact; can

What are the main differences between OSI and TCP/ IP reference models? Explain briefly. We will be considering only on the key differences among the two references models. Th

Explain the main part of configuration of a step by step switching system with the help of a neat diagram . Configuration of a step by step switching system: A step

Main script section ("Sub Main .. End Sub) and function bodies should fit within an A4-page (approx. two monitor-pages). If the code doesn't fit it is a candidate to do more decoup

What are problems of clock skew? This is typically because of two causes. The primary is a material flaw that causes a signal to travel faster or slower than imagined. The seco

What is line option explicit Line explicit function makes the compiler to recognize all the variables which are not particular by the dim statement. This command significantly

A Network uses a star topology if? A Network utilizes a star topology if all computers attach to a single central point.