Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
✍: Guest
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.
2012-01-18, 2456👍, 0💬
Popular Posts:
How can you check to see whether a symbol is defined? You can use the #ifdef and #ifndef preprocesso...
.NET INTERVIEW QUESTIONS - How to prevent my .NET DLL to be decompiled? By design .NET embeds rich M...
.NET INTERVIEW QUESTIONS - What are types of compatibility in VB6? There are three possible project ...
When should the register modifier be used? Does it really help? The register modifier hints to the c...
.NET INTERVIEW QUESTIONS - Can we use events with threading ? Yes, you can use events with thread; t...