Matrix is nothing but a set of numbers arranged in rows and columns. Adding 2 matrices is even simpler. Just add the corresponding entries of 2 matrices to get the corresponding element of result matrix. The 2 matrices should be of the same order, i.e., should have the same number of rows and columns. Here is the pictorial representation of 2*2 matrix added with another 2*2 matrix.

Continue reading

In previous posts, I’ve explained how to write C++ program to find factorial with recursion and with iteration. Also there are 2 other posts to generate Fibonacci series with recursion and with iteration. Now we’ll compare Recursion and iteration.  Theoretically, everything that can be implemented using iteration can be converted to corresponding recursive implementation. Here we will compare which implementation is better in terms of expressibility, readability, writability, maintainability, performance and memory.Continue reading