Discussion in 'C' started by linsd, Sep 30, 2011.

1. ### linsdNew Member

Joined:
Sep 30, 2011
Messages:
1
0
Trophy Points:
0
Problem Statement: Consider a matrix of size N x N
comprising of numbers 0 or 1. Given such a matrix,
problem is to find the location of a given pattern. For
example, if the pattern to be searched is as follows:

X 0 0 1
0 X 0 0
X X 0 1 (X: donâ€™t care could be 0 or 1)

then your program should identify ALL occurrences of the
above similar patterns in the entire matrix. Typical output
from your program should be displayed as follows:
=======================
Output and Statistics:
Pattern 1 found at the following location(s):
(1,4), (5,8), â€¦.(100,605),â€¦
Number of patterns found: 73
Time Taken: 0.000234secs
======
Pattern 2 found at the following location(s):
4
(11,4), (15,81), â€¦.(200,201),â€¦
Number of patterns found: 12
Time Taken: 0.000012secs
=======
Pattern 3 found at the following location(s):
NIL
Number of patterns found: 0
Time Taken: 0.0000001secs
â€¦
======
Search completed!
Statistics:
Most popular pattern: <display the pattern that has most
counts> (If you have more than one display them all)
Least popular pattern: <display the pattern that has least
counts>(If you have more than one display them all)
Total time taken: 0.083456 secs
======================