|
|
|
|
@@ -0,0 +1,470 @@
|
|
|
|
|
<!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::SG< X > 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++
|
|
|
|
|
 <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&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&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&dn=gpl-2.0.txt GPL-v2 */
|
|
|
|
|
$(document).ready(function(){initNavTree('d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.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="#pri-methods">Private Member Functions</a> |
|
|
|
|
|
<a href="#pri-attribs">Private Attributes</a> |
|
|
|
|
|
<a href="#friends">Friends</a> |
|
|
|
|
|
<a href="../../d3/de4/classrange__queries_1_1heavy__light__decomposition_1_1_s_g-members.html">List of all members</a> </div>
|
|
|
|
|
<div class="headertitle">
|
|
|
|
|
<div class="title">range_queries::heavy_light_decomposition::SG< X > Class Template Reference</div> </div>
|
|
|
|
|
</div><!--header-->
|
|
|
|
|
<div class="contents">
|
|
|
|
|
|
|
|
|
|
<p>Segment <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>, to store heavy chains.
|
|
|
|
|
<a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#details">More...</a></p>
|
|
|
|
|
<div class="dynheader">
|
|
|
|
|
Inheritance diagram for range_queries::heavy_light_decomposition::SG< X >:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/de6/classrange__queries_1_1heavy__light__decomposition_1_1_s_g__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::SG< X >:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/d67/classrange__queries_1_1heavy__light__decomposition_1_1_s_g__coll__graph.svg" width="158" height="156"><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="pri-methods"></a>
|
|
|
|
|
Private Member Functions</h2></td></tr>
|
|
|
|
|
<tr class="memitem:a41c733f5f5e262b308f7cb95c88c1e74"><td class="memItemLeft" align="right" valign="top">X </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">combine</a> (X lhs, X rhs)</td></tr>
|
|
|
|
|
<tr class="memdesc:a41c733f5f5e262b308f7cb95c88c1e74"><td class="mdescLeft"> </td><td class="mdescRight">Function that specifies the type of operation involved when segments are combined. <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:a41c733f5f5e262b308f7cb95c88c1e74"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:afba5c1225ba04c0025c7786c09ff28f1"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afba5c1225ba04c0025c7786c09ff28f1">SG</a> (int size)</td></tr>
|
|
|
|
|
<tr class="memdesc:afba5c1225ba04c0025c7786c09ff28f1"><td class="mdescLeft"> </td><td class="mdescRight">Class parameterized constructor. Resizes the and initilizes the data members. <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afba5c1225ba04c0025c7786c09ff28f1">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:afba5c1225ba04c0025c7786c09ff28f1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:a3c75bf5770790f8eba8cc92227b5400c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a3c75bf5770790f8eba8cc92227b5400c">update</a> (int p, X v)</td></tr>
|
|
|
|
|
<tr class="memdesc:a3c75bf5770790f8eba8cc92227b5400c"><td class="mdescLeft"> </td><td class="mdescRight">Update the value at a node. <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a3c75bf5770790f8eba8cc92227b5400c">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:a3c75bf5770790f8eba8cc92227b5400c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:a1fda852e6e522707fd97f61cdb0a2591"><td class="memItemLeft" align="right" valign="top">X </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a1fda852e6e522707fd97f61cdb0a2591">query</a> (int l, int r)</td></tr>
|
|
|
|
|
<tr class="memdesc:a1fda852e6e522707fd97f61cdb0a2591"><td class="mdescLeft"> </td><td class="mdescRight">Make a range query from node label l to node label r. <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a1fda852e6e522707fd97f61cdb0a2591">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:a1fda852e6e522707fd97f61cdb0a2591"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:ad3b942be27a1b0fe3cff6cb6edf01294"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ad3b942be27a1b0fe3cff6cb6edf01294">set_sret_init</a> (X new_sret_init)</td></tr>
|
|
|
|
|
<tr class="memdesc:ad3b942be27a1b0fe3cff6cb6edf01294"><td class="mdescLeft"> </td><td class="mdescRight">Set the initialization for the query data type, based on requirement. <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ad3b942be27a1b0fe3cff6cb6edf01294">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:ad3b942be27a1b0fe3cff6cb6edf01294"><td class="memSeparator" colspan="2"> </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:afbf8a9cb9449d5ca844f4e141a801e6a"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< X > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">s_tree</a></td></tr>
|
|
|
|
|
<tr class="memdesc:afbf8a9cb9449d5ca844f4e141a801e6a"><td class="mdescLeft"> </td><td class="mdescRight">Everything here is private, and can only be accessed through the methods, in the derived class (<a class="el" href="../../d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d.html" title="The Heavy-Light Decomposition class.">HLD</a>) <a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">More...</a><br /></td></tr>
|
|
|
|
|
<tr class="separator:afbf8a9cb9449d5ca844f4e141a801e6a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:ac6d912bbfafa3a7509f66bbc1729ca25"><td class="memItemLeft" align="right" valign="top"><a id="ac6d912bbfafa3a7509f66bbc1729ca25"></a>
|
|
|
|
|
int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a></td></tr>
|
|
|
|
|
<tr class="memdesc:ac6d912bbfafa3a7509f66bbc1729ca25"><td class="mdescLeft"> </td><td class="mdescRight">number of leaves in the segment tree <br /></td></tr>
|
|
|
|
|
<tr class="separator:ac6d912bbfafa3a7509f66bbc1729ca25"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
<tr class="memitem:aa7f93971a9f891e0bbb7023081f379d5"><td class="memItemLeft" align="right" valign="top"><a id="aa7f93971a9f891e0bbb7023081f379d5"></a>
|
|
|
|
|
X </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#aa7f93971a9f891e0bbb7023081f379d5">sret_init</a> = 0</td></tr>
|
|
|
|
|
<tr class="memdesc:aa7f93971a9f891e0bbb7023081f379d5"><td class="mdescLeft"> </td><td class="mdescRight">inital query return value <br /></td></tr>
|
|
|
|
|
<tr class="separator:aa7f93971a9f891e0bbb7023081f379d5"><td class="memSeparator" colspan="2"> </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<typename T > </td></tr>
|
|
|
|
|
<tr class="memitem:afcdadbdea1e2391cebbb17d2c1ae2f0b"><td class="memTemplItemLeft" align="right" valign="top">class </td><td class="memTemplItemRight" valign="bottom"><b>HLD</b></td></tr>
|
|
|
|
|
<tr class="separator:afcdadbdea1e2391cebbb17d2c1ae2f0b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
|
|
|
<div class="textblock"><h3>template<typename X><br />
|
|
|
|
|
class range_queries::heavy_light_decomposition::SG< X ></h3>
|
|
|
|
|
|
|
|
|
|
<p>Segment <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>, to store heavy chains. </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>
|
|
|
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
|
|
|
<a id="afba5c1225ba04c0025c7786c09ff28f1"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#afba5c1225ba04c0025c7786c09ff28f1">◆ </a></span>SG()</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname"><a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::<a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">SG</a> </td>
|
|
|
|
|
<td>(</td>
|
|
|
|
|
<td class="paramtype">int </td>
|
|
|
|
|
<td class="paramname"><em>size</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 class="mlabel">private</span></span> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div><div class="memdoc">
|
|
|
|
|
|
|
|
|
|
<p>Class parameterized constructor. Resizes the and initilizes 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>
|
|
|
|
|
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
|
|
|
|
<div class="fragment"><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  {</div>
|
|
|
|
|
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a> = size;</div>
|
|
|
|
|
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">s_tree</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/assign.html">assign</a>(2 * <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a>, 0ll);</div>
|
|
|
|
|
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  }</div>
|
|
|
|
|
</div><!-- fragment -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
|
|
|
<a id="a41c733f5f5e262b308f7cb95c88c1e74"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a41c733f5f5e262b308f7cb95c88c1e74">◆ </a></span>combine()</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname">X <a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::combine </td>
|
|
|
|
|
<td>(</td>
|
|
|
|
|
<td class="paramtype">X </td>
|
|
|
|
|
<td class="paramname"><em>lhs</em>, </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="paramkey"></td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td class="paramtype">X </td>
|
|
|
|
|
<td class="paramname"><em>rhs</em> </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>Function that specifies the type of operation involved when segments are combined. </p>
|
|
|
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
|
|
|
<table class="params">
|
|
|
|
|
<tr><td class="paramname">lhs</td><td>the left segment </td></tr>
|
|
|
|
|
<tr><td class="paramname">rhs</td><td>the right segment </td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl class="section return"><dt>Returns</dt><dd>the combined result </dd></dl>
|
|
|
|
|
<div class="fragment"><div class="line"><a name="l00274"></a><span class="lineno"> 274</span> { <span class="keywordflow">return</span> lhs + rhs; }</div>
|
|
|
|
|
</div><!-- fragment -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a id="a1fda852e6e522707fd97f61cdb0a2591"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a1fda852e6e522707fd97f61cdb0a2591">◆ </a></span>query()</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname">X <a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::<a class="el" href="../../dd/d1b/structquery.html">query</a> </td>
|
|
|
|
|
<td>(</td>
|
|
|
|
|
<td class="paramtype">int </td>
|
|
|
|
|
<td class="paramname"><em>l</em>, </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="paramkey"></td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td class="paramtype">int </td>
|
|
|
|
|
<td class="paramname"><em>r</em> </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>Make a range query from node label l to node label r. </p>
|
|
|
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
|
|
|
<table class="params">
|
|
|
|
|
<tr><td class="paramname">l</td><td>node label where the path starts </td></tr>
|
|
|
|
|
<tr><td class="paramname">r</td><td>node label where the path ends </td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
|
|
|
|
<div class="fragment"><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  {</div>
|
|
|
|
|
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  X lhs = <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#aa7f93971a9f891e0bbb7023081f379d5">sret_init</a>, rhs = <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#aa7f93971a9f891e0bbb7023081f379d5">sret_init</a>;</div>
|
|
|
|
|
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">for</span> (l += <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a>, r += <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a> + 1; l < r; l >>= 1, r >>= 1) {</div>
|
|
|
|
|
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">if</span> (l & 1) {</div>
|
|
|
|
|
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  lhs = <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">combine</a>(lhs, <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">s_tree</a>[l++]);</div>
|
|
|
|
|
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  }</div>
|
|
|
|
|
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  <span class="keywordflow">if</span> (r & 1) {</div>
|
|
|
|
|
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  rhs = <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">combine</a>(<a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">s_tree</a>[--r], rhs);</div>
|
|
|
|
|
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  }</div>
|
|
|
|
|
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  }</div>
|
|
|
|
|
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  <span class="keywordflow">return</span> <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">combine</a>(lhs, rhs);</div>
|
|
|
|
|
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  }</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="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g_a1fda852e6e522707fd97f61cdb0a2591_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="ad3b942be27a1b0fe3cff6cb6edf01294"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad3b942be27a1b0fe3cff6cb6edf01294">◆ </a></span>set_sret_init()</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname">void <a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::set_sret_init </td>
|
|
|
|
|
<td>(</td>
|
|
|
|
|
<td class="paramtype">X </td>
|
|
|
|
|
<td class="paramname"><em>new_sret_init</em></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>Set the initialization for the query data type, based on requirement. </p>
|
|
|
|
|
<p>Change the sret_init, based on requirement:</p><ul>
|
|
|
|
|
<li>Sum Query: 0 (Default)</li>
|
|
|
|
|
<li><a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> Query: 0 (Default)</li>
|
|
|
|
|
<li>Min Query: Infinity</li>
|
|
|
|
|
<li>Max Query: -Infinity <dl class="params"><dt>Parameters</dt><dd>
|
|
|
|
|
<table class="params">
|
|
|
|
|
<tr><td class="paramname">new_sret_init</td><td>the new init </td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="fragment"><div class="line"><a name="l00329"></a><span class="lineno"> 329</span> { <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#aa7f93971a9f891e0bbb7023081f379d5">sret_init</a> = new_sret_init; }</div>
|
|
|
|
|
</div><!-- fragment -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a id="a3c75bf5770790f8eba8cc92227b5400c"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a3c75bf5770790f8eba8cc92227b5400c">◆ </a></span>update()</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname">void <a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::update </td>
|
|
|
|
|
<td>(</td>
|
|
|
|
|
<td class="paramtype">int </td>
|
|
|
|
|
<td class="paramname"><em>p</em>, </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="paramkey"></td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td class="paramtype">X </td>
|
|
|
|
|
<td class="paramname"><em>v</em> </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>Update the value at a node. </p>
|
|
|
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
|
|
|
<table class="params">
|
|
|
|
|
<tr><td class="paramname">p</td><td>the node to be udpated </td></tr>
|
|
|
|
|
<tr><td class="paramname">v</td><td>the update value </td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
|
|
|
|
<div class="fragment"><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  {</div>
|
|
|
|
|
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <span class="keywordflow">for</span> (p += <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">s_size</a>; p > 0; p >>= 1) {</div>
|
|
|
|
|
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <a class="code" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">s_tree</a>[p] += v;</div>
|
|
|
|
|
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  }</div>
|
|
|
|
|
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  }</div>
|
|
|
|
|
</div><!-- fragment -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<h2 class="groupheader">Member Data Documentation</h2>
|
|
|
|
|
<a id="afbf8a9cb9449d5ca844f4e141a801e6a"></a>
|
|
|
|
|
<h2 class="memtitle"><span class="permalink"><a href="#afbf8a9cb9449d5ca844f4e141a801e6a">◆ </a></span>s_tree</h2>
|
|
|
|
|
|
|
|
|
|
<div class="memitem">
|
|
|
|
|
<div class="memproto">
|
|
|
|
|
<div class="memtemplate">
|
|
|
|
|
template<typename X > </div>
|
|
|
|
|
<table class="mlabels">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="mlabels-left">
|
|
|
|
|
<table class="memname">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a><X> <a class="el" href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">range_queries::heavy_light_decomposition::SG</a>< X >::s_tree</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="mlabels-right">
|
|
|
|
|
<span class="mlabels"><span class="mlabel">private</span></span> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div><div class="memdoc">
|
|
|
|
|
|
|
|
|
|
<p>Everything here is private, and can only be accessed through the methods, in the derived class (<a class="el" href="../../d2/d8a/classrange__queries_1_1heavy__light__decomposition_1_1_h_l_d.html" title="The Heavy-Light Decomposition class.">HLD</a>) </p>
|
|
|
|
|
<p>the segment tree, stored as a vector </p>
|
|
|
|
|
|
|
|
|
|
</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="aclassrange__queries_1_1heavy__light__decomposition_1_1_s_g_html_aa7f93971a9f891e0bbb7023081f379d5"><div class="ttname"><a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#aa7f93971a9f891e0bbb7023081f379d5">range_queries::heavy_light_decomposition::SG::sret_init</a></div><div class="ttdeci">X sret_init</div><div class="ttdoc">inital query return value</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:264</div></div>
|
|
|
|
|
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_s_g_html_a41c733f5f5e262b308f7cb95c88c1e74"><div class="ttname"><a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#a41c733f5f5e262b308f7cb95c88c1e74">range_queries::heavy_light_decomposition::SG::combine</a></div><div class="ttdeci">X combine(X lhs, X rhs)</div><div class="ttdoc">Function that specifies the type of operation involved when segments are combined.</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:274</div></div>
|
|
|
|
|
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_s_g_html_afbf8a9cb9449d5ca844f4e141a801e6a"><div class="ttname"><a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#afbf8a9cb9449d5ca844f4e141a801e6a">range_queries::heavy_light_decomposition::SG::s_tree</a></div><div class="ttdeci">std::vector< X > s_tree</div><div class="ttdoc">Everything here is private, and can only be accessed through the methods, in the derived class (HLD)</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:262</div></div>
|
|
|
|
|
<div class="ttc" id="aclassrange__queries_1_1heavy__light__decomposition_1_1_s_g_html_ac6d912bbfafa3a7509f66bbc1729ca25"><div class="ttname"><a href="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html#ac6d912bbfafa3a7509f66bbc1729ca25">range_queries::heavy_light_decomposition::SG::s_size</a></div><div class="ttdeci">int s_size</div><div class="ttdoc">number of leaves in the segment tree</div><div class="ttdef"><b>Definition:</b> heavy_light_decomposition.cpp:263</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>
|
|
|
|
|
<!-- 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="../../d9/d35/classrange__queries_1_1heavy__light__decomposition_1_1_s_g.html">SG</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>
|