What is the primary purpose of a 'visited' array in a DFS traversal?
To track visited nodes and prevent revisiting
To determine if the graph contains a cycle
To calculate the distance from the source node
To record the order in which nodes are visited

Advanced Data Structures Exercises are loading ...