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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:15:46+00:00 2026-05-20T08:15:46+00:00

As part of my master thesis, I get a number (e.g. 5 bits) with

  • 0

As part of my master thesis, I get a number (e.g. 5 bits) with 2 significant bits (2nd and 4th). This means for example x1x0x, where $x \in {0,1}$ (x could be 0 or 1) and 1,0 are bits with fixed values.

My first task is to compute all the combinations of the above given number , 2^3 = 8. This is called S_1 group.

Then I need to compute ‘S_2’ group and this is all the combinations of the two numbers x0x0x and x1x1x(this means one mismatch in the significant bits), this should give us $\bin{2}{1} * 2^3 = 2 * 2^3 = 16.

EDIT
Each number, x1x1x and x0x0x, is different from the Original number, x1x0x, at one significant bit.

Last group, S_3, is of course two mismatches from the significant bits, this means, all the numbers which pass the form x0x1x, 8 possibilities.

The computation could be computed recursively or independently, that is not a problem.

I would be happy if someone could give a starting point for these computations, since what I have is not so efficient.

EDIT
Maybe I chose my words wrongly, using significant bits. What I meant to say is that a specific places in a five bits number the bit are fixed. Those places I defined as specific bits.

EDIT
I saw already 2 answers and it seems I should have been clearer. What I am more interested in, is finding the numbers x0x0x, x1x1x and x0x1x with respect that this is a simply example. In reality, the group S_1 (in this example x1x0x) would be built with at least 12 bit long numbers and could contain 11 significant bits. Then I would have 12 groups…

If something is still not clear please ask 😉

  • 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-20T08:15:47+00:00Added an answer on May 20, 2026 at 8:15 am
    #include <vector>
    #include <iostream>
    #include <iomanip>
    
    using namespace std;
    
    int main()
    {
        string format = "x1x0x";
    
        unsigned int sigBits = 0;
        unsigned int sigMask = 0;
        unsigned int numSigBits = 0;
        for (unsigned int i = 0; i < format.length(); ++i)
        {
            sigBits <<= 1;
            sigMask <<= 1;
            if (format[i] != 'x')
            {
                sigBits |= (format[i] - '0');
                sigMask |= 1;
                ++numSigBits;
            }
        }
    
        unsigned int numBits = format.length();
        unsigned int maxNum = (1 << numBits);
    
        vector<vector<unsigned int> > S;
        for (unsigned int i = 0; i <= numSigBits; i++)
            S.push_back(vector<unsigned int>());
    
        for (unsigned int i = 0; i < maxNum; ++i)
        {
            unsigned int changedBits = (i & sigMask) ^ sigBits;
    
            unsigned int distance = 0;
            for (unsigned int j = 0; j < numBits; j++)
            {
                if (changedBits & 0x01)
                    ++distance;
                changedBits >>= 1;
            }
    
            S[distance].push_back(i);
        }
    
        for (unsigned int i = 0; i <= numSigBits; ++i)
        {
            cout << dec << "Set with distance " << i << endl;
            vector<unsigned int>::iterator iter = S[i].begin();
            while (iter != S[i].end())
            {
                cout << hex << showbase << *iter << endl;
                ++iter;
            }
    
            cout << endl;
        }
    
        return 0;
    }
    

    sigMask has a 1 where all your specific bits are. sigBits has a 1 wherever your specific bits are 1. changedBits has a 1 wherever the current value of i is different from sigBits. distance counts the number of bits that have changed. This is about as efficient as you can get without precomputing a lookup table for the distance calculation.

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

Sidebar

Related Questions

Part of my code I get the OuterHTML propery <LI onclick=TabClicked(this, 'SearchName', 'TabGroup1');>Name so
I am currenty writing my master's thesis about monitoring of distributed systems. For this
Consider this part of a repository of mine: / myproject django -> django/master (django/django
Ok i've to admin i'm not a master in recursion. This could be kinda
this is my Script part in Master page : <script src=../../Scripts/jquery-1.7.1.min.js type=text/javascript></script> <script src=../../Scripts/jquery.ui.datepicker.js
Part of my code goes like this: while(1){ my $winmm = new Win32::MediaPlayer; $winmm->load('1.mp3');
Here's a part of my mapping: <hibernate-mapping package=trx.domain> <class name=Master table=master dynamic-update=true dynamic-insert=true> <set
This question comes as part of my doubts presented on a broader question about
Imagine this: you have a Master-Child window consisting of a list of items (the
This is a follow up to this question. I cloned the remote master project

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.