Depth First Search Algorithm implemented in C++