I have implemented the following code for the strassen algorithm http://www.sanfoundry.com/java-program-strassen-algorithm/. It works for most matrices including 2x2 and 4x4 matrices but fails for 3x3 matrices. Any ideas why and how can I fix it?
Look at the way Strassen works. It works by divide and conquer. You didn't post your code but it probably has to do with trying to divide a 3x3 matrix into 4 submatrices which can't be done. You can pad the 3x3 with zeros to create a matrix with dimensions which can be split or just use basic matrix mult.
Also, Strassen and recursive MM algs need a base case in which it goes to regular matrix multiplication because Strassen is only practical for larger matrices. Depends on your system but my laptop needs matrices larger than 256x256 for Strassen to see an improvement.