• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Program to find if a matrix is subset of another matrix

 
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.
 
Marshal
Posts: 65396
248
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same technique as here.
 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE 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
 
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?
 
His brain is the size of a cherry pit! About the size of this ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!