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 525215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:38:54+00:00 2026-05-13T08:38:54+00:00

Lets say I have 4 different values A,B,C,D with sets of identifiers attached. A={1,2,3,4,5}

  • 0

Lets say I have 4 different values A,B,C,D with sets of identifiers attached.

A={1,2,3,4,5}
B={8,9,4}
C={3,4,5}
D={12,8}

And given set S of identifiers {1,30,3,4,5,12,8} I want it to return C and D. i.e. retrieve all sets from a group of sets for which S is a superset.

Is there any algorithms to perform this task efficiently (Preferably with low memory complexity. Using external device for storing data is not an option) ?
A trivial solution would be for each member in the superset S retrieve list of sets that include that member (basically inverted index) and for each returned set check that all of his members are in the superset. Unfortunately because on average the superset will include at least one member for each set there is a significant and unacceptable performance hit with this approach.

I am trying to do this in Java. Set consist of integers and the value they identify is an object.
Collection of sets is not static and bound to change during the course of execution. There will be some limit on the set number though.
Set size is not limited. But on average it’s between 1 and 20.

  • 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-13T08:38:54+00:00Added an answer on May 13, 2026 at 8:38 am
    1. Go through each element x in S.
    2. For each set t for which x ∈ t, increment a counter—call it tcount—associated with t.
    3. After all that, for each set t for which tcount = | t |, you know that t ⊆ S.

    Application.

    After step 2.

    Acount = 4,
    Bcount = 1,
    Ccount = 3,
    Dcount = 2.

    Step 3 processing.

    Acount ≠ |A| (4 ≠ 5) — Reject,
    Bcount ≠ |B| (1 ≠ 3) — Reject,
    Ccount = |C| (3 = 3) — Accept,
    Dcount = |D| (2 = 2) — Accept.

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

Sidebar

Related Questions

Lets say i have 2 languages in 2 different xmls, when I develop my
Lets say I have a simple ecommerce site that sells 100 different t-shirt designs.
lets say I have two matrices, of a different size: a = zeros(1,100); b
I have two total different implementations of AsyncTask , lets say AT1 and AT2
Lets say there are two pages with two different html elements which have the
I have a set of elements/keys which I'm reading from two different config files.
lets's say I have: // all objects have valid mapping to database public class
Lets say i have a form with 2 textboxs im in a different thread
lets say you have some function x = foo(alpha, beta); and you want to
Lets say for example, I have a form, and i post the values to

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.