Help in Finding adjoint of Matrix

this is the algorithm given on wikipedia for finding adjoint of matrix.
I have implemented the code, but i am getting wrong result for adjoint, please help where i went wrong.
my code::
or please provide your implementation for finding adjoint of matrix using above algorithm or any algorithm.
Complexity :: total complexity of my code is O(n^4) n^3 for matrix multiplication and n for recursion.