当前位置:网站首页>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 |
|
边栏推荐
- Flutter internationalized Intl
- SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
- Summary of basic knowledge of exception handling
- C3p0 connection MySQL 8.0.11 configuration problem
- 2 spark environment setup local
- Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
- Uboot migration
- LeetCode 1647. Minimum deletion times of unique character frequency
- Creation of the template of the password management software keepassdx
- LeetCode 1646. Get the maximum value in the generated array
猜你喜欢

Unique in China! Alibaba cloud container service enters the Forrester leader quadrant

Covariance

Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
![[Android reverse] use DB browser to view and modify SQLite database (download DB browser installation package | install DB browser tool)](/img/1d/044e81258db86cf34eddd3b8f5cf90.jpg)
[Android reverse] use DB browser to view and modify SQLite database (download DB browser installation package | install DB browser tool)

QGIS grid processing DEM data reclassification

2022 safety officer-a certificate registration examination and summary of safety officer-a certificate examination

string

The latest analysis of R1 quick opening pressure vessel operation in 2022 and the examination question bank of R1 quick opening pressure vessel operation

The 2022 global software R & D technology conference was released, and world-class masters such as Turing prize winners attended

2022 electrician (elementary) examination questions and electrician (elementary) registration examination
随机推荐
Common problems in multi-threaded learning (I) ArrayList under high concurrency and weird hasmap under concurrency
The 14th five year plan and investment feasibility study report of China's industry university research cooperation Ⓧ 2022 ~ 2028
Analysis report on the development trend and Prospect of global and Chinese supercontinuum laser source industry Ⓚ 2022 ~ 2027
js demo 计算本年度还剩下多少天
Summary of fluent systemchrome
China's Call Center Industry 14th five year plan direction and operation analysis report Ⓔ 2022 ~ 2028
Plug - in Oil Monkey
[template summary] - binary search tree BST - Basics
[dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)
JS closure knowledge points essence
Blue Bridge Cup Guoxin Changtian single chip microcomputer -- software environment (II)
The latest analysis of R1 quick opening pressure vessel operation in 2022 and the examination question bank of R1 quick opening pressure vessel operation
What indicators should be paid attention to in current limit monitoring?
Blue Bridge Cup -- Mason prime
Buuctf, misc: sniffed traffic
Mindmanager2022 serial number key decompression installer tutorial
Teach you how to run two or more MySQL databases at the same time in one system
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
[golang] leetcode intermediate - alphabetic combination of island number and phone number
China's coal industry investment strategic planning future production and marketing demand forecast report Ⓘ 2022 ~ 2028