当前位置:网站首页>Subset enumeration method
Subset enumeration method
2022-07-03 22:37:00 【four hundred and eighty-six thousand six hundred and fifty-seven】
There are three kinds of subset enumeration : Incremental construction / Bit vector method / Binary method
And in the 《 Explain profound theories in simple language 》 Binary method is mentioned in
Binary method
Similar to bit vector method , Also enumerate the status of each location , But this time in binary , Binary length is N, Same size as the original set . The second is binary i Bit represents the... In the original set i Whether the bit is selected , Enumerate various situations . Set size is N, Namely 2 Of N Secondary mode . At this time, we should use mathematical knowledge ———— Combine 、 Complement set 、 intersection 、 contain 、 Belong to etc .
set up A、B Is the binary representation of two sets , be
- The intersection is expressed as A & B
- Union is expressed as A | B
- The symmetric difference set is expressed as A ^ B
- The complement is expressed as ALL ^ A [ among ALL = (1 << n) - 1]
[ Enumerate all subsets ]:
enumeration 0 To (1 << n) - 1 Every number in i, Then put the numbers i Convert to binary ,
If i Of the j Is it 1, Represents a collection i contain a[j];
If i Of the j Is it 0, Represents a collection i It doesn't contain a[j].
Templates
- Print digit i Represents a collection of
1 2 3 4 5 6 7 8 |
|
- Enumerate all subsets
1 2 3 4 5 |
|
- Enumerate all sizes k Subset
1 2 3 4 5 6 7 |
|
- [ Enumerate a given set x All subsets of ]
1 2 3 4 5 |
|
边栏推荐
- Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
- Blue Bridge Cup -- guess age
- File copy method
- Blue Bridge Cup Guoxin Changtian MCU -- program download (III)
- [dynamic programming] Jisuan Ke: Jumping stake (variant of the longest increasing subsequence)
- Electronic tube: Literature Research on basic characteristics of 6j1
- How can enterprises and developers take advantage of the explosion of cloud native landing?
- 2022 G3 boiler water treatment registration examination and G3 boiler water treatment examination papers
- Flutter internationalized Intl
- Wisdom tooth technology announced that it had completed the round D financing of US $100million and had not obtained a valid patent yet
猜你喜欢
Buuctf, misc: n solutions
How can enterprises and developers take advantage of the explosion of cloud native landing?
Harbor integrated LDAP authentication
Es6~es12 knowledge sorting and summary
Learning notes of raspberry pie 4B - IO communication (SPI)
Format cluster and start cluster
6.0 kernel driver character driver
Covariance
[flax high frequency question] leetcode 426 Convert binary search tree to sorted double linked list
Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
随机推荐
Team collaborative combat penetration tool CS artifact cobalt strike
China's TPMS industry demand forecast and future development trend analysis report Ⓐ 2022 ~ 2028
Kali2021.4a build PWN environment
C deep anatomy - the concept of keywords and variables # dry inventory #
Investment analysis and prospect trend prediction report of China's boron nitride industry Ⓨ 2022 ~ 2028
WiFi 2.4g/5g/6g channel distribution
Format cluster and start cluster
Plug - in Oil Monkey
Analysis report on the development trend and Prospect of global and Chinese supercontinuum laser source industry Ⓚ 2022 ~ 2027
Morning flowers and evening flowers
JS Demo calcule combien de jours il reste de l'année
Can you draw with turtle?
540. Single element in ordered array
Blue Bridge Cup Guoxin Changtian single chip microcomputer -- led lamp module (V)
Text replacement demo
[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)
Quick one click batch adding video text watermark and modifying video size simple tutorial
LeetCode 1646. Get the maximum value in the generated array
Mysql database - Advanced SQL statement (I)
Awk getting started to proficient series - awk quick start