In DFS, _______ is used to mark nodes as visited.
- Color
- Flag
- Marker
- Weight
In DFS, a flag (usually a boolean variable) is used to mark nodes as visited. This helps in preventing infinite loops and ensures that each node is visited only once during the traversal.
Loading...
Related Quiz
- What does LCS stand for in dynamic programming?
- What are some common use cases for regular expression matching?
- Discuss the trade-offs between using a fixed-size hash table versus a dynamically resizing hash table.
- Which balancing technique is commonly used in binary search trees to ensure their height is minimized?
- Discuss a scenario where Matrix Chain Multiplication can be applied in real life.