Week 6: Monday -------------- Q1. (40) Write a program that outputs all possible sub-matrices from a matrix of size n by m. The sub-matrices must be such that its rows and columns are adjacent. Avoid outputting sub-matrices having only one row or one column. Example: If the matrix (of size 2 by 3) is 1 2 3 4 5 6 the sub-matrices that should be output are 1 2 4 5 and 2 3 5 6 Q2. (60) Write a recursive function to calculate the number of configuration of n rooks on an n-by-n chessboard such that no two rooks can capture each other in the next move (i.e., no two rooks lie on the same row or same column). You cannot output a configuration where all the rooks are on the main diagonal or all of them are on the main cross-diagonal. Write a main function to test it. (Note that the answer can be calculated analytically. Do not do that. Instead, calculate this number using recursion.)