当前位置:网站首页>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 |
|
边栏推荐
- DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
- [dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)
- Teach you how to run two or more MySQL databases at the same time in one system
- SDMU OJ#P19. Stock trading
- DR-AP40X9-A-Qualcomm-IPQ-4019-IPQ-4029-5G-4G-LTE-aluminum-body-dual-band-wifi-router-2.4GHZ-5GHz-QSD
- Uboot migration
- Firefox set up proxy server
- Learning notes of raspberry pie 4B - IO communication (SPI)
- Conditional statements of shell programming
- 2022 G3 boiler water treatment registration examination and G3 boiler water treatment examination papers
猜你喜欢

Mysql database - Advanced SQL statement (I)

Some 5000+ likes, the development notes of a director of cosmic factory, leaked

User login function: simple but difficult

Take you to master the formatter of visual studio code

Overview of Yunxi database executor

Harbor integrated LDAP authentication

JS closure knowledge points essence

Teach you how to run two or more MySQL databases at the same time in one system

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

Can you draw with turtle?
随机推荐
LeetCode 540. A single element in an ordered array
The reason why the computer runs slowly and how to solve it
This time, thoroughly understand bidirectional data binding 01
How to connect a laptop to a projector
Label coco format data and format data in the upper left corner and lower right corner are mutually converted
js demo 計算本年度還剩下多少天
Covariance
Blue Bridge Cup Guoxin Changtian single chip microcomputer -- software environment (II)
Opengauss database log management guide
6.2 normalization 6.2.5 third normal form (3NF)
DR882-Qualcomm-Atheros-QCA9882-2T2R-MIMO-802.11ac-Mini-PCIe-Wi-Fi-Module-5G-high-power
JS closure knowledge points essence
Get current JVM data
Rest reference
Kali2021.4a build PWN environment
Ansible common usage scenarios
The latest analysis of crane driver (limited to bridge crane) in 2022 and the test questions and analysis of crane driver (limited to bridge crane)
Blue Bridge Cup -- Mason prime
Data consistency between redis and database
[sg function] 2021 Niuke winter vacation training camp 6 h. winter messenger 2