Results 1 to 3 of 3

Thread: A Question !?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    A Question !?

    I had this question on the major exam

    Q: devise an algorithm for generating all the r-combinations of a finite set when repetition is allowed.


    my answer was a big space

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    Sql_lall: Perhaps your code might not take a lot of time for all combinations of 10 items three at a time.

    Would you like to wait for the end of a program which copes with all combinations of 200 items 20 at a time?
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  3. #3
    sql_lall
    Guest

    Wink I know...

    1) I understand what the question is asking.

    2) No, i wouldn't want to wait, but it says **devise** an algorithm, not implement it.

    3) Actually, it would take longer to find all combinations of 200 objects 200 at a time with repetition allowed.

    4) n objects, taken in r-combinations (r = 0 to n), WITHOUT repetition = 2^n different combinations. With repetition it takes even more.

    All i'm saying is that if you had to make an algorithm (as the question asks), that is the way to do it. There is no possible way that you could make one fast enough dealing with large numbers that would be worth waiting for an answer!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width