Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C programming: I am attempting to determine the best (and optimal) approach to s

ID: 3847830 • Letter: C

Question

C programming:

I am attempting to determine the best (and optimal) approach to solving the following:

locate a randomly generated four-letter word in a randomly generated rectangular array. eight orientations are possible; straight line (no zigzags); no wrapping across boundaries.

One hint was given to decrease dynamic instructions: if row and column being searched is less than 3 (i.e. rows/column 0, 1, 2), the word cannot be found in the W, NW, N, NE, SW directions, as the word would extend past the restricted boundaries. This type of scenario would hold for rows/columns < 3 or > than (num rows/columns - 3).

I am not looking for someone to write the code. I am trying to determine how to optimally approach the problem. The naive solution would be to check for letter2 in all eight direction for each letter1 in the grid. Then, once letter2 is found (could be multiple letter2 around letter1), check the straight-line directions of letter2 for letter3 and letter4. but we will be graded on static and dynamic benchmarks.

any ideas on where I should start?

Explanation / Answer

Approach To Solve The Problem:

Hence, according to me this is the approach for the problem statement you have provided here.

Please rate the answer if it helpd....Thankyou

Hope it helpsss....