A stack stores items in last-in, first-out (LIFO) order: the newest item is added to and removed from the top. section 7.2
Depth-first search uses a stack to follow one branch deeply before backtracking. Recursion can provide this stack through the function call stack. section 7.2
Exploring delivery routes
In a route search, DFS extends one customer route until all customers are visited, then backtracks to try another order. section 7.2
dfs("Depot")
├── dfs("C1")
│ ├── dfs("C3")
│ │ ├── dfs("C5") → no unvisited neighbors, backtrack
│ │ └── dfs("C6") → continue exploration
│ └── dfs("C4") → new branch
└── dfs("C2") → new high-level branch
Follow recursive calls as DFS explores route branches and backtracks. section 7.2
















