Results 1 to 1 of 1

Thread: Binary numbers

  1. #1
    Aug 2008

    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:

    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:

    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; Aug 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: Feb 8th 2011, 12:47 AM
  2. Replies: 4
    Last Post: Jul 3rd 2010, 11:30 PM
  3. convert single numbers to 5 bit binary
    Posted in the Number Theory Forum
    Replies: 4
    Last Post: Jun 28th 2010, 06:18 PM
  4. Binary
    Posted in the Math Topics Forum
    Replies: 1
    Last Post: Sep 20th 2009, 09:30 PM
  5. Binary
    Posted in the Algebra Forum
    Replies: 1
    Last Post: Oct 1st 2008, 01:28 PM

Search Tags

/mathhelpforum @mathhelpforum