Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please Create a C++ program to check to see if a string exists in a given matrix of characters using recursion. Your program should

image text in transcribed

c++ please

Create a C++ program to check to see if a string exists in a given matrix of characters using recursion. Your program should read the dimensions of the character matrix from an input file. It should then read the matrix and load it into a dynamically allocated 2D-array. Finally, it should read the string to be found. Output the word true if the string can be constructed from characters in the matrix, and the word false otherwise. The string can be constructed from a sequence of character of adjacent index, where adjacent an index is connected horizontally or vertically, but not wrapping around edges. 1. Input files - The first line of the input will contain two integers ' m ' and ' n ', separated by a single space. ' m ' represents the number of rows and ' n ' represents the number of columns. - The following ' m ' lines will each contain ' n ' number of characters, each character will be separated by a single space. - The last line in the input will contain the string to be searched in the matrix. - Each character in the matrix can only be used once, meaning that once a character has been visited, it cannot be visited again. - All character and string in the input will be in lowercase - There will be no extra lines and whitespaces in the input. 2. Output files - Output the word true if the string exists in the matrix; otherwise output the word false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions

Question

5. Recognize your ability to repair and let go of painful conflict

Answered: 1 week ago