aboutsummaryrefslogtreecommitdiffstats
path: root/doc/latex/classmeow_1_1DisjointSet.tex
blob: d49a00d7635da43a1f68f2930d59d28e11fd987e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
\hypertarget{classmeow_1_1DisjointSet}{\section{meow\-:\-:Disjoint\-Set Class Reference}
\label{classmeow_1_1DisjointSet}\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}}
}


用來維護一堆互斥集的資訊  




{\ttfamily \#include \char`\"{}Disjoint\-Set.\-h\char`\"{}}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classmeow_1_1DisjointSet_a8c55a16b0320c28854ed59795bc2bf3d}{Disjoint\-Set} ()
\begin{DoxyCompactList}\small\item\em constructor \end{DoxyCompactList}\item 
\hyperlink{classmeow_1_1DisjointSet_af86aee43ff23d616c1c065c0825d000c}{Disjoint\-Set} (size\-\_\-t n)
\begin{DoxyCompactList}\small\item\em constructor \end{DoxyCompactList}\item 
\hyperlink{classmeow_1_1DisjointSet_ade3ec2924018ac0fd6693e3ae966516f}{Disjoint\-Set} (\hyperlink{classmeow_1_1DisjointSet}{Disjoint\-Set} const \&dsj)
\begin{DoxyCompactList}\small\item\em constructor \end{DoxyCompactList}\item 
size\-\_\-t \hyperlink{classmeow_1_1DisjointSet_a0b66ca7c5e19f640b521630f06b313c1}{root} (size\-\_\-t a) const 
\begin{DoxyCompactList}\small\item\em 回傳指定的number所在的 {\bfseries 集合的編號} \end{DoxyCompactList}\item 
size\-\_\-t \hyperlink{classmeow_1_1DisjointSet_a1738123f2c0456bec373d4a8422d62b5}{size} () const 
\begin{DoxyCompactList}\small\item\em 回傳總element數 \end{DoxyCompactList}\item 
void \hyperlink{classmeow_1_1DisjointSet_a232841a6d2daeb2b974cd7cb7fe6bfb7}{reset} (size\-\_\-t n)
\begin{DoxyCompactList}\small\item\em 重設 \end{DoxyCompactList}\item 
size\-\_\-t \hyperlink{classmeow_1_1DisjointSet_a410399290f718332f5c3df1854182198}{merge} (size\-\_\-t a, size\-\_\-t b)
\begin{DoxyCompactList}\small\item\em 合併 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
用來維護一堆互斥集的資訊 

\hyperlink{classmeow_1_1DisjointSet}{Disjoint\-Set} 是個 {\bfseries 輕量級\-Data} {\bfseries Dtructure}, 用來維護一堆互斥集的資訊. \par
相關資料可參考 \href{http://www.csie.ntnu.edu.tw/~u91029/DisjointSets.html}{\tt 演算法筆記 }

\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item 時間複雜度 {\bfseries 非常快} 表示它真的算的超級快, 可以視為常數時間
\item 預設值所有 {\itshape number} 所在的集合的編號就是 {\itshape number} 本身, 即沒有任兩個數在同一個set裡面
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxyAuthor}{Author}
cat\-\_\-leopard 
\end{DoxyAuthor}


Definition at line 25 of file Disjoint\-Set.\-h.



\subsection{Constructor \& Destructor Documentation}
\hypertarget{classmeow_1_1DisjointSet_a8c55a16b0320c28854ed59795bc2bf3d}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!Disjoint\-Set@{Disjoint\-Set}}
\index{Disjoint\-Set@{Disjoint\-Set}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{Disjoint\-Set}]{\setlength{\rightskip}{0pt plus 5cm}meow\-::\-Disjoint\-Set\-::\-Disjoint\-Set (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_a8c55a16b0320c28854ed59795bc2bf3d}


constructor 



Definition at line 54 of file Disjoint\-Set.\-h.

\hypertarget{classmeow_1_1DisjointSet_af86aee43ff23d616c1c065c0825d000c}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!Disjoint\-Set@{Disjoint\-Set}}
\index{Disjoint\-Set@{Disjoint\-Set}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{Disjoint\-Set}]{\setlength{\rightskip}{0pt plus 5cm}meow\-::\-Disjoint\-Set\-::\-Disjoint\-Set (
\begin{DoxyParamCaption}
\item[{size\-\_\-t}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_af86aee43ff23d616c1c065c0825d000c}


constructor 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n} & elements數 \\
\hline
\end{DoxyParams}


Definition at line 62 of file Disjoint\-Set.\-h.

\hypertarget{classmeow_1_1DisjointSet_ade3ec2924018ac0fd6693e3ae966516f}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!Disjoint\-Set@{Disjoint\-Set}}
\index{Disjoint\-Set@{Disjoint\-Set}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{Disjoint\-Set}]{\setlength{\rightskip}{0pt plus 5cm}meow\-::\-Disjoint\-Set\-::\-Disjoint\-Set (
\begin{DoxyParamCaption}
\item[{{\bf Disjoint\-Set} const \&}]{dsj}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_ade3ec2924018ac0fd6693e3ae966516f}


constructor 

將另一個 {\ttfamily \hyperlink{classmeow_1_1DisjointSet}{Disjoint\-Set}} 原封不動的複製過來


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em dsj} & 另一個 {\ttfamily \hyperlink{classmeow_1_1DisjointSet}{Disjoint\-Set}} \\
\hline
\end{DoxyParams}


Definition at line 73 of file Disjoint\-Set.\-h.



\subsection{Member Function Documentation}
\hypertarget{classmeow_1_1DisjointSet_a410399290f718332f5c3df1854182198}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!merge@{merge}}
\index{merge@{merge}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{merge}]{\setlength{\rightskip}{0pt plus 5cm}size\-\_\-t meow\-::\-Disjoint\-Set\-::merge (
\begin{DoxyParamCaption}
\item[{size\-\_\-t}]{a, }
\item[{size\-\_\-t}]{b}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_a410399290f718332f5c3df1854182198}


合併 

將 {\itshape number1} 所在的集合 跟 {\bfseries number2} 所在的集合 {\bfseries 合併}, 並回傳合併後新的集合的編號. \par
時間複雜度{\bfseries 非常快} 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em a} & 即上述{\itshape number1} \\
\hline
\mbox{\tt in}  & {\em b} & 即上述{\itshape number2} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
新的編號 
\end{DoxyReturn}


Definition at line 128 of file Disjoint\-Set.\-h.

\hypertarget{classmeow_1_1DisjointSet_a232841a6d2daeb2b974cd7cb7fe6bfb7}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!reset@{reset}}
\index{reset@{reset}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{reset}]{\setlength{\rightskip}{0pt plus 5cm}void meow\-::\-Disjoint\-Set\-::reset (
\begin{DoxyParamCaption}
\item[{size\-\_\-t}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_a232841a6d2daeb2b974cd7cb7fe6bfb7}


重設 

清空, 並且設定總集合大小為 {\itshape n} 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n} & 重新設定的集合大小 {\itshape n} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}\end{DoxyReturn}


Definition at line 107 of file Disjoint\-Set.\-h.

\hypertarget{classmeow_1_1DisjointSet_a0b66ca7c5e19f640b521630f06b313c1}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!root@{root}}
\index{root@{root}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{root}]{\setlength{\rightskip}{0pt plus 5cm}size\-\_\-t meow\-::\-Disjoint\-Set\-::root (
\begin{DoxyParamCaption}
\item[{size\-\_\-t}]{a}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_a0b66ca7c5e19f640b521630f06b313c1}


回傳指定的number所在的 {\bfseries 集合的編號} 

時間複雜度 {\bfseries 超級快} 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em a} & 指定的number \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
集合的編號 
\end{DoxyReturn}


Definition at line 85 of file Disjoint\-Set.\-h.

\hypertarget{classmeow_1_1DisjointSet_a1738123f2c0456bec373d4a8422d62b5}{\index{meow\-::\-Disjoint\-Set@{meow\-::\-Disjoint\-Set}!size@{size}}
\index{size@{size}!meow::DisjointSet@{meow\-::\-Disjoint\-Set}}
\subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}size\-\_\-t meow\-::\-Disjoint\-Set\-::size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1DisjointSet_a1738123f2c0456bec373d4a8422d62b5}


回傳總element數 

\begin{DoxyReturn}{Returns}
總element數 
\end{DoxyReturn}


Definition at line 95 of file Disjoint\-Set.\-h.



The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
meowpp/dsa/\hyperlink{DisjointSet_8h}{Disjoint\-Set.\-h}\end{DoxyCompactItemize}