• Post Reply Bookmark Topic Watch Topic
  • New Topic

Program to find if a matrix is subset of another matrix  RSS feed

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two matrices. example { 2 3
4 5} and {1 2 3
6 4 5}. These matrices are just a sample and actual can be different from these. So, we need to find if 1st matrix is subset of 2nd matrix.

Please let me know how can we do this with minimum time/space complexity.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same technique as here.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Kumar Bindal wrote:These matrices are just a sample and actual can be different from these. So, we need to find if 1st matrix is subset of 2nd matrix.

When you say "matrix", do you mean an array or a genuine matrix? If the first, then it's a simple 'string-style' search (either brute-force or an optimized one). If it's a genuine matrix, then you may have more than one dimension to consider.

Winston
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Kumar Bindal wrote:Please let me know how can we do this with minimum time/space complexity.

What have you attempted?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!