Thread: binary combination.

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    130

    binary combination.

    Hello,

    I was working on a problem for generating the binary combination of x digits, as input. E.g. for x = 2, I have 2^2-1:

    0--> 00
    1--> 01
    2--> 10
    3--> 11

    My program solves this by converting the decimal values to binary and then padding the required leftmost zeros.

    Is there any other optimized solution?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You can show us your code and we will tell you if it can be made in other better way
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. arrays vs lists? And containers in general!
    By clegs in forum C++ Programming
    Replies: 22
    Last Post: 12-03-2007, 02:02 PM
  2. Replies: 0
    Last Post: 11-04-2006, 11:07 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM