Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. public void allPossibleWords(char C[][], int i, int j, int N, int M, char res[], int idx) {
  2.        
  3.         if (i > N || j > M) {
  4.             return;
  5.         }
  6.  
  7.         res[idx] = C[i][j];
  8.         for (int l = 0; l <= idx; l++) {
  9.             System.out.print(res[l]);
  10.         }
  11.         System.out.println();
  12.         allPossibleWords(C, i + 1, j, N, M, res, idx + 1);
  13.         allPossibleWords(C, i, j + 1, N, M, res, idx + 1);
  14.         allPossibleWords(C, i + 1, j + 1, N, M, res, idx + 1);      
  15.  
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement