Create a two-d array puzzle that will find the given words

Assignment Help Data Structure & Algorithms
Reference no: EM131184898

Create a 2d array puzzle that will find the following words; this, two,fat,that.

/word puzzle with 3 rows and 3 columns

#include <iostream>
#include <cstring>

using namespace std;

#define R 3
#define C 3

string puzzle []={};

int c = sizeof(puzzle)/sizeof(puzzle[0]);

bool isword(string & string)

{
for (inti=0; i<c; i++)
if (string.compare(puzzle[i])== 0)
return true;
return false;
}
void findwordUtil(char puzzle[R][C], bool visited [R][C], inti, int j, string & string)

visited[i][j] = true
string = string + puzzle[i][j];

if (isWord(string))
cout<< string<<endl;
for (int row=i-1; row<=i&& row<R; row++)
for (int collate=j-1 && row<C; collate++)
if (row>=0 && collate>=0 && ! visited[row][collate])
findWordsUtil(puzzle, visited, row, collate, string);
string.erase(string.length()-1);
visited[i][j]=false;
}
void findWords(char puzzle[R][C] = {{false}};
string string = "";

for (int j=0; j<C; j++)
findWordsUtil(puzzle, visited, i.j. string);{{t,y,i,s}}
{{w,a,t,s}}
{{o,a,h,g}}
{{f,g,d,t}}

cout<< "words in the puzzle\n";
findWords(puzzle);
return 0;

}

Reference no: EM131184898

Questions Cloud

Investigate the effectiveness of business information system : Investigate the effectiveness of business information systems of the given case study. To do this, you are required to submit a complete report which includes an analysis of functionality.
Explain why you agree or disagree with the above statement : Explain why you agree or disagree with the above statement. Focus on employee-related regulations established by the United States, such as the Department of Labor, the U.S. Equal Employment.
Why should workplace smoking bans : Why should workplace smoking bans be particularly influential in affecting the behavior of people who work long hours?
Us produce only about a quarter of worlds greenhouse gases : Explain how this can be so when the United States produces only about a quarter of the world's greenhouse gases.
Create a two-d array puzzle that will find the given words : Create a 2d array puzzle that will find the following words; this, two,fat,that. void findwordUtil(char puzzle[R][C], bool visited [R][C], inti, int j, string & string)
What real world data would you want to examine : What would you consider to be evidence of tit-for-tat pricing? How can you distinguish tit-for-tat pricing designed to sustain "collusive" pricing from competitive pricing?
Are there factors that might reverse this implication : Are there factors that might reverse this implication? That is, can you think of reasons why the attractiveness of deviating from cooperative pricing might actually be greater during booms (high demand) than during busts (low demand)?
How would you empirically test given argument : Some observers argue that since CO2 and temperature levels have been much higher in Earth's history than they are today,- How would you empirically test this argument?
Identify one or more experience goods : Identify one or more experience goods. Identify one or more search goods. How does the retailing of experience goods differ from the retailing of search goods? Do these differences help consumers?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Tic tac toe game - design a gui and implement tic tac toe

tic tac toe game - design a gui and implement tic tac toe game in java-implement a random move using two methods

  Finds the location of the largest even integer

Describe an algorithm that takes as input a list of n distinct integers and finds the location of the largest even integer in the list or returns 0 if there are no even integers in the list.

  Creating an idef1x diagram

Construct an IDEF1X diagram that demonstrate only entities and relationships. Name each relationship and specify its cardinalities.

  What is the running time of quicksort

What is the running time of QUICKSORT when all elements of array A have the same value - Why do we analyze the expected running time of a randomized algorithm and not its worst-case running time?

  1 n vehicles occupy squares 1 1 through n 1 ie the bottom

1. n vehicles occupy squares 1 1 through n 1 i.e. the bottom row of an n times n grid. the vehicles must be moved to

  Question about arrays, vector and stl

Suppose if x denotes the mean of a sequence of numbers x1, x2,.....xn, variance is the average of the squares of the deviations of numbers from the mean.

  Discuss deleting items from binary search trees

If the item to be deleted is contained in a node with one child, the reference in the parent node is set to reference the child node and the node containing the data item is deleted. This causes the child node to take the place of the deleted node..

  How the two versions of the algorithm compare

A brief introduction of the sorting algorithm that you have selected and how the two versions of the algorithm compare.

  What are the potential benefits of knowledge management

What are the potential benefits of knowledge management projects

  Sorting arrays of name in descending order

Then sort arrays so that records are in descending order by purchase amount for month. Output lists the names of the top five customers.

  What is the principles of parallel algorithm design

What is the Principles of Parallel Algorithm Design and how we can design a algorithm in parallel computing in c language this mean practical work?

  Draw a binary search tree for an array

Draw a binary search tree for an array of element from 0 to 20

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd