Advertisement
DPELED

2012b_88que2

Feb 26th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public static void fillHadamard(int[][] mat)
  2.     {
  3.         fillHadamard(mat, 0, 0, mat.length, 1);
  4.         int d = 0;
  5.     }
  6.  
  7.     private static void fillHadamard(int[][] mat, int i, int j, int size, int value)
  8.     {
  9.         if(size == 1)
  10.             mat[i][j] = value;
  11.         else{
  12.             fillHadamard(mat, i, j, size / 2, value);
  13.             fillHadamard(mat, i + size / 2, j, size / 2, value);
  14.             fillHadamard(mat, i, j + size / 2, size / 2, value);
  15.             fillHadamard(mat, i + size / 2, j + size / 2, size / 2, value * -1);
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement