ECE 2574: Data Structures and Algorithms - Applications of Recursion II
ECE 2574: Data Structures and Algorithms - Applications of Recursion II
Applications of Recursion II
C. L. Wyatt
Today we will look at another application of recursion, a
depth first search of a graph, as well as the relationship
between recursion and mathematical induction.
function recursive_dfs(state)
if(state is goal)
return state
else
for each successor of state
return recursive_dfs(successor)
end
endfunction
Base case: n == 0
This follows directly from the pseudo-code. fact(0) = 1.
Proving Factorial correct: Inductive step