binary combination.

This is a discussion on binary combination. within the C Programming forums, part of the General Programming Boards category; Hello, I was working on a problem for generating the binary combination of x digits, as input. E.g. for x ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    You can show us your code and we will tell you if it can be made in other better way
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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, 01:02 PM
  2. Replies: 0
    Last Post: 11-04-2006, 10: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, 08:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21