Question: 1 . Searching horizontally. First , consider the problem of finding words horizontally in the grid going from left to right. Consider the first row

1. Searching horizontally.First, consider the problem of finding words horizontally in the grid going from left to right. Consider the first row in the example shown above:y c o d e jNotice that this row contains the wordscod,code, andode. Suppose that the row is represented as the list[y, c, o, d, e, j]. A simple way to explore all the possible words (going L to R) in this list would be as follows (the process for the other rows is similar).* Starting at the first element (i.e., y), check whether the sequence of length 3 starting at that position is a legal word (we start with length 3 because a legal word has to be at least three letters long). Then check for length 4, then for length 5, etc., until you reach the end of the list. * Now repeat this step, but starting at the second element (i.e., c). Notice that this time you will come to the end of the list one step sooner. Then repeat for the third element, and so on.* In each of these steps, your code is checking a sequence of list elements (e.g., the sequence of elements c, o, d, e) to see whether this is a word that occurs in your list of words. How can you use the functionconcat_list()from the Short Problems for this assignment?2. Next consider the problem of searching for words horizontally going right to left. Suppose we want to search the row y c o d e j going right to left. This is actually the same as reversing the row, toj e d o c yand then searching left to right (a problem youve solved already). The key thing to note here is that youve taken the problem of searching R-to-L and converted it into an equivalent problem involving an L-to-R search, for which youve already written code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!