SpecialAssignment1 PDF
SpecialAssignment1 PDF
Programming Problem
Data structures (CSE-A & D)
Deadline 15-10-19
Amanada, a school kid, is learning English alphabets. Her teacher devised a small game to make
the task fun. A grid of 'm' rows and 'n' columns is filled with English alphabets.
She needs to search English words in this grid by moving one step at a time in any of the adjacent
grid cells.
A grid of alphabets and a set of English words are given. Amanda can start from anywhere in the
grid and can move in any of the 8 adjacent grid cells, one step at a time. Each grid cell can only
be used once.
Input
You are given a template in which you need to implement a function whose signature is given
below.
C
int findWordInAGrid(char grid[128][128], int m, int n, char word[32])
/* return 0 for false, 1 for true. */
C++
bool findWordInAGrid(char grid[128][128], int m, int n, char word[32])
Output
The function should return true, if you can find the word in the grid and false otherwise.
Example
Let's consider the grid given below:
a b c
d e f
g h i
And set of words to be searched are:
abc
abedhi
efgh
Output:
The output of the above example should be:
abc: true
abedhi: true
efgh: false
Constraints
1 ≤ m,n ≤ 100