Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

pairing with out repeattaions

Posted on 2011-05-08
12
Medium Priority
?
425 Views
Last Modified: 2012-05-11
there are 1000 people.
starting from 1 to 1000.

1 can pair with (2 to 1000)  so there are 999 combinations.
2 can pair with (1,3 to 1000) so there are 999 combinations.
.. up to 1000.

effectively there are 1000 multiplied by 1000 combinations.
==
If you see that case 1 is paired to 2.
so there is no need for 2 to again paired and counted to 1.

using this logic how many possible combinations are possible?
what is the formula that can be derived?


0
Comment
Question by:vkchaitu82
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 35715016
1000 choose 2 = (1000!)/((2!)*((1000-2)!)) = 499500
0
 

Author Comment

by:vkchaitu82
ID: 35715020
can you  please explain me the logic
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35715022
C(1000,2)

=1000!/(2! *(1000-2)!)

=(1000*999)/(1*2)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 85

Expert Comment

by:ozo
ID: 35715024
as you said, 1000 ways to choose the first element of the pair, 999 ways to choose the second element of the pair,
but the order does not matter, so divide by the number of ways the pair can be ordered.
0
 

Author Comment

by:vkchaitu82
ID: 35715034
thanks ozo,
1000! for first combination.
1*2 as the ways paired.  you also have *(1000-2)? why is that
0
 
LVL 85

Expert Comment

by:ozo
ID: 35715040
1000!/(1000-2)!  =
1000*999*998*997*996*...
/
998*997*996*...
= 1000*999
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 35715059
Hmmmm Surely not?
Surely the answer is 250,000

The first person can be paired with n-1 people, here thats 1000-1 or 999
The second person can be paired with n-3 or 997
The third person can be paired with n-5 or 995

For all people upto the value of n/2

So its (n-1)+(n-3)+(n-5)...+(n-n/2))

=250,000 for a start value of 1000.
0
 
LVL 85

Expert Comment

by:ozo
ID: 35715060
Or, if you meant the number of ways to choose 500 disjoint pairs of items from 1000 items,
rather than the number of ways to choose a single pair, that would be the double factorial
1*3*5*7*...*999
0
 
LVL 85

Expert Comment

by:ozo
ID: 35715064
As there seems to be some confusion about what is being asked, perhaps you could clarify with a smaller example.
If there were 8 people, would the answer you were looking for be 105, 28, or 16?
0
 
LVL 10

Expert Comment

by:abbright
ID: 35715334
Everybody has 999 pairings so there are 1000*999 pairs. Now every pair is represented twice so if you count these two as one you get 1000*999/2=499500.
Here is a link for a more general explanation of this: http://mathforum.org/library/drmath/view/61212.html
0
 

Author Comment

by:vkchaitu82
ID: 35715448
thanks abbright.
if we want to represent in a algorithm how can we do that?
basically i want know the formula not only to have the total count but also the possible combination.
0
 
LVL 10

Accepted Solution

by:
abbright earned 2000 total points
ID: 35715505
The total count of pairs for n people is n*(n-1)/2.

In algorithmic form you could think of something like:

for p1=1 to 1000 do   #this loops through all people
     for p2=p1+1 to 1000 do   # this loops through all people with numbers higher than p1
          print p1,p2
     done
done

In this algorithm you get all pairs where p1<p2 which guarantees that you get every combination (p1,p2) or (p2,p1) only once.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I came across an unsolved Outlook issue and here is my solution.
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question