当前位置:网站首页>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 |
|
边栏推荐
- On my first day at work, this API timeout optimization put me down!
- 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
- 油猴插件
- How can enterprises and developers take advantage of the explosion of cloud native landing?
- Opengauss database log management guide
- How to restore the factory settings of HP computer
- Why should enterprises do more application activities?
- On my first day at work, this API timeout optimization put me down!
- 2022 G3 boiler water treatment registration examination and G3 boiler water treatment examination papers
- Yyds dry goods inventory Spring Festival "make" your own fireworks
猜你喜欢

What are the common computer problems and solutions

3 environment construction -standalone

Preliminary analysis of smart microwave radar module

Format cluster and start cluster

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

Pointer concept & character pointer & pointer array yyds dry inventory

Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)

Opengauss database log management guide

Firefox set up proxy server

4 environment construction -standalone ha
随机推荐
1 Introduction to spark Foundation
Get current JVM data
AST (Abstract Syntax Tree)
How can enterprises and developers take advantage of the explosion of cloud native landing?
Flutter internationalized Intl
Is it safe and reliable to open an account and register for stock speculation? Is there any risk?
3 environment construction -standalone
Why should enterprises do more application activities?
JS closure knowledge points essence
Redis single thread and multi thread
6.0 kernel driver character driver
To rotate 90 degrees clockwise and modify the video format
2022 G3 boiler water treatment registration examination and G3 boiler water treatment examination papers
js demo 計算本年度還剩下多少天
2022 electrician (elementary) examination questions and electrician (elementary) registration examination
IDENTITY
Simple solution of m3u8 file format
Firefox set up proxy server
[sg function] lightoj Partitioning Game
Investment analysis and prospect trend prediction report of China's boron nitride industry Ⓨ 2022 ~ 2028