The document contains code snippets for 5 recursive problems: 1) Print all permutations of a string in O(n*n!) time. 2) Count number of paths from top left to bottom right in a m x n maze in O(2^(m+n)) time. 3) Solve the tiling problem of covering a floor of size n with tiles of size m in recursive manner. 4) Solve the friends pairing problem recursively to count number of ways n people can be paired. 5) Print all subsets of a set of size n using backtracking approach recursively.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
12 views
Recursion Class 3
The document contains code snippets for 5 recursive problems: 1) Print all permutations of a string in O(n*n!) time. 2) Count number of paths from top left to bottom right in a m x n maze in O(2^(m+n)) time. 3) Solve the tiling problem of covering a floor of size n with tiles of size m in recursive manner. 4) Solve the friends pairing problem recursively to count number of ways n people can be paired. 5) Print all subsets of a set of size n using backtracking approach recursively.