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

  Derive an array class template from vector class template

Derive an Array class template from the Vector class template, where the second template parameter E holds an enumeration type to be used for the array index.

  Explain queue crawl through memory in direction of its head

Does queue crawl through memory in direction of its head or its tail? Describe your answer. Describe how lack of metrics for measuring certain software properties affects software engineering discipline.

  A multinational tour operator agency has gained new

a multinational tour operator agency has gained new business growth in the north american market through the use of

  Find the median of all 2n elements in arrays x and y

Give an O(lg n)-time algorithm to find the median of all 2n elements in arrays X and Y.

  Identify a specific sort algorithm of your choice

Identify a specific sort algorithm of your choice. What are the pros and cons

  Model of online music sharing

Since Napster is going out of business, you have decided to begin your own on line music sharing site. You will give individual music documents at your site.

  Write an algorithm that computes the depth-first search

Write an algorithm that computes the depth-first search in­ terval labeling scheme (see Subsection 4.4. 2) for an arbitrary connected net­ work. Can it be done in O(N) time units? Can it be done using O(N) messages?

  Linked list

Let A and B be two structures of type linked list. Write a function for creating new linked list C that contains elements alternately from A and B beginning with first element of A. If you run out of the elements in one of the lists then append the r..

  State how you would recover the actual set s given a .

Prove correctness of your greedy algorithm by stating and proving the loop invariant.

  What is highest number of messages sent by correct processes

What is the highest number of messages sent by correct processes in Algorithm 15.4 in executions that decide on O? Answer both for the case where the general is correct and the case where the general is faulty.

  Algoithm to select to describe intrinsically recursive

Algoithms you select so you can describe and assess them. Write challenges did you face in process? How did you go about resolving them?

  Prepare a recursive linear-time algorithm

Prepare a recursive linear-time algorithm that tests whether a binary tree satisfies the search tree order property at every node.

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