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
Q. Illustrate Programming Based on Message Passing? Since we know programming model based on message passing employs high level programming languages such as C/C++ along with a

There are no needs.. If you need to use a Viewport you can! If you want to render components into divs... you can do that aswell.

There should be 1 server thread and N client threads, where N is supplied by the user as a command line argument. The server opens a file called "all_requests.dat", the file has

Minimax algorithm - artificial intelligence: The minimax algorithm is so called because it assumes that you and your opponent are going to act rationally, so that if you will

How can I go in the symbol for the new Euro currency in my spreadsheet? Ans) Microsoft suggestted a new Tahoma font with the Euro symbol.

Why Gateways are used during mail transfer? Email using SMTP effort best while both the sender and the receiver are on the internet and can hold TCP connections in between send

Consider  the  following set of jobs with  their  arrival  times,  execution  time  (in minutes), and deadlines. Job Ids Ar r ival Time E

What is meant by hotspots? A Hotspot is a list area where the mouse pointer appears as an upright hand symbol. When a user points to that area (and the hand cursor is active),

Explain in brief about Compact disks (CD) These are an optical storage media that have basically taken over from floppy disk. Software is now generally supplied on a CD (in for

What is importance of RAS and CAS in SDRAM? SDRAM acquires its address command into two address words. This uses a multiplex scheme to save input pins. The initial address word