Given a set containing N elements. If two subset X and Y picked then find the probability that both of them contains the same number of elements.
Let’s choose a subset X that has r number of elements then Y must contain r number of elements. A subset can have minimum 0 elements and maximum N elements.
Total number of subset of a set contains N number of elements is , Total possible way to choose X and Y simultaneously will be = = .
Let, P = Total possible way to choose X and Y such that both has same number of elements.
Then P = = =
So the required probability will be .
Below is the implementation of the above Approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Maximum sum subset having equal number of positive and negative elements
- Maximum number of elements greater than X after equally distributing subset of array
- Fibonacci sum of a subset with all elements <= k
- Maximum subset sum such that no two elements in set have same digit in them
- Largest subset whose all elements are Fibonacci numbers
- Find the length of the Largest subset such that all elements are Pairwise Coprime
- Find maximum subset sum formed by partitioning any subset of array into 2 partitions with equal sum
- Probability that a N digit number is palindrome
- Random number generator in arbitrary probability distribution fashion
- Probability of getting a perfect square when a random number is chosen in a given range
- Check whether bitwise AND of a number with any subset of an array is zero or not
- Largest subset with M as smallest missing number
- Count number of subsets whose median is also present in the same subset
- Largest possible Subset from an Array such that no element is K times any other element in the Subset
- Python | Number of elements to be removed such that product of adjacent elements is always even
- Largest number dividing maximum number of elements in the array
- Smallest number dividing minimum number of elements in the Array
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Smallest number dividing minimum number of elements in the array | Set 2
- Sum of elements in 1st array such that number of elements less than or equal to them in 2nd array is maximum
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.