当前位置:网站首页>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 |
|
边栏推荐
- Development mode and Prospect of China's IT training industry strategic planning trend report Ⓣ 2022 ~ 2028
- [golang] leetcode intermediate - alphabetic combination of island number and phone number
- What indicators should be paid attention to in current limit monitoring?
- Code in keil5 -- use the code formatting tool astyle (plug-in)
- WFC900M-Network_ Card/Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-900M-high-power-Mini-PCIe-Wi-Fi-Mod
- The 14th five year plan for the construction of Chinese Enterprise Universities and the feasibility study report on investment Ⓓ 2022 ~ 2028
- AST (Abstract Syntax Tree)
- SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
- Programming language (2)
- Codeforces Round #768 (Div. 1)(A-C)
猜你喜欢

Redis single thread and multi thread

Opengauss database log management guide

On my first day at work, this API timeout optimization put me down!

Overview of Yunxi database executor

Buuctf, misc: sniffed traffic

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

Go Technology Daily (2022-02-13) - Summary of experience in database storage selection

2022 free examination questions for safety management personnel of hazardous chemical business units and reexamination examination for safety management personnel of hazardous chemical business units

How the computer flushes the local DNS cache

Blue Bridge Cup -- guess age
随机推荐
Label coco format data and format data in the upper left corner and lower right corner are mutually converted
How to connect a laptop to a projector
Get current JVM data
DR-AP40X9-A-Qualcomm-IPQ-4019-IPQ-4029-5G-4G-LTE-aluminum-body-dual-band-wifi-router-2.4GHZ-5GHz-QSD
2022 electrician (elementary) examination questions and electrician (elementary) registration examination
C deep anatomy - the concept of keywords and variables # dry inventory #
[SRS] build a specified version of SRS
How to solve the problem of computer networking but showing no Internet connection
1 Introduction to spark Foundation
The 14th five year plan for the construction of Chinese Enterprise Universities and the feasibility study report on investment Ⓓ 2022 ~ 2028
What are the common computer problems and solutions
How to solve the problem of requiring a password when accessing your network neighborhood on your computer
China's coal industry investment strategic planning future production and marketing demand forecast report Ⓘ 2022 ~ 2028
[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)
STM32 multi serial port implementation of printf -- Based on cubemx
Take you to master the formatter of visual studio code
油猴插件
Programming language (2)
Overview of Yunxi database executor
Market layout planning and latest dynamic analysis report of China's smart public security industry Ⓕ 2022 ~ 2028