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 ecs?

Compare the basic COCOMO model with the detailed COCOMO model. COCOMO having of a hierarchy of three increasingly detailed and accurate forms. -  Basic COCOMO - is a stati

Downcasting concept is the casting from a general to a more particular type, i.e. casting down the hierarchy in programming

What is text editor? It is used for entering and editing application programs. The user of this program interactively implements command that permit statements of a source prog

How call processing takes place? Fundamental Call Procedure: Fig. demonstrates a simplification diagram exemplifying how two telephone sets (as subscribers) are interconnecte

How are the applications of generic framework for electronic commerce performed? To perform applications, this is essential to have Supporting Information and Organizational In


Memory utilization factor shall be computed as? Ans. memory in use/total memory connected.

n=(x*2)/(1=0) the value x=0 and is used to stop the algerithin.The calculation is repeated using values of x=0 is input. There is only a need to check for error positions. The va

How can we use / display table in a screen? ABAP/4 offers two mechanisms for showing and using table data in a screen.  These mechanisms are TABLE CONTROLS and STEP LOOPS.