Implementing Depth First Search into C# using List and Stack
It seems mine is turned around and is beginning from right to left. Do you know what causes it? As others have noted, you are pushing the nodes-to-visit-next on the stack in order from left to right. That means they get popped off right-to-left, since a stack reverses the order. Stacks are last-in-first-out. You can … Read more