SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
Write C source code for this problem:
You are given a grid of letters, followed by some words. the words can occur anywhere in the
grid on a row or a column, forward or backward. However, there are no diagonal words. Write
an algorithm to find if the given word occurs in the grid on a row or a column, forward or
backward.
Input: The first line of input consists of two integers- grid_row and grid_col, representing the
number of rows (N) and the number of columns (M) of the letter grid, respectively. The next M
lines consist of N space-separated characters representing the letters of the grid. The next line
consists of an integer- word_size, representing the number of words to be searched from the
given grid (k). The last line consists of K space-separated strings representing the words to
search for in the grid.
Output: Print K space-separated strings consisting of "Yes" if the word is present in the grid or
"No" if the word is not present in the grid.

Más contenido relacionado

Similar a Write C source code for this problemYou are given a grid of lette.pdf

Basic concepts. Systems of equations
Basic concepts. Systems of equationsBasic concepts. Systems of equations
Basic concepts. Systems of equations
jorgeduardooo
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
Dushmanta Nath
 
Matrices
MatricesMatrices
Matrices
daferro
 
4tocontest
4tocontest4tocontest
4tocontest
berthin
 

Similar a Write C source code for this problemYou are given a grid of lette.pdf (20)

Basic concepts. Systems of equations
Basic concepts. Systems of equationsBasic concepts. Systems of equations
Basic concepts. Systems of equations
 
Plot function in R
Plot function in RPlot function in R
Plot function in R
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
SATISFIABILITY METHODS FOR COLOURING GRAPHS
SATISFIABILITY METHODS FOR COLOURING GRAPHSSATISFIABILITY METHODS FOR COLOURING GRAPHS
SATISFIABILITY METHODS FOR COLOURING GRAPHS
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
 
Python (regular expression)
Python (regular expression)Python (regular expression)
Python (regular expression)
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
Matrices
MatricesMatrices
Matrices
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
String in c in erode SENGUNTHAR engineering .pptx
String in c in erode SENGUNTHAR engineering .pptxString in c in erode SENGUNTHAR engineering .pptx
String in c in erode SENGUNTHAR engineering .pptx
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdf
 
4tocontest
4tocontest4tocontest
4tocontest
 
Array and string
Array and stringArray and string
Array and string
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptx
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
An ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite MachinesAn ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
 
Nn
NnNn
Nn
 
1. Introduction.pptx
1. Introduction.pptx1. Introduction.pptx
1. Introduction.pptx
 
14 ruby strings
14 ruby strings14 ruby strings
14 ruby strings
 

Más de krishahuja1992

Más de krishahuja1992 (20)

Write a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdfWrite a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdf
 
Write a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdfWrite a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdf
 
Write as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdfWrite as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdf
 
write a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdfwrite a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdf
 
Write a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdfWrite a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdf
 
Write a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdfWrite a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdf
 
Why my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdfWhy my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdf
 
Why was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdfWhy was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdf
 
Why is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdfWhy is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdf
 
Which statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdfWhich statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdf
 
will upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdfwill upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdf
 
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdfWhichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdf
 
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdfWilla, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdf
 
Write a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdfWrite a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdf
 
Why the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdfWhy the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdf
 
Why do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdfWhy do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdf
 
Why are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdfWhy are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdf
 
Which statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdfWhich statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdf
 
With statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdfWith statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdf
 
You noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdfYou noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdf
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

Write C source code for this problemYou are given a grid of lette.pdf

  • 1. Write C source code for this problem: You are given a grid of letters, followed by some words. the words can occur anywhere in the grid on a row or a column, forward or backward. However, there are no diagonal words. Write an algorithm to find if the given word occurs in the grid on a row or a column, forward or backward. Input: The first line of input consists of two integers- grid_row and grid_col, representing the number of rows (N) and the number of columns (M) of the letter grid, respectively. The next M lines consist of N space-separated characters representing the letters of the grid. The next line consists of an integer- word_size, representing the number of words to be searched from the given grid (k). The last line consists of K space-separated strings representing the words to search for in the grid. Output: Print K space-separated strings consisting of "Yes" if the word is present in the grid or "No" if the word is not present in the grid.