Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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: 69457
277
  • 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?
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic