add wasVisited[] to trace node visited or not.
implement stack using linkedlist
Depth first search