当前位置:网站首页>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 |
|
边栏推荐
- 6.0 kernel driver character driver
- Pointer concept & character pointer & pointer array yyds dry inventory
- Covariance
- [Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)
- In 2022, 6G development has indeed warmed up
- 4 environment construction -standalone ha
- webAssembly
- JS closure knowledge points essence
- How to switch between dual graphics cards of notebook computer
- The 14th five year plan and investment feasibility study report of China's industry university research cooperation Ⓧ 2022 ~ 2028
猜你喜欢

Buuctf, misc: n solutions

QGIS grid processing DEM data reclassification

Code in keil5 -- use the code formatting tool astyle (plug-in)

1068. Consolidation of ring stones (ring, interval DP)

How to solve win10 black screen with only mouse arrow

How to restore the factory settings of HP computer

Programming language (2)
![[SRS] build a specified version of SRS](/img/01/0d2d762e01b304220b8924d20277e3.jpg)
[SRS] build a specified version of SRS

540. Single element in ordered array

pivot ROP Emporium
随机推荐
[sg function] 2021 Niuke winter vacation training camp 6 h. winter messenger 2
[dynamic programming] Jisuan Ke: Jumping stake (variant of the longest increasing subsequence)
2 spark environment setup local
How can enterprises and developers take advantage of the explosion of cloud native landing?
2022 safety officer-b certificate examination summary and safety officer-b certificate simulation test questions
Report on the development strategy of China's engineering bidding agency and suggestions for the 14th five year plan Ⓙ 2022 ~ 2028
China's TPMS industry demand forecast and future development trend analysis report Ⓐ 2022 ~ 2028
DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
Report on the development status and investment planning trends of China's data center industry Ⓡ 2022 ~ 2028
How does sentinel, a traffic management artifact, make it easy for business parties to access?
WiFi 2.4g/5g/6g channel distribution
Quick one click batch adding video text watermark and modifying video size simple tutorial
320. Energy Necklace (ring, interval DP)
[sg function] lightoj Partitioning Game
How the computer flushes the local DNS cache
The overseas listing of Shangmei group received feedback, and brands such as Han Shu and Yiye have been notified for many times and received attention
3 environment construction -standalone
Morning flowers and evening flowers
The difference between SRAM and DRAM
Summary of fluent systemchrome