Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 15th, 2006, 4:17 AM   #1
veiga2
Newbie
 
veiga2's Avatar
 
Join Date: May 2006
Location: Philippines
Posts: 21
Rep Power: 0 veiga2 is an unknown quantity at this point
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).
veiga2 is offline   Reply With Quote
Old Aug 15th, 2006, 5:04 AM   #2
Random Spirit
Unverified User
 
Join Date: Aug 2006
Posts: 88
Rep Power: 0 Random Spirit is on a distinguished road
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.
Random Spirit is offline   Reply With Quote
Old Aug 15th, 2006, 5:15 AM   #3
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
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
or something like that?

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
v0id is offline   Reply With Quote
Old Aug 15th, 2006, 5:21 AM   #4
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
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
uman is offline   Reply With Quote
Old Aug 15th, 2006, 5:44 AM   #5
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
Oh, okay, my bad.
__________________
-- v0id
v0id is offline   Reply With Quote
Old Aug 15th, 2006, 2:49 PM   #6
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 319
Rep Power: 4 andro is on a distinguished road
Send a message via AIM to andro
I think the proper notation is nPr and nCr
andro is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:59 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC