Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4028898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:16:40+00:00 2026-05-20T11:16:40+00:00

Suppose I have a set of tuples like this (each tuple will have 1,2

  • 0

Suppose I have a set of tuples like this (each tuple will have 1,2 or 3 items):

Master Set:

 {(A) (A,C) (B,C,E)}

and suppose I have another set of tuples like this:

Real Set: {(BOB) (TOM) (ERIC,SALLY,CHARLIE) (TOM,SALLY) (DANNY) (DANNY,TOM) (SALLY) (SALLY,TOM,ERIC) (BOB,SALLY) }

What I want to do is to extract all subsets of Tuples from the Real Set where the tuple members can be substituted to become the same as the Master Set.

In the example above, two sets would be returned:

{(BOB) (BOB,SALLY) (ERIC,SALLY,CHARLIE)}

(let BOB=A,ERIC=B,SALLY=C,CHARLIE=E)

and

{(DANNY) (DANNY,TOM) (SALLY,TOM,ERIC)}

(let DANNY=A,SALLY=B,TOM=C,ERIC=E)

Its sort of pattern matching, sort of combinatorics I guess. I really don’t know how to classify this problem and what common plans of attack there are for it. What would the stackoverflow experts suggest?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:16:41+00:00Added an answer on May 20, 2026 at 11:16 am

    Seperate your tuples into sets by size. Within each set, create a data structure that allows you to efficiently query for tuples containing a given element. The first part of this structure is your tuples as an array (so that each tuple has a cannonical index). The second set is: Map String (Set Int). This is somewhat space intensive but hopefully not prohibative.

    Then, you, essentially, brute force it. For all assignments to the first master set, restrict all assignments to other master sets. For all remaining assignments to the second, restrict all assignments to the third and beyond, etc. The algorithm is basically inductive.

    I should add that I don’t think the problem is NP-complete so much as just flat worst-case exponential. It’s not a decision problem, but an enumeration problem. And it’s fairly easy to imagine scenarios of inputs that blow up exponentially.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a database like this: This is set up to give role-wise
Suppose I have a collection with some set of documents. something like this. {
There is a design problem like this. Suppose you have a set of class
Suppose I have a set in SQL like this: Product | Quantity A 1
Suppose I have mappings set-up like this; there are CodeType rows in the database,
(i'm using Visual C+++ 2010) suppose i have defined a tuple like this: typedef
Suppose I have public class Product: Entity { public IList<Item> Items { get; set;
Suppose I have this set: a = set([(1,2),(3,4),(5,6)]) How do I test if 3
I have this question in my text book: Suppose that we have a set
Suppose I have a set of tuples with people's names. I want to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.