File tree Expand file tree Collapse file tree 2 files changed +27
-24
lines changed Expand file tree Collapse file tree 2 files changed +27
-24
lines changed Original file line number Diff line number Diff line change 283283*  [ 动态规划:不同路径] ( https://mp.weixin.qq.com/s/MGgGIt4QCpFMROE9X9he_A ) 
284284*  [ 动态规划:不同路径还不够,要有障碍!] ( https://mp.weixin.qq.com/s/lhqF0O4le9-wvalptOVOww ) 
285285*  [ 动态规划:整数拆分,你要怎么拆?] ( https://mp.weixin.qq.com/s/cVbyHrsWH_Rfzlj-ESr01A ) 
286+ *  [ 动态规划:不同的二叉搜索树] ( https://mp.weixin.qq.com/s/8VE8pDrGxTf8NEVYBDwONw ) 
287+ 
286288
287289(持续更新中....)
288290
Original file line number Diff line number Diff line change @@ -240,32 +240,33 @@ void backtracking(参数) {
240240
241241## 并查集   
242242
243- int n = 1005; // 更具题意而定 
244- int father[ 1005] ;
243+ ``` 
244+  int n = 1005; // 更具题意而定  
245+  int father[1005]; 
245246
246- // 并查集初始化
247- void init() {
248-  for (int i = 0; i < n; ++i) {
249-  father[ i]  = i;
247+  // 并查集初始化 
248+  void init() { 
249+  for (int i = 0; i < n; ++i) { 
250+  father[i] = i; 
251+  } 
252+  } 
253+  // 并查集里寻根的过程 
254+  int find(int u) { 
255+  return u == father[u] ? u : father[u] = find(father[u]); 
256+  } 
257+  // 将v->u 这条边加入并查集 
258+  void join(int u, int v) { 
259+  u = find(u); 
260+  v = find(v); 
261+  if (u == v) return ; 
262+  father[v] = u; 
263+  } 
264+  // 判断 u 和 v是否找到同一个根 
265+  bool same(int u, int v) { 
266+  u = find(u); 
267+  v = find(v); 
268+  return u == v; 
250269 } 
251- }
252- // 并查集里寻根的过程
253- int find(int u) {
254-  return u == father[ u]  ? u : father[ u]  = find(father[ u] );
255- }
256- // 将v->u 这条边加入并查集
257- void join(int u, int v) {
258-  u = find(u);
259-  v = find(v);
260-  if (u == v) return ;
261-  father[ v]  = u;
262- }
263- // 判断 u 和 v是否找到同一个根
264- bool same(int u, int v) {
265-  u = find(u);
266-  v = find(v);
267-  return u == v;
268- }
269270``` 
270271
271272
                                 You can’t perform that action at this time. 
               
                  
0 commit comments