![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Location: Philippines
Posts: 21
Rep Power: 0
![]() |
Nid Help:about combinations
Is there any functions that can show the number of combinations of a number... for example: 1) show the number of cobinations(without repeatition) from numbers 1 to 7,
example: (1234567) combinations: 123456 123457 123467 123567 124567 134567 234567 or what kind of algorithm will i do to present the numbers( i think for loops will be the key in showing the solution). |
|
|
|
|
|
#2 |
|
Unverified User
Join Date: Aug 2006
Posts: 88
Rep Power: 0
![]() |
Am i seeing double.
Did you not post exactly the same question in the C++ forum and grumpy gave you a very good hint on how to do it? Seriously if you cant figure out your own algorithms then you will never succeed at programming. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 155
Rep Power: 3
![]() |
Permutations?
You say it should show the number of combinations with the numbers 1-7, but in your example you only use a 6 ciphered number? Shouldn't it be 1234567 1234576 1234657 1234675 I agree with Random Spirit, there's no reason to create two threads when you're searching an algorithm. And as Random Spririt said, grumpy came with some good hints to how you do it, then follow them!
__________________
-- v0id
|
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
I don't know why you posted this in the Java forum. It has nothing to do with Java or any other programming language.
The number of combinations of n objects taken m at a time is n!/((n-m)!*m!). The only algorithm I can think of at the moment is a ridiculously inefficient recursive solution. It's 2 in the morning and I've got a splitting headache. I'm sure someone in a better mental state will be able to help you. edit: v0id, you're talking about P(7,7), he's doing C(7,6) edit again: I'm using the P() and C() notation my math teacher used. She's a retard, so she may well have cooked that up. P(n, m) is the number of permutations of n objects taken m at a time.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 155
Rep Power: 3
![]() |
Oh, okay, my bad.
__________________
-- v0id
|
|
|
|
|
|
#6 |
|
Professional Programmer
|
I think the proper notation is nPr and nCr
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Newbie prob:how to make combinations without repeatition | veiga2 | C++ | 4 | Aug 16th, 2006 6:02 AM |
| Recursion & Combinations | JavaBeginner | Java | 1 | Dec 19th, 2005 3:09 AM |
| All Combinations | iignotus | C++ | 7 | Jul 10th, 2005 7:36 PM |
| Combinations | Gilward Kukel | Python | 2 | Jun 7th, 2005 2:10 PM |
| Recursive algorithm - combinations | tuthjaa | PHP | 1 | Feb 16th, 2005 9:17 PM |