Results 1 to 1 of 1

Math Help - Binary numbers

  1. #1
    Newbie
    Joined
    Aug 2008
    Posts
    1

    Binary numbers

    An (sorted) array consists of (a random amount of) random unique integers between 0 and 2^32 - 1.

    In base 2 the array could, for example, look like this:

    Code:
    00000000000000000000000000000100
    00000000000000000000000000000110
    00000000000000000000000000010010
    ...
    11111111111011011111100101001100
    Given another random integer x between 0 and 2^32 - 1, how do I find the integer in the array that shares the most ones and zeros with x in the same position (in binary notation)? If there are multiple cases, any of the cases will do.

    The following two numbers will, for example, differ in only one place:

    Code:
    00000000000000000000000000010010
    00000000000000000000000000110010
    I cannot check them one at a time, I need to do it faster. A binary search-style approach would be perfect.

    Feel free to transform the array and x into something else.
    Last edited by h.m.j.karlsson; August 8th 2008 at 05:27 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Binary Representation of Real Numbers
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: February 8th 2011, 12:47 AM
  2. Replies: 4
    Last Post: July 3rd 2010, 11:30 PM
  3. convert single numbers to 5 bit binary
    Posted in the Number Theory Forum
    Replies: 4
    Last Post: June 28th 2010, 06:18 PM
  4. Binary
    Posted in the Math Topics Forum
    Replies: 1
    Last Post: September 20th 2009, 09:30 PM
  5. Binary
    Posted in the Algebra Forum
    Replies: 1
    Last Post: October 1st 2008, 01:28 PM

Search Tags


/mathhelpforum @mathhelpforum