mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 22:02:20 +08:00
Documentation for c26eea874d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: range_queries/segtree.cpp Source File</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -124,13 +124,14 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div class="headertitle"><div class="title">segtree.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../d2/d45/segtree_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||||
<a href="../../d2/d45/segtree_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> </div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include <cassert></span> </div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#include <cmath></span> </div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#include <cstdint></span> </div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#include <iostream></span> </div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#include <vector></span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span></div>
|
||||
<div class="foldopen" id="foldopen00038" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696"> 38</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(<span class="keyword">const</span> std::vector<int64_t> &arr, std::vector<int64_t> *segtree,</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> uint64_t low, uint64_t high, uint64_t pos) {</div>
|
||||
@@ -145,7 +146,7 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span></div>
|
||||
<div class="foldopen" id="foldopen00063" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d"> 63</a></span>int64_t <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(std::vector<int64_t> *segtree, std::vector<int64_t> *lazy,</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high,</div>
|
||||
@@ -174,7 +175,7 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(segtree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span></div>
|
||||
<div class="foldopen" id="foldopen00103" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0"> 103</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(std::vector<int64_t> *segtree, std::vector<int64_t> *lazy,</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> int64_t start, int64_t end, int64_t delta, uint64_t low,</div>
|
||||
@@ -215,7 +216,7 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span></div>
|
||||
<div class="foldopen" id="foldopen00147" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 147</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">auto</span> max = <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(2 * pow(2, ceil(log2(7))) - 1);</div>
|
||||
@@ -233,7 +234,7 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> assert(<a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 0, 4, 0, 7 - 1, 0) == -1 + 0 + 2 + 3 + 4);</div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span></div>
|
||||
<div class="foldopen" id="foldopen00168" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 168</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
@@ -299,7 +300,7 @@ $(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResiza
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_074119ce3a874b57120c49a0cc4bb5ad.html">range_queries</a></li><li class="navelem"><a class="el" href="../../d2/d45/segtree_8cpp.html">segtree.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user