Click here to Skip to main content
16,006,382 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Function Pin
Christian Graus8-Dec-03 9:43
protectorChristian Graus8-Dec-03 9:43 
GeneralRe: Function Pin
John M. Drescher8-Dec-03 9:49
John M. Drescher8-Dec-03 9:49 
GeneralRe: Function Pin
David Crow8-Dec-03 10:19
David Crow8-Dec-03 10:19 
GeneralRe: Function Pin
John M. Drescher8-Dec-03 10:25
John M. Drescher8-Dec-03 10:25 
GeneralRe: Function Pin
Jörgen Sigvardsson8-Dec-03 13:11
Jörgen Sigvardsson8-Dec-03 13:11 
GeneralCircular linked list puzzle Pin
melwyn8-Dec-03 4:01
melwyn8-Dec-03 4:01 
GeneralRe: Circular linked list puzzle Pin
Ian Darling8-Dec-03 4:35
Ian Darling8-Dec-03 4:35 
GeneralRe: Circular linked list puzzle Pin
melwyn8-Dec-03 4:57
melwyn8-Dec-03 4:57 
Hi,
Nope not homework. It was an interview question of a friend.
I think I missed out some details when I gave the puzzle. We need to determine if the linked list is properly circular or not.

Consider this linked list of 3 nodes
A->B->C and C points back to B instead of A.

Now according to your algorithm both the pointers will converge on some node, but the linked list is not a proper circular linked list.

I was thinking more on the lines of storing the address of each node in some table as I parse down the list. Then if i come across a node whose entry already exists in the table and I haven't passed the starting node twice then it means there is some problem in the list. However my solution doesn't satisfy the condition of 2 pointers etc.

-Mel
GeneralRe: Circular linked list puzzle Pin
Ian Darling8-Dec-03 5:16
Ian Darling8-Dec-03 5:16 
GeneralRe: Circular linked list puzzle Pin
Jörgen Sigvardsson8-Dec-03 8:04
Jörgen Sigvardsson8-Dec-03 8:04 
GeneralRe: Circular linked list puzzle Pin
Ian Darling8-Dec-03 22:19
Ian Darling8-Dec-03 22:19 
GeneralRe: Circular linked list puzzle Pin
Jörgen Sigvardsson8-Dec-03 22:27
Jörgen Sigvardsson8-Dec-03 22:27 
GeneralRe: Circular linked list puzzle Pin
melwyn9-Dec-03 5:27
melwyn9-Dec-03 5:27 
GeneralRe: Circular linked list puzzle Pin
Terry O'Nolley8-Dec-03 15:08
Terry O'Nolley8-Dec-03 15:08 
GeneralRe: Circular linked list puzzle Pin
melwyn9-Dec-03 5:16
melwyn9-Dec-03 5:16 
GeneralRe: Circular linked list puzzle Pin
Ravi Bhavnani8-Dec-03 7:11
professionalRavi Bhavnani8-Dec-03 7:11 
GeneralRe: Circular linked list puzzle Pin
Jörgen Sigvardsson8-Dec-03 8:08
Jörgen Sigvardsson8-Dec-03 8:08 
GeneralRe: Circular linked list puzzle Pin
melwyn9-Dec-03 5:21
melwyn9-Dec-03 5:21 
GeneralRe: Circular linked list puzzle Pin
melwyn9-Dec-03 5:18
melwyn9-Dec-03 5:18 
QuestionFindWindow with class name - how do I set the class name? Pin
srev8-Dec-03 3:23
srev8-Dec-03 3:23 
AnswerRe: FindWindow with class name - how do I set the class name? Pin
srev8-Dec-03 5:08
srev8-Dec-03 5:08 
AnswerRe: FindWindow with class name - how do I set the class name? Pin
Mike Dimmick8-Dec-03 5:13
Mike Dimmick8-Dec-03 5:13 
GeneralRe: FindWindow with class name - how do I set the class name? Pin
srev8-Dec-03 5:34
srev8-Dec-03 5:34 
GeneralRe: FindWindow with class name - how do I set the class name? Pin
Mike Dimmick8-Dec-03 5:45
Mike Dimmick8-Dec-03 5:45 
GeneralRe: FindWindow with class name - how do I set the class name? Pin
srev8-Dec-03 5:56
srev8-Dec-03 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.