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

  • Home
  • SEARCH
  • 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 872901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:51:12+00:00 2026-05-15T10:51:12+00:00

Given a matrix of boolean values (example): a b c +——– X | 1

  • 0

Given a matrix of boolean values (example):

    a  b  c
  +--------
X | 1  0  1  
Y | 1  1  1
Z | 0  1  1
  +--------

What’s the optimum way to find all sequences [a|b|c] such that each sequence has at least one “true” (1) value for each of X, Y and Z.

In the example above, the set of sequences is (in no particular order):

  abc, ab, ac, bc, c

Whereas these sequences do not satisfy the requirement:

  a (doesn't provide Z)
  b (doesn't provide X)

I’m actually looking for a generalized algorithm for an arbitrary matrix.

Any ideas?

  • 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-15T10:51:13+00:00Added an answer on May 15, 2026 at 10:51 am

    Basically you’re solving X & Y & Z where X = a | c, Y = a | b | c, Z = b | c for a, b and c.

    So basically you’re looking for all solutions of SAT on a formula in conjunctive normal form. Although some simplifications exist, basically any approach will be O(2N). The algorithms for efficiently finding a solution of this class of problem are listed in the wikipedia article; however if you want all solutions you will be iterating over 2N possibilities anyway, so simply enumerating them and testing will suffice.

    A few trivial optimisations:

    • there are no negations in the formula, so if you have a solution, then adding any other variable to that solution will also be a solution. Your OP says you want all solutions; for large matrices there will be many solutions based on the same necessary basis and all selections of unnecessary values.
    • if you and all the values in a column and get 1, then that column is a basis for a solution (that column and any selection of other columns is a solution)
    • if you or all the values in a column and get 0, then that column does not contribute to the basis of any solution
    • approaches based on combining sets to find bases (only add a column to the set if it selects a row which is not selected) might be better than approaches finding all solutions
    • if you go with the approach of combining sets which do/do solve the problem – the union of non-solutions or the intersection of solutions – it may be better to divide the rows into two, and use positive approach for rows with few 1s, and the negative approach for rows with few 0s.

    Since it is a 2N problem, it is reasonable to assume that N<64, and so you can make some implementation optimisations, but you won’t reduce the size of the problem.

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

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See if this is of any help. May 16, 2026 at 11:08 am
  • Editorial Team
    Editorial Team added an answer In Groovy, if your strings are delimited as such, you… May 16, 2026 at 11:08 am
  • Editorial Team
    Editorial Team added an answer Try adding position: relative; to your css statement. If it's… May 16, 2026 at 11:08 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some simple code that represents a graph using a square boolean matrix
Given a NxN matrix with 0s and 1s. Set every row that contains a
for example, given a matrix: 1 2 3 4 5 6 7 8 9
I need to create a function to rotate a given matrix (list of lists)
I have a m x n matrix where each row consists of zeros and
Given: <div class=subMenu> <a href=products.aspx class=subLink>Products</a> <a href=productCats.aspx class=subLink>Categories</a> <a href=example.aspx class=subLink>Another</a> </div> In
I've noticed something about my coding that is slightly undefined. Say we have a
I defined a matrix structure in C using typedef double mymatrix[30][30][10]; so now I
if i have a function A,which can apply a certain rule on a given
I want to make a program which will determine the Rank of a given

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.