If i have a 2D matrix of characters or integer or whatever!How do i check if another matrix is a sub-matrix of The 2D one ...Please!! help with simple code that work for any size of the matrices


Thanks in advance to all .

if you are searching for smaller matrix S in a larger matrix L:

search for the first element of S, let's say S[1][1] in matrix L, as soon as you find a match keep searching for the immediate matches, if the immediate matches did not exist, then keep going for another match of S[1][1] in the larger matrix, until finding it or reaching the end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.