100% Guaranteed Results


BLG233E – ITU COMPUTER ENGINEERING DEPARTMENT Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

BLG 233E DATA STRUCTURES
HOMEWORK -1

In this homework, you are supposed to write a program which solves a word puzzle.
The program accepts two input files named as: “puzzle.txt” and “searchedwords.txt”. The first file, “puzzle.txt”, contains the word puzzle consisting of fifteen columns and fifteen rows. Also, the words which will be found on the puzzle exist in the second file, “searchedwords.txt”.
The program aims to find searched words in the word puzzle by doing some searching operations in certain directions: vertical, horizontal and diagonal.

Program Work Flow

1. First, read the information from “puzzle.txt” and store all characters in a 2 dimensional puzzle array.

A sample puzzle and the 2-D array are given below respectively.

Definition of the 2-D array is given as:

char** puzzleArray;

struct searchedWord { int id; char* word; int wordLength;
};

2. Read the second file named as “searchedwords.txt”. In this file you will find some words and their identification numbers (id). These numbers also indicate the priority order of the words. This means that you must start searching with the word having the highest priority and continue to words having the lowest priority. You are also supposed to calculate the length of each searched word and store this information during the runtime.

Definition of the struct is:

3. As the third step, you are supposed to check whether the word exists in the puzzle or not, by considering the priority order of searched words. You are allowed to do searching operations in certain ways: Vertical, Horizontal and Diagonal.

In vertical check, each row is searched from right to left and vice versa.
In horizontal check, each column is searched from up to down and vice versa. In diagonal check, words are searched diagonally.

During the searching operations, you do NOT make any changes on the original puzzle array. Definitions of the check functions are given as:

public bool verticalSearch (char** puzzleArray, searchedWord* word) public bool horizontalSearch (char** puzzleArray, searchedWord* word) public bool diagonalSearch (char** puzzleArray, searchedWord* word)

You have to traverse puzzle array with pointers.
When you want to access any character in the puzzle, you cannot use array indexes. That is, you must use the pointer arithmetics. For example: puzzleArray[i][j+1] is NOT allowed, therefore puzzleArrayPtr++ must be used.

4. Up to now, you checked all searched words whether they exist in the puzzle or not. For now, you should report in which indexes and direction searched words are found in the puzzle. These information are written to an output file called as “foundWordsInfo.txt”

An example for the output of this program:
WORD1 HORIZONTAL [3][5] – [3][9]
WORD2 VERTICAL [1][6] – [9][6]
WORD3 DIAGONAL [9][11] – [5][7]

1. Make sure you write your name and number in all of the files of your project, in the following format:

/* @Author
* Student Name: <student_name>
* Student ID : <student_id>
*/

2. Use comments wherever necessary in your code to explain what you did.

3. Compile the code in the Secure Shell Client (SSH) before you send your homework.

HOMEWORKS SENT VIA E-MAIL WILL NOT BE GRADED.

Reviews

There are no reviews yet.

Be the first to review “BLG233E – ITU COMPUTER ENGINEERING DEPARTMENT Solved”

Your email address will not be published. Required fields are marked *

Related products