Documentation for 416a3bc169

This commit is contained in:
github-actions
2020-08-19 19:45:18 +00:00
parent b3f9bef796
commit 00c8db1c8b
326 changed files with 14135 additions and 5183 deletions

View File

@@ -0,0 +1,790 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: range_queries::heavy_light_decomposition::Tree&lt; X &gt; Class Template 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">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</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>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Algorithms_in_C++
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.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">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="../../d9/d4e/classrange__queries_1_1heavy__light__decomposition_1_1_tree-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">range_queries::heavy_light_decomposition::Tree&lt; X &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A Basic <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html" title="A Basic Tree, which supports binary lifting.">Tree</a>, which supports binary lifting.
<a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for range_queries::heavy_light_decomposition::Tree&lt; X &gt;:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../da/dcc/classrange__queries_1_1heavy__light__decomposition_1_1_tree__inherit__graph.svg" width="158" height="171"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a target="top" href="../../graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for range_queries::heavy_light_decomposition::Tree&lt; X &gt;:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../de/d4c/classrange__queries_1_1heavy__light__decomposition_1_1_tree__coll__graph.svg" width="626" height="231"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a target="top" href="../../graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a835fb2bbb27307b8cacad9b287968bc1"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a835fb2bbb27307b8cacad9b287968bc1">Tree</a> (int nodes)</td></tr>
<tr class="memdesc:a835fb2bbb27307b8cacad9b287968bc1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class parameterized constructor, resizes the and initializes the data members. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a835fb2bbb27307b8cacad9b287968bc1">More...</a><br /></td></tr>
<tr class="separator:a835fb2bbb27307b8cacad9b287968bc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79ab4601c4a95c0902ac04e779e5f54d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a79ab4601c4a95c0902ac04e779e5f54d">add_edge</a> (const int u, const int v)</td></tr>
<tr class="memdesc:a79ab4601c4a95c0902ac04e779e5f54d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds an undirected edge from node u to node v in the tree. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a79ab4601c4a95c0902ac04e779e5f54d">More...</a><br /></td></tr>
<tr class="separator:a79ab4601c4a95c0902ac04e779e5f54d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab916d554afa8ca5230b4310c2c69fae0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab916d554afa8ca5230b4310c2c69fae0">change_root</a> (int new_root)</td></tr>
<tr class="memdesc:ab916d554afa8ca5230b4310c2c69fae0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the root for the tree. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab916d554afa8ca5230b4310c2c69fae0">More...</a><br /></td></tr>
<tr class="separator:ab916d554afa8ca5230b4310c2c69fae0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04cd96efaba147b19d3afc769b90ff70"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a04cd96efaba147b19d3afc769b90ff70">set_node_val</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; X &gt; &amp;node_val)</td></tr>
<tr class="memdesc:a04cd96efaba147b19d3afc769b90ff70"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the values for all the nodes. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a04cd96efaba147b19d3afc769b90ff70">More...</a><br /></td></tr>
<tr class="separator:a04cd96efaba147b19d3afc769b90ff70"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad22d760a5a33545a70e7ea5e1786c8dc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ad22d760a5a33545a70e7ea5e1786c8dc">init</a> ()</td></tr>
<tr class="memdesc:ad22d760a5a33545a70e7ea5e1786c8dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function must be called after the tree adjacency list and node values are populated The function initializes the required parameters, and populates the segment tree. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ad22d760a5a33545a70e7ea5e1786c8dc">More...</a><br /></td></tr>
<tr class="separator:ad22d760a5a33545a70e7ea5e1786c8dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7761255f2ba06b398b9aae5e4dce5f3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">lift</a> (int *const p, int dist)</td></tr>
<tr class="memdesc:ac7761255f2ba06b398b9aae5e4dce5f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">The function lifts a node, k units up the tree. The lifting is done in place, and the result is stored in the address pointed by p. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">More...</a><br /></td></tr>
<tr class="separator:ac7761255f2ba06b398b9aae5e4dce5f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f7bca1746d40f21ad832fcea59aa6c6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a8f7bca1746d40f21ad832fcea59aa6c6">kth_ancestor</a> (int p, const int &amp;dist)</td></tr>
<tr class="memdesc:a8f7bca1746d40f21ad832fcea59aa6c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">The function returns the kth ancestor of a node. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a8f7bca1746d40f21ad832fcea59aa6c6">More...</a><br /></td></tr>
<tr class="separator:a8f7bca1746d40f21ad832fcea59aa6c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae2b407e64aaf9878fbee7ee6efe9c7d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae2b407e64aaf9878fbee7ee6efe9c7d4">lca</a> (int a, int b)</td></tr>
<tr class="memdesc:ae2b407e64aaf9878fbee7ee6efe9c7d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">The function returns the least common ancestor of two nodes. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae2b407e64aaf9878fbee7ee6efe9c7d4">More...</a><br /></td></tr>
<tr class="separator:ae2b407e64aaf9878fbee7ee6efe9c7d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr class="memitem:aa339c31ec74cd86a4842a8b09653d460"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460">dfs_size</a> (int u, int p=-1)</td></tr>
<tr class="memdesc:aa339c31ec74cd86a4842a8b09653d460"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function to compute sub-tree sizes. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460">More...</a><br /></td></tr>
<tr class="separator:aa339c31ec74cd86a4842a8b09653d460"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae8de7aefcb6635d3dacdd174cd4890c4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4">dfs_lca</a> (int u, int p=-1)</td></tr>
<tr class="memdesc:ae8de7aefcb6635d3dacdd174cd4890c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function to populate the t_par vector. <a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4">More...</a><br /></td></tr>
<tr class="separator:ae8de7aefcb6635d3dacdd174cd4890c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:ab1aeaefa1bd97b867c652ba916fbdb43"><td class="memItemLeft" align="right" valign="top"><a id="ab1aeaefa1bd97b867c652ba916fbdb43"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list.html">std::list</a>&lt; int &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a></td></tr>
<tr class="memdesc:ab1aeaefa1bd97b867c652ba916fbdb43"><td class="mdescLeft">&#160;</td><td class="mdescRight">an adjacency list to stores the tree edges <br /></td></tr>
<tr class="separator:ab1aeaefa1bd97b867c652ba916fbdb43"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4630fa70a80a1dc65a875488a67178a"><td class="memItemLeft" align="right" valign="top"><a id="ae4630fa70a80a1dc65a875488a67178a"></a>
const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a></td></tr>
<tr class="memdesc:ae4630fa70a80a1dc65a875488a67178a"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of nodes <br /></td></tr>
<tr class="separator:ae4630fa70a80a1dc65a875488a67178a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2ab020f798d00be2613ecf63074b7c1"><td class="memItemLeft" align="right" valign="top"><a id="ab2ab020f798d00be2613ecf63074b7c1"></a>
const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a></td></tr>
<tr class="memdesc:ab2ab020f798d00be2613ecf63074b7c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">maximum possible height of the tree <br /></td></tr>
<tr class="separator:ab2ab020f798d00be2613ecf63074b7c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a350157a5fb79f76fceae33fc84171203"><td class="memItemLeft" align="right" valign="top"><a id="a350157a5fb79f76fceae33fc84171203"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a></td></tr>
<tr class="memdesc:a350157a5fb79f76fceae33fc84171203"><td class="mdescLeft">&#160;</td><td class="mdescRight">a matrix to store every node's 2^kth parent <br /></td></tr>
<tr class="separator:a350157a5fb79f76fceae33fc84171203"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0efd0b9c564092f443ca97030d866ef1"><td class="memItemLeft" align="right" valign="top"><a id="a0efd0b9c564092f443ca97030d866ef1"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a></td></tr>
<tr class="memdesc:a0efd0b9c564092f443ca97030d866ef1"><td class="mdescLeft">&#160;</td><td class="mdescRight">a vector to store the depth of a node, <br /></td></tr>
<tr class="separator:a0efd0b9c564092f443ca97030d866ef1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada1494fccbc7f1f07b2f9be9f7e07ad5"><td class="memItemLeft" align="right" valign="top"><a id="ada1494fccbc7f1f07b2f9be9f7e07ad5"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5">t_size</a></td></tr>
<tr class="memdesc:ada1494fccbc7f1f07b2f9be9f7e07ad5"><td class="mdescLeft">&#160;</td><td class="mdescRight">a vector to store the subtree size rooted at node <br /></td></tr>
<tr class="separator:ada1494fccbc7f1f07b2f9be9f7e07ad5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6c37e840355b9fb2105181c578694e8"><td class="memItemLeft" align="right" valign="top"><a id="aa6c37e840355b9fb2105181c578694e8"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">t_root</a></td></tr>
<tr class="memdesc:aa6c37e840355b9fb2105181c578694e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">the root of the tree <br /></td></tr>
<tr class="separator:aa6c37e840355b9fb2105181c578694e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a135b7952593c9b1aae38fcaf1cc1abf7"><td class="memItemLeft" align="right" valign="top"><a id="a135b7952593c9b1aae38fcaf1cc1abf7"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; X &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a135b7952593c9b1aae38fcaf1cc1abf7">t_val</a></td></tr>
<tr class="memdesc:a135b7952593c9b1aae38fcaf1cc1abf7"><td class="mdescLeft">&#160;</td><td class="mdescRight">values of nodes <br /></td></tr>
<tr class="separator:a135b7952593c9b1aae38fcaf1cc1abf7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:afcdadbdea1e2391cebbb17d2c1ae2f0b"><td class="memTemplParams" colspan="2"><a id="afcdadbdea1e2391cebbb17d2c1ae2f0b"></a>
template&lt;typename T &gt; </td></tr>
<tr class="memitem:afcdadbdea1e2391cebbb17d2c1ae2f0b"><td class="memTemplItemLeft" align="right" valign="top">class&#160;</td><td class="memTemplItemRight" valign="bottom"><b>HLD</b></td></tr>
<tr class="separator:afcdadbdea1e2391cebbb17d2c1ae2f0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename X&gt;<br />
class range_queries::heavy_light_decomposition::Tree&lt; X &gt;</h3>
<p>A Basic <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html" title="A Basic Tree, which supports binary lifting.">Tree</a>, which supports binary lifting. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">the</td><td>data type of the values stored in the tree nodes</td></tr>
</table>
</dd>
</dl>
<p>Deleting the default constructor An instance can only be created with the number of nodes Defaults: t_node indexing are zero based t_root is 0 depth of root_node is 0 Supports: lift :- lift a node k units up the tree kth_ancestor :- returns the kth ancestor lca :- returns the least common ancestor </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a835fb2bbb27307b8cacad9b287968bc1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a835fb2bbb27307b8cacad9b287968bc1">&#9670;&nbsp;</a></span>Tree()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::<a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">Tree</a> </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>nodes</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Class parameterized constructor, resizes the and initializes the data members. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">nodes</td><td>the total number of nodes in the tree </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; : <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>(nodes), <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a>(<span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/floor.html">floor</a>(log2(nodes))) + 1) {</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">/* Initialize and resize all the vectors */</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">t_root</a> = 0; <span class="comment">/* Default */</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/resize.html">resize</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/assign.html">assign</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>, <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int&gt;</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a>, -1));</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/assign.html">assign</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>, 0);</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5">t_size</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/assign.html">assign</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>, 1);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a135b7952593c9b1aae38fcaf1cc1abf7">t_val</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/resize.html">resize</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>);</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a835fb2bbb27307b8cacad9b287968bc1_cgraph.svg" width="336" height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a79ab4601c4a95c0902ac04e779e5f54d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a79ab4601c4a95c0902ac04e779e5f54d">&#9670;&nbsp;</a></span>add_edge()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::add_edge </td>
<td>(</td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>u</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>v</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds an undirected edge from node u to node v in the tree. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">u</td><td>the node where the edge is from </td></tr>
<tr><td class="paramname">v</td><td>the node where the edge is to </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; {</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a>[u].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(v);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a>[v].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(u);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a79ab4601c4a95c0902ac04e779e5f54d_cgraph.svg" width="360" height="67"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="ab916d554afa8ca5230b4310c2c69fae0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab916d554afa8ca5230b4310c2c69fae0">&#9670;&nbsp;</a></span>change_root()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::change_root </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>new_root</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the root for the tree. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">new_root</td><td>the new root </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;{ <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">t_root</a> = new_root; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae8de7aefcb6635d3dacdd174cd4890c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae8de7aefcb6635d3dacdd174cd4890c4">&#9670;&nbsp;</a></span>dfs_lca()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::dfs_lca </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>u</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>p</em> = <code>-1</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Utility function to populate the t_par vector. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">u</td><td>current dfs node </td></tr>
<tr><td class="paramname">p</td><td>the parent of node u </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; {</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[u][0] = p;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="keywordflow">if</span> (p != -1) {</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[u] = 1 + <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[p];</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 1; k &lt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a>; k++) {</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[u][k - 1] != -1) {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[u][k] = <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[u][k - 1]][k - 1];</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; }</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; }</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">int</span> &amp;v : <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a>[u]) {</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="keywordflow">if</span> (v ^ p) {</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4">dfs_lca</a>(v, u);</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; }</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; }</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="aa339c31ec74cd86a4842a8b09653d460"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa339c31ec74cd86a4842a8b09653d460">&#9670;&nbsp;</a></span>dfs_size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::dfs_size </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>u</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>p</em> = <code>-1</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Utility function to compute sub-tree sizes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">u</td><td>current dfs node </td></tr>
<tr><td class="paramname">p</td><td>the parent of node</td></tr>
<tr><td class="paramname">u</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; {</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">int</span> &amp;v : <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">t_adj</a>[u]) {</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keywordflow">if</span> (v ^ p) {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460">dfs_size</a>(v, u);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5">t_size</a>[u] += <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5">t_size</a>[v];</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; }</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; }</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="ad22d760a5a33545a70e7ea5e1786c8dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad22d760a5a33545a70e7ea5e1786c8dc">&#9670;&nbsp;</a></span>init()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::init </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>This function must be called after the tree adjacency list and node values are populated The function initializes the required parameters, and populates the segment tree. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; {</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; assert(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a> &gt; 0);</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460">dfs_size</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">t_root</a>);</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4">dfs_lca</a>(<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">t_root</a>);</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_ad22d760a5a33545a70e7ea5e1786c8dc_cgraph.svg" width="352" height="147"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a8f7bca1746d40f21ad832fcea59aa6c6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8f7bca1746d40f21ad832fcea59aa6c6">&#9670;&nbsp;</a></span>kth_ancestor()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::kth_ancestor </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int &amp;&#160;</td>
<td class="paramname"><em>dist</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The function returns the kth ancestor of a node. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">p</td><td>the node id whose kth ancestor is to be found </td></tr>
<tr><td class="paramname">dist</td><td>the distance to move up the tree </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the kth ancestor of node </dd></dl>
<div class="fragment"><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; {</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">lift</a>(&amp;p, dist);</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">return</span> p;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a8f7bca1746d40f21ad832fcea59aa6c6_cgraph.svg" width="352" height="67"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="ae2b407e64aaf9878fbee7ee6efe9c7d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae2b407e64aaf9878fbee7ee6efe9c7d4">&#9670;&nbsp;</a></span>lca()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::lca </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>b</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The function returns the least common ancestor of two nodes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a</td><td>node id_1 </td></tr>
<tr><td class="paramname">b</td><td>node id_2 </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the least common ancestor of node a, and node b </dd></dl>
<div class="fragment"><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; {</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; assert(a &gt;= 0 and b &gt;= 0 and a &lt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a> and b &lt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>);</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[a] &gt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[b]) {</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">lift</a>(&amp;a, <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[a] - <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[b]);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; }</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[b] &gt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[a]) {</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">lift</a>(&amp;b, <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[b] - <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">t_depth</a>[a]);</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; }</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="keywordflow">if</span> (a == b) {</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <span class="keywordflow">return</span> a;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; }</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a> - 1; k &gt;= 0; k--) {</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[a][k] != <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[b][k]) {</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; a = <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[a][k];</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; b = <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[b][k];</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; }</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; }</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="keywordflow">return</span> <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[a][0];</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_ae2b407e64aaf9878fbee7ee6efe9c7d4_cgraph.svg" width="352" height="67"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="ac7761255f2ba06b398b9aae5e4dce5f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7761255f2ba06b398b9aae5e4dce5f3">&#9670;&nbsp;</a></span>lift()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::lift </td>
<td>(</td>
<td class="paramtype">int *const&#160;</td>
<td class="paramname"><em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>dist</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The function lifts a node, k units up the tree. The lifting is done in place, and the result is stored in the address pointed by p. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">p</td><td>a pointer to the variable that stores the node id </td></tr>
<tr><td class="paramname">dist</td><td>the distance to move up the tree </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">t_maxlift</a>; k++) {</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">if</span> (*p == -1) {</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; }</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="keywordflow">if</span> (dist &amp; 1) {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; *p = <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">t_par</a>[*p][k];</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; }</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; dist &gt;&gt;= 1;</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; }</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a04cd96efaba147b19d3afc769b90ff70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a04cd96efaba147b19d3afc769b90ff70">&#9670;&nbsp;</a></span>set_node_val()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename X &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">range_queries::heavy_light_decomposition::Tree</a>&lt; X &gt;::set_node_val </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; X &gt; &amp;&#160;</td>
<td class="paramname"><em>node_val</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the values for all the nodes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">node_val</td><td>a vector of size n, with all the node values where, n is the number of nodes </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; {</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; assert(<span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(node_val.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>()) == <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">t_nodes</a>);</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; <a class="code" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a135b7952593c9b1aae38fcaf1cc1abf7">t_val</a> = node_val;</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree_a04cd96efaba147b19d3afc769b90ff70_cgraph.svg" width="322" height="67"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>range_queries/<a class="el" href="../../d2/de9/heavy__light__decomposition_8cpp.html">heavy_light_decomposition.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aresize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/resize.html">std::vector::resize</a></div><div class="ttdeci">T resize(T... args)</div></div>
<div class="ttc" id="afloor_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/floor.html">std::floor</a></div><div class="ttdeci">T floor(T... args)</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ada1494fccbc7f1f07b2f9be9f7e07ad5"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5">range_queries::heavy_light_decomposition::Tree::t_size</a></div><div class="ttdeci">std::vector&lt; int &gt; t_size</div><div class="ttdoc">a vector to store the subtree size rooted at node</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:89</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ae8de7aefcb6635d3dacdd174cd4890c4"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4">range_queries::heavy_light_decomposition::Tree::dfs_lca</a></div><div class="ttdeci">void dfs_lca(int u, int p=-1)</div><div class="ttdoc">Utility function to populate the t_par vector.</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:116</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_aa6c37e840355b9fb2105181c578694e8"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8">range_queries::heavy_light_decomposition::Tree::t_root</a></div><div class="ttdeci">int t_root</div><div class="ttdoc">the root of the tree</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:91</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ab2ab020f798d00be2613ecf63074b7c1"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1">range_queries::heavy_light_decomposition::Tree::t_maxlift</a></div><div class="ttdeci">const int t_maxlift</div><div class="ttdoc">maximum possible height of the tree</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:85</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt; int &gt;</a></div></div>
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ac7761255f2ba06b398b9aae5e4dce5f3"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3">range_queries::heavy_light_decomposition::Tree::lift</a></div><div class="ttdeci">void lift(int *const p, int dist)</div><div class="ttdoc">The function lifts a node, k units up the tree. The lifting is done in place, and the result is store...</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:200</div></div>
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ab1aeaefa1bd97b867c652ba916fbdb43"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43">range_queries::heavy_light_decomposition::Tree::t_adj</a></div><div class="ttdeci">std::vector&lt; std::list&lt; int &gt; &gt; t_adj</div><div class="ttdoc">an adjacency list to stores the tree edges</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:83</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_ae4630fa70a80a1dc65a875488a67178a"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a">range_queries::heavy_light_decomposition::Tree::t_nodes</a></div><div class="ttdeci">const int t_nodes</div><div class="ttdoc">number of nodes</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:84</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_a350157a5fb79f76fceae33fc84171203"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203">range_queries::heavy_light_decomposition::Tree::t_par</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; int &gt; &gt; t_par</div><div class="ttdoc">a matrix to store every node's 2^kth parent</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:87</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_a135b7952593c9b1aae38fcaf1cc1abf7"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a135b7952593c9b1aae38fcaf1cc1abf7">range_queries::heavy_light_decomposition::Tree::t_val</a></div><div class="ttdeci">std::vector&lt; X &gt; t_val</div><div class="ttdoc">values of nodes</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:92</div></div>
<div class="ttc" id="aassign_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/assign.html">std::vector::assign</a></div><div class="ttdeci">T assign(T... args)</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_aa339c31ec74cd86a4842a8b09653d460"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460">range_queries::heavy_light_decomposition::Tree::dfs_size</a></div><div class="ttdeci">void dfs_size(int u, int p=-1)</div><div class="ttdoc">Utility function to compute sub-tree sizes.</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:101</div></div>
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_tree_html_a0efd0b9c564092f443ca97030d866ef1"><div class="ttname"><a href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1">range_queries::heavy_light_decomposition::Tree::t_depth</a></div><div class="ttdeci">std::vector&lt; int &gt; t_depth</div><div class="ttdoc">a vector to store the depth of a node,</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:88</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dd/d69/namespacerange__queries.html">range_queries</a></li><li class="navelem"><b>heavy_light_decomposition</b></li><li class="navelem"><a class="el" href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html">Tree</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,22 @@
var classrange__queries_1_1heavy__light__decomposition_1_1_tree =
[
[ "Tree", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a835fb2bbb27307b8cacad9b287968bc1", null ],
[ "add_edge", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a79ab4601c4a95c0902ac04e779e5f54d", null ],
[ "change_root", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab916d554afa8ca5230b4310c2c69fae0", null ],
[ "dfs_lca", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4", null ],
[ "dfs_size", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460", null ],
[ "init", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ad22d760a5a33545a70e7ea5e1786c8dc", null ],
[ "kth_ancestor", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a8f7bca1746d40f21ad832fcea59aa6c6", null ],
[ "lca", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae2b407e64aaf9878fbee7ee6efe9c7d4", null ],
[ "lift", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3", null ],
[ "set_node_val", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a04cd96efaba147b19d3afc769b90ff70", null ],
[ "HLD", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#afcdadbdea1e2391cebbb17d2c1ae2f0b", null ],
[ "t_adj", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab1aeaefa1bd97b867c652ba916fbdb43", null ],
[ "t_depth", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a0efd0b9c564092f443ca97030d866ef1", null ],
[ "t_maxlift", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ab2ab020f798d00be2613ecf63074b7c1", null ],
[ "t_nodes", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae4630fa70a80a1dc65a875488a67178a", null ],
[ "t_par", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a350157a5fb79f76fceae33fc84171203", null ],
[ "t_root", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa6c37e840355b9fb2105181c578694e8", null ],
[ "t_size", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ada1494fccbc7f1f07b2f9be9f7e07ad5", null ],
[ "t_val", "d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#a135b7952593c9b1aae38fcaf1cc1abf7", null ]
];

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::Tree::set_node_val" name="range_queries::heavy_light_decomposition::Tree::set_node_val">
<area shape="rect" id="node1" title="Set the values for all the nodes." alt="" coords="5,5,152,61"/>
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector/size.html#" title=" " alt="" coords="200,20,316,47"/>
</map>

View File

@@ -0,0 +1 @@
785c0081baceccc1ca988a4db54ca8dd

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::set_node_val Pages: 1 -->
<svg width="241pt" height="50pt"
viewBox="0.00 0.00 241.00 50.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 46)">
<title>range_queries::heavy_light_decomposition::Tree::set_node_val</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-46 237,-46 237,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Set the values for all the nodes.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::set_node_val</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/size.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="146,-11.5 146,-30.5 233,-30.5 233,-11.5 146,-11.5"/>
<text text-anchor="middle" x="189.5" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::size</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.28,-21C118.71,-21 127.41,-21 135.81,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.87,-24.5 145.87,-21 135.87,-17.5 135.87,-24.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::Tree::add_edge" name="range_queries::heavy_light_decomposition::Tree::add_edge">
<area shape="rect" id="node1" title="Adds an undirected edge from node u to node v in the tree." alt="" coords="5,5,152,61"/>
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector/push_back.html#" title=" " alt="" coords="200,20,355,47"/>
</map>

View File

@@ -0,0 +1 @@
d7dc869b3ab041c99ebc389f6d275089

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::add_edge Pages: 1 -->
<svg width="270pt" height="50pt"
viewBox="0.00 0.00 270.00 50.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 46)">
<title>range_queries::heavy_light_decomposition::Tree::add_edge</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-46 266,-46 266,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Adds an undirected edge from node u to node v in the tree.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::add_edge</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/push_back.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="146,-11.5 146,-30.5 262,-30.5 262,-11.5 146,-11.5"/>
<text text-anchor="middle" x="204" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::push_back</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.32,-21C118.58,-21 127.18,-21 135.67,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.95,-24.5 145.95,-21 135.95,-17.5 135.95,-24.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,5 @@
<map id="range_queries::heavy_light_decomposition::Tree::Tree" name="range_queries::heavy_light_decomposition::Tree::Tree">
<area shape="rect" id="node1" title="Class parameterized constructor, resizes the and initializes the data members." alt="" coords="5,16,152,72"/>
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector/assign.html#" title=" " alt="" coords="200,5,331,32"/>
<area shape="rect" id="node3" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector/resize.html#" title=" " alt="" coords="202,56,329,83"/>
</map>

View File

@@ -0,0 +1 @@
61c0a4773a48d5c4a57a34196fbc1b6d

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::Tree Pages: 1 -->
<svg width="252pt" height="66pt"
viewBox="0.00 0.00 252.00 66.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 62)">
<title>range_queries::heavy_light_decomposition::Tree::Tree</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-62 248,-62 248,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Class parameterized constructor, resizes the and initializes the data members.">
<polygon fill="#bfbfbf" stroke="black" points="0,-8.5 0,-49.5 110,-49.5 110,-8.5 0,-8.5"/>
<text text-anchor="start" x="8" y="-37.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-15.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::Tree</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/assign.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="146,-38.5 146,-57.5 244,-57.5 244,-38.5 146,-38.5"/>
<text text-anchor="middle" x="195" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::assign</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.15,-36.45C118.52,-37.61 127.2,-38.8 135.66,-39.97"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.46,-43.47 145.84,-41.37 136.41,-36.54 135.46,-43.47"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/resize.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="147.5,-0.5 147.5,-19.5 242.5,-19.5 242.5,-0.5 147.5,-0.5"/>
<text text-anchor="middle" x="195" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::resize</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M110.15,-21.55C119.03,-20.32 128.27,-19.05 137.22,-17.82"/>
<polygon fill="midnightblue" stroke="midnightblue" points="137.74,-21.28 147.17,-16.45 136.78,-14.34 137.74,-21.28"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::Tree::kth_ancestor" name="range_queries::heavy_light_decomposition::Tree::kth_ancestor">
<area shape="rect" id="node1" title="The function returns the kth ancestor of a node." alt="" coords="5,5,152,61"/>
<area shape="rect" id="node2" href="$d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3" title="The function lifts a node, k units up the tree. The lifting is done in place, and the result is store..." alt="" coords="200,5,347,61"/>
</map>

View File

@@ -0,0 +1 @@
3a7a40c14ff24c6e9c9d07b9d75c658d

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::kth_ancestor Pages: 1 -->
<svg width="264pt" height="50pt"
viewBox="0.00 0.00 264.00 50.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 46)">
<title>range_queries::heavy_light_decomposition::Tree::kth_ancestor</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-46 260,-46 260,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="The function returns the kth ancestor of a node.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::kth_ancestor</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3" target="_top" xlink:title="The function lifts a node, k units up the tree. The lifting is done in place, and the result is store...">
<polygon fill="white" stroke="black" points="146,-0.5 146,-41.5 256,-41.5 256,-0.5 146,-0.5"/>
<text text-anchor="start" x="154" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="154" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="201" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::lift</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.03,-21C118.31,-21 126.94,-21 135.42,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.67,-24.5 145.67,-21 135.67,-17.5 135.67,-24.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,5 @@
<map id="range_queries::heavy_light_decomposition::Tree::init" name="range_queries::heavy_light_decomposition::Tree::init">
<area shape="rect" id="node1" title="This function must be called after the tree adjacency list and node values are populated The function..." alt="" coords="5,45,152,101"/>
<area shape="rect" id="node2" href="$d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4" title="Utility function to populate the t_par vector." alt="" coords="200,5,347,61"/>
<area shape="rect" id="node3" href="$d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460" title="Utility function to compute sub&#45;tree sizes." alt="" coords="200,85,347,141"/>
</map>

View File

@@ -0,0 +1 @@
41e2a595a15a8cfb2d32c9b139971bf2

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::init Pages: 1 -->
<svg width="264pt" height="110pt"
viewBox="0.00 0.00 264.00 110.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 106)">
<title>range_queries::heavy_light_decomposition::Tree::init</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-106 260,-106 260,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="This function must be called after the tree adjacency list and node values are populated The function...">
<polygon fill="#bfbfbf" stroke="black" points="0,-30.5 0,-71.5 110,-71.5 110,-30.5 0,-30.5"/>
<text text-anchor="start" x="8" y="-59.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-48.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-37.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::init</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ae8de7aefcb6635d3dacdd174cd4890c4" target="_top" xlink:title="Utility function to populate the t_par vector.">
<polygon fill="white" stroke="black" points="146,-60.5 146,-101.5 256,-101.5 256,-60.5 146,-60.5"/>
<text text-anchor="start" x="154" y="-89.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="154" y="-78.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="201" y="-67.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::dfs_lca</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.03,-62.26C118.4,-64 127.13,-65.82 135.7,-67.6"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.16,-71.07 145.67,-69.68 136.59,-64.21 135.16,-71.07"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#aa339c31ec74cd86a4842a8b09653d460" target="_top" xlink:title="Utility function to compute sub&#45;tree sizes.">
<polygon fill="white" stroke="black" points="146,-0.5 146,-41.5 256,-41.5 256,-0.5 146,-0.5"/>
<text text-anchor="start" x="154" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="154" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="201" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::dfs_size</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M110.03,-39.74C118.4,-38 127.13,-36.18 135.7,-34.4"/>
<polygon fill="midnightblue" stroke="midnightblue" points="136.59,-37.79 145.67,-32.32 135.16,-30.93 136.59,-37.79"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::Tree::lca" name="range_queries::heavy_light_decomposition::Tree::lca">
<area shape="rect" id="node1" title="The function returns the least common ancestor of two nodes." alt="" coords="5,5,152,61"/>
<area shape="rect" id="node2" href="$d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3" title="The function lifts a node, k units up the tree. The lifting is done in place, and the result is store..." alt="" coords="200,5,347,61"/>
</map>

View File

@@ -0,0 +1 @@
e8e04603408d0ef33d0dcbaf5b08a9e8

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::Tree::lca Pages: 1 -->
<svg width="264pt" height="50pt"
viewBox="0.00 0.00 264.00 50.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 46)">
<title>range_queries::heavy_light_decomposition::Tree::lca</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-46 260,-46 260,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="The function returns the least common ancestor of two nodes.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::lca</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/d51/classrange__queries_1_1heavy__light__decomposition_1_1_tree.html#ac7761255f2ba06b398b9aae5e4dce5f3" target="_top" xlink:title="The function lifts a node, k units up the tree. The lifting is done in place, and the result is store...">
<polygon fill="white" stroke="black" points="146,-0.5 146,-41.5 256,-41.5 256,-0.5 146,-0.5"/>
<text text-anchor="start" x="154" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="154" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="201" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::Tree::lift</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M110.03,-21C118.31,-21 126.94,-21 135.42,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="135.67,-24.5 145.67,-21 135.67,-17.5 135.67,-24.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::SG&lt; X &gt;" name="range_queries::heavy_light_decomposition::SG&lt; X &gt;">
<area shape="rect" id="node1" title="Segment Tree, to store heavy chains." alt="" coords="5,95,152,151"/>
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector.html" title=" " alt="" coords="20,5,137,32"/>
</map>

View File

@@ -0,0 +1 @@
cc7656369f63f8b4fa9956e3ff7de06d

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::SG&lt; X &gt; Pages: 1 -->
<svg width="118pt" height="117pt"
viewBox="0.00 0.00 118.00 117.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 113)">
<title>range_queries::heavy_light_decomposition::SG&lt; X &gt;</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-113 114,-113 114,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Segment Tree, to store heavy chains.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::SG&lt; X &gt;</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector.html" xlink:title=" ">
<polygon fill="white" stroke="black" points="11,-89.5 11,-108.5 99,-108.5 99,-89.5 11,-89.5"/>
<text text-anchor="middle" x="55" y="-96.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector&lt; X &gt;</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node1 -->
<g id="edge1" class="edge">
<title>Node2&#45;&gt;Node1</title>
<path fill="none" stroke="#9a32cd" stroke-dasharray="5,2" d="M55,-79.14C55,-67.73 55,-53.21 55,-41.66"/>
<polygon fill="#9a32cd" stroke="#9a32cd" points="51.5,-79.28 55,-89.28 58.5,-79.28 51.5,-79.28"/>
<text text-anchor="middle" x="70.5" y="-63" font-family="Helvetica,sans-Serif" font-size="10.00"> s_tree</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,4 @@
<map id="range_queries::heavy_light_decomposition::SG&lt; X &gt;" name="range_queries::heavy_light_decomposition::SG&lt; X &gt;">
<area shape="rect" id="node1" title="Segment Tree, to store heavy chains." alt="" coords="5,5,152,61"/>
<area shape="rect" id="node2" href="$d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d.html" title="The Heavy&#45;Light Decomposition class." alt="" coords="5,109,152,165"/>
</map>

View File

@@ -0,0 +1 @@
2bb159e6758b43b8174a6f9e88a3ca2a

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: range_queries::heavy_light_decomposition::SG&lt; X &gt; Pages: 1 -->
<svg width="118pt" height="128pt"
viewBox="0.00 0.00 118.00 128.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 124)">
<title>range_queries::heavy_light_decomposition::SG&lt; X &gt;</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-124 114,-124 114,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Segment Tree, to store heavy chains.">
<polygon fill="#bfbfbf" stroke="black" points="0,-78.5 0,-119.5 110,-119.5 110,-78.5 0,-78.5"/>
<text text-anchor="start" x="8" y="-107.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-96.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-85.5" font-family="Helvetica,sans-Serif" font-size="10.00">::SG&lt; X &gt;</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d.html" target="_top" xlink:title="The Heavy&#45;Light Decomposition class.">
<polygon fill="white" stroke="black" points="0,-0.5 0,-41.5 110,-41.5 110,-0.5 0,-0.5"/>
<text text-anchor="start" x="8" y="-29.5" font-family="Helvetica,sans-Serif" font-size="10.00">range_queries::heavy</text>
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">_light_decomposition</text>
<text text-anchor="middle" x="55" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::HLD&lt; X &gt;</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M55,-68.3C55,-59.3 55,-49.65 55,-41.51"/>
<polygon fill="midnightblue" stroke="midnightblue" points="51.5,-68.43 55,-78.43 58.5,-68.43 51.5,-68.43"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -164,7 +164,7 @@ int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../..
<dl class="section copyright"><dt>Copyright</dt><dd>2020 Arctic2333</dd></dl>
<p>In this algorithm, we use the method of division and reservation remainder to construct the hash function, and use the method of chain address to solve the conflict, that is, we link a chain list after the data, and store all the records whose keywords are synonyms in the same linear chain list.</p>
<dl class="section warning"><dt>Warning</dt><dd>This program is only for educational purposes. It has serious flaws in implementation with regards to memory management resulting in large amounts of memory leaks. </dd></dl>
<dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000010">Todo:</a></b></dt><dd>fix the program for memory leaks and better structure in C++ and not C fashion </dd></dl>
<dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000011">Todo:</a></b></dt><dd>fix the program for memory leaks and better structure in C++ and not C fashion </dd></dl>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="a8ca8dcb494104d273679e219e53d0555"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ca8dcb494104d273679e219e53d0555">&#9670;&nbsp;</a></span>node</h2>
@@ -204,7 +204,7 @@ int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../..
</dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>dynamic memory allocated to <code>n</code> never gets freed. </dd></dl>
<dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000011">Todo:</a></b></dt><dd>fix memory leak </dd></dl>
<dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000012">Todo:</a></b></dt><dd>fix memory leak </dd></dl>
<div class="fragment"><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; { <span class="comment">// Construct hash table</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list.html">link</a> p, n;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordtype">int</span> index;</div>