2020-07-11 12:21:17 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2022-09-08 08:17:03 +08:00
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
2020-07-11 12:21:17 +08:00
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
2021-10-26 03:34:27 +08:00
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2022-09-08 08:17:03 +08:00
< meta name = "generator" content = "Doxygen 1.9.5" / >
2020-07-11 12:21:17 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: misc/union_find.c File Reference< / title >
< link href = "../../tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../jquery.js" > < / script >
< script type = "text/javascript" src = "../../dynsections.js" > < / script >
< link href = "../../navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../resize.js" > < / script >
< script type = "text/javascript" src = "../../navtreedata.js" > < / script >
< script type = "text/javascript" src = "../../navtree.js" > < / script >
< link href = "../../search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../search/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / script >
< script type = "text/x-mathjax-config" >
2021-10-26 03:34:27 +08:00
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
2020-07-11 12:21:17 +08:00
});
< / script >
< script type = "text/javascript" async = "async" src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js" > < / script >
< link href = "../../doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
2022-01-15 04:11:27 +08:00
< tr id = "projectrow" >
< td id = "projectalign" >
2021-10-26 03:34:27 +08:00
< div id = "projectname" > Algorithms_in_C< span id = "projectnumber" >   1.0.0< / span >
2020-07-11 12:21:17 +08:00
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2022-09-08 08:17:03 +08:00
<!-- Generated by Doxygen 1.9.5 -->
2020-07-11 12:21:17 +08:00
< script type = "text/javascript" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2022-09-08 08:17:03 +08:00
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
2020-07-11 12:21:17 +08:00
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-07-11 12:21:17 +08:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
2021-10-26 03:34:27 +08:00
/* @license-end */
< / script >
2020-07-11 12:21:17 +08:00
< div id = "main-nav" > < / div >
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-07-11 12:21:17 +08:00
$(document).ready(function(){initNavTree('df/df3/union__find_8c.html','../../'); initResizable(); });
/* @license-end */
< / script >
< div id = "doc-content" >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
2022-09-08 08:17:03 +08:00
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
2020-07-11 12:21:17 +08:00
< / div >
< div class = "header" >
< div class = "summary" >
< a href = "#define-members" > Macros< / a > |
< a href = "#func-members" > Functions< / a > < / div >
2021-10-26 03:34:27 +08:00
< div class = "headertitle" > < div class = "title" > union_find.c File Reference< / div > < / div >
2020-07-11 12:21:17 +08:00
< / div > <!-- header -->
< div class = "contents" >
2021-10-26 03:34:27 +08:00
< p > < a href = "https://en.wikipedia.org/wiki/Disjoint-set_data_structure" target = "_blank" > Union find< / a > algorithm.
2020-07-11 12:21:17 +08:00
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < stdio.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
< / div > < div class = "textblock" > < div class = "dynheader" >
Include dependency graph for union_find.c:< / div >
< div class = "dyncontent" >
2022-09-08 08:17:03 +08:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d3/d60/union__find_8c__incl.svg" width = "160" height = "110" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2020-07-11 12:21:17 +08:00
< / div >
< / div >
< / div > < table class = "memberdecls" >
2021-10-26 03:34:27 +08:00
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "define-members" name = "define-members" > < / a >
2020-07-11 12:21:17 +08:00
Macros< / h2 > < / td > < / tr >
2021-10-26 03:34:27 +08:00
< tr class = "memitem:a0592dba56693fad79136250c11e5a7fe" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "a0592dba56693fad79136250c11e5a7fe" name = "a0592dba56693fad79136250c11e5a7fe" > < / a >
#define  < / td > < td class = "memItemRight" valign = "bottom" > < b > MAX_SIZE< / b >       1000< / td > < / tr >
2020-07-11 12:21:17 +08:00
< tr class = "memdesc:a0592dba56693fad79136250c11e5a7fe" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > maximum number of elements in the set < br / > < / td > < / tr >
< tr class = "separator:a0592dba56693fad79136250c11e5a7fe" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
2021-10-26 03:34:27 +08:00
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
2020-07-11 12:21:17 +08:00
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a3e13b69cce5a1b25ae034798092f3d86" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (int *p, int x)< / td > < / tr >
< tr class = "memdesc:a3e13b69cce5a1b25ae034798092f3d86" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Find index of or value in an array. < a href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a3e13b69cce5a1b25ae034798092f3d86" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:af2f3ff6d98641f7d3be11f071c97908a" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > join< / a > (int *p, int x, int y)< / td > < / tr >
< tr class = "memdesc:af2f3ff6d98641f7d3be11f071c97908a" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Function to join. < a href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:af2f3ff6d98641f7d3be11f071c97908a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2021-10-26 03:34:27 +08:00
< tr class = "memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/df3/union__find_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > main< / a > ()< / td > < / tr >
< tr class = "memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Main function. < a href = "../../df/df3/union__find_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > More...< / a > < br / > < / td > < / tr >
2020-07-11 12:21:17 +08:00
< tr class = "separator:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
2021-10-26 03:34:27 +08:00
< div class = "textblock" > < p > < a href = "https://en.wikipedia.org/wiki/Disjoint-set_data_structure" target = "_blank" > Union find< / a > algorithm. < / p >
2020-07-11 12:21:17 +08:00
< / div > < h2 class = "groupheader" > Function Documentation< / h2 >
2021-10-26 03:34:27 +08:00
< a id = "a3e13b69cce5a1b25ae034798092f3d86" name = "a3e13b69cce5a1b25ae034798092f3d86" > < / a >
2022-09-08 08:17:03 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a3e13b69cce5a1b25ae034798092f3d86" > ◆   < / a > < / span > find()< / h2 >
2020-07-11 12:21:17 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int find < / td >
< td > (< / td >
< td class = "paramtype" > int *  < / td >
< td class = "paramname" > < em > p< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > x< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Find index of or value in an array. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramdir" > [in,out]< / td > < td class = "paramname" > p< / td > < td > array to search and update < / td > < / tr >
< tr > < td class = "paramdir" > < / td > < td class = "paramname" > x< / td > < td > value to search < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > value at the index < code > x< / code > < / dd > < / dl >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 18< / span > {< / div >
< div class = "line" > < span class = "lineno" > 19< / span > < span class = "keywordflow" > if< / span > (x > = < a class = "code hl_define" href = "../../df/df3/union__find_8c.html#a0592dba56693fad79136250c11e5a7fe" > MAX_SIZE< / a > )< / div >
< div class = "line" > < span class = "lineno" > 20< / span > {< / div >
< div class = "line" > < span class = "lineno" > 21< / span > fprintf(stderr, < span class = "stringliteral" > " Out-of bounds value\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 22< / span > exit(EXIT_FAILURE);< / div >
< div class = "line" > < span class = "lineno" > 23< / span > }< / div >
< div class = "line" > < span class = "lineno" > 24< / span > < / div >
< div class = "line" > < span class = "lineno" > 25< / span > < span class = "keywordflow" > if< / span > (p[x] == x)< / div >
< div class = "line" > < span class = "lineno" > 26< / span > {< / div >
< div class = "line" > < span class = "lineno" > 27< / span > < span class = "keywordflow" > return< / span > x;< / div >
< div class = "line" > < span class = "lineno" > 28< / span > }< / div >
< div class = "line" > < span class = "lineno" > 29< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < span class = "lineno" > 30< / span > {< / div >
< div class = "line" > < span class = "lineno" > 31< / span > p[x] = < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (p, p[x]);< / div >
< div class = "line" > < span class = "lineno" > 32< / span > < span class = "keywordflow" > return< / span > p[x];< / div >
< div class = "line" > < span class = "lineno" > 33< / span > }< / div >
< div class = "line" > < span class = "lineno" > 34< / span > }< / div >
2021-02-06 03:52:57 +08:00
< div class = "ttc" id = "aunion__find_8c_html_a0592dba56693fad79136250c11e5a7fe" > < div class = "ttname" > < a href = "../../df/df3/union__find_8c.html#a0592dba56693fad79136250c11e5a7fe" > MAX_SIZE< / a > < / div > < div class = "ttdeci" > #define MAX_SIZE< / div > < div class = "ttdoc" > maximum number of elements in the set< / div > < div class = "ttdef" > < b > Definition:< / b > union_find.c:8< / div > < / div >
< div class = "ttc" id = "aunion__find_8c_html_a3e13b69cce5a1b25ae034798092f3d86" > < div class = "ttname" > < a href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > < / div > < div class = "ttdeci" > int find(int *p, int x)< / div > < div class = "ttdoc" > Find index of or value in an array.< / div > < div class = "ttdef" > < b > Definition:< / b > union_find.c:17< / div > < / div >
2021-10-26 03:34:27 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2022-09-08 08:17:03 +08:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/df3/union__find_8c_a3e13b69cce5a1b25ae034798092f3d86_cgraph.svg" width = "54" height = "60" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-10-26 03:34:27 +08:00
< / div >
< / div >
2020-07-11 12:21:17 +08:00
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "af2f3ff6d98641f7d3be11f071c97908a" name = "af2f3ff6d98641f7d3be11f071c97908a" > < / a >
2022-09-08 08:17:03 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#af2f3ff6d98641f7d3be11f071c97908a" > ◆   < / a > < / span > join()< / h2 >
2020-07-11 12:21:17 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void join < / td >
< td > (< / td >
< td class = "paramtype" > int *  < / td >
< td class = "paramname" > < em > p< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > x< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > y< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Function to join. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramdir" > [in,out]< / td > < td class = "paramname" > p< / td > < td > array to join in < / td > < / tr >
< tr > < td class = "paramdir" > < / td > < td class = "paramname" > x< / td > < td > value or index to join to < / td > < / tr >
< tr > < td class = "paramdir" > < / td > < td class = "paramname" > y< / td > < td > value or index to join from < / td > < / tr >
< / table >
< / dd >
< / dl >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 42< / span > { p[< a class = "code hl_function" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (p, x)] = < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (p, y); }< / div >
2021-10-26 03:34:27 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2022-09-08 08:17:03 +08:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/df3/union__find_8c_af2f3ff6d98641f7d3be11f071c97908a_cgraph.svg" width = "144" height = "60" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-10-26 03:34:27 +08:00
< / div >
< / div >
< / div >
< / div >
< a id = "ae66f6b31b5ad750f1fe042a706a4e3d4" name = "ae66f6b31b5ad750f1fe042a706a4e3d4" > < / a >
2022-09-08 08:17:03 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ae66f6b31b5ad750f1fe042a706a4e3d4" > ◆   < / a > < / span > main()< / h2 >
2021-10-26 03:34:27 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int main < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Main function. < / p >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 46< / span > {< / div >
< div class = "line" > < span class = "lineno" > 47< / span > < span class = "keywordtype" > int< / span > union_set[< a class = "code hl_define" href = "../../df/df3/union__find_8c.html#a0592dba56693fad79136250c11e5a7fe" > MAX_SIZE< / a > ];< / div >
< div class = "line" > < span class = "lineno" > 48< / span > < / div >
< div class = "line" > < span class = "lineno" > 49< / span > < span class = "comment" > // Have all array indexes that you need to use reference themselves< / span > < / div >
< div class = "line" > < span class = "lineno" > 50< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > int< / span > i = 0; i < 10; i++)< / div >
< div class = "line" > < span class = "lineno" > 51< / span > {< / div >
< div class = "line" > < span class = "lineno" > 52< / span > union_set[i] = i;< / div >
< div class = "line" > < span class = "lineno" > 53< / span > }< / div >
< div class = "line" > < span class = "lineno" > 54< / span > < span class = "comment" > // p = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}< / span > < / div >
< div class = "line" > < span class = "lineno" > 55< / span > < / div >
< div class = "line" > < span class = "lineno" > 56< / span > < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > join< / a > (union_set, 3, 5);< / div >
< div class = "line" > < span class = "lineno" > 57< / span > printf(< span class = "stringliteral" > " The array is now: " < / span > );< / div >
< div class = "line" > < span class = "lineno" > 58< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > int< / span > i = 0; i < 10; i++)< / div >
< div class = "line" > < span class = "lineno" > 59< / span > {< / div >
< div class = "line" > < span class = "lineno" > 60< / span > printf(< span class = "stringliteral" > " %d " < / span > , union_set[i]);< / div >
< div class = "line" > < span class = "lineno" > 61< / span > }< / div >
< div class = "line" > < span class = "lineno" > 62< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 63< / span > < span class = "comment" > // Now 3 and 5 are groupped together, that is find(3) = find(5)< / span > < / div >
< div class = "line" > < span class = "lineno" > 64< / span > < span class = "comment" > // p = {0, 1, 2, 5, 4, 5, 6, 7, 8, 9}< / span > < / div >
< div class = "line" > < span class = "lineno" > 65< / span > < / div >
< div class = "line" > < span class = "lineno" > 66< / span > < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > join< / a > (union_set, 3, 8);< / div >
< div class = "line" > < span class = "lineno" > 67< / span > printf(< span class = "stringliteral" > " The array is now: " < / span > );< / div >
< div class = "line" > < span class = "lineno" > 68< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > int< / span > i = 0; i < 10; i++)< / div >
< div class = "line" > < span class = "lineno" > 69< / span > {< / div >
< div class = "line" > < span class = "lineno" > 70< / span > printf(< span class = "stringliteral" > " %d " < / span > , union_set[i]);< / div >
< div class = "line" > < span class = "lineno" > 71< / span > }< / div >
< div class = "line" > < span class = "lineno" > 72< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 73< / span > < / div >
< div class = "line" > < span class = "lineno" > 74< / span > < span class = "comment" > // Now 3, 5 and are groupped together, find(3) = find(5) = find(8)< / span > < / div >
< div class = "line" > < span class = "lineno" > 75< / span > < span class = "comment" > // p = {0, 1, 2, 5, 4, 8, 6, 7, 8, 9}< / span > < / div >
< div class = "line" > < span class = "lineno" > 76< / span > < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > join< / a > (union_set, 0, 5);< / div >
< div class = "line" > < span class = "lineno" > 77< / span > < span class = "keywordflow" > if< / span > (< a class = "code hl_function" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (union_set, 0) == < a class = "code hl_function" href = "../../df/df3/union__find_8c.html#a3e13b69cce5a1b25ae034798092f3d86" > find< / a > (union_set, 3))< / div >
< div class = "line" > < span class = "lineno" > 78< / span > {< / div >
< div class = "line" > < span class = "lineno" > 79< / span > printf(< span class = "stringliteral" > " 0 and 3 are groupped together\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 80< / span > }< / div >
< div class = "line" > < span class = "lineno" > 81< / span > printf(< span class = "stringliteral" > " The array is now: " < / span > );< / div >
< div class = "line" > < span class = "lineno" > 82< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > int< / span > i = 0; i < 10; i++)< / div >
< div class = "line" > < span class = "lineno" > 83< / span > {< / div >
< div class = "line" > < span class = "lineno" > 84< / span > printf(< span class = "stringliteral" > " %d " < / span > , union_set[i]);< / div >
< div class = "line" > < span class = "lineno" > 85< / span > }< / div >
< div class = "line" > < span class = "lineno" > 86< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 87< / span > < / div >
< div class = "line" > < span class = "lineno" > 88< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < span class = "lineno" > 89< / span > }< / div >
2021-10-26 03:34:27 +08:00
< div class = "ttc" id = "aunion__find_8c_html_af2f3ff6d98641f7d3be11f071c97908a" > < div class = "ttname" > < a href = "../../df/df3/union__find_8c.html#af2f3ff6d98641f7d3be11f071c97908a" > join< / a > < / div > < div class = "ttdeci" > void join(int *p, int x, int y)< / div > < div class = "ttdoc" > Function to join.< / div > < div class = "ttdef" > < b > Definition:< / b > union_find.c:42< / div > < / div >
2020-07-11 12:21:17 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2022-09-08 08:17:03 +08:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/df3/union__find_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width = "243" height = "86" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2020-07-11 12:21:17 +08:00
< / div >
< / div >
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "../../dir_a52f4d3d586a58b02f3a4ddf0a992157.html" > misc< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../df/df3/union__find_8c.html" > union_find.c< / a > < / li >
2022-09-08 08:17:03 +08:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "../../doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.9.5 < / li >
2020-07-11 12:21:17 +08:00
< / ul >
< / div >
< / body >
< / html >