mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-10 22:16:53 +08:00
Documentation for e813f9b2a6
This commit is contained in:
@@ -152,7 +152,7 @@ Functions</h2></td></tr>
|
||||
<p>two elements a[i] and a[j] form an inversion if <code>a[i]</code> > <code>a[j]</code> and i < j</p>
|
||||
<p>Time Complexity --> <code>O(n.log n)</code></p>
|
||||
<p>Space Complexity --> <code>O(n)</code> ; additional array <code>temp[1..n]</code> </p>
|
||||
<h3><a class="anchor" id="autotoc_md71"></a>
|
||||
<h3><a class="anchor" id="autotoc_md72"></a>
|
||||
Algorithm</h3>
|
||||
<ol type="1">
|
||||
<li>The idea is similar to merge sort, divide the array into two equal or almost equal halves in each step until the base case is reached.</li>
|
||||
|
||||
@@ -167,7 +167,7 @@ Functions</h2></td></tr>
|
||||
<li>Call obj.update(node, new_val), to update the value at index 'node' to the new value. Note: node must be 0 indexed</li>
|
||||
<li>Call obj.query(a, b) to get the (sum) of node values in the simple path from a to b. Note: a and b, must be 0 indexed.</li>
|
||||
</ol>
|
||||
<p>Sample I/O at the bottom. </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000011">Todo:</a></b></dt><dd>Support edge weight queries, by storing the edge weight value in it's child algorithm verified by testing in CSES path queries: <a href="https://cses.fi/problemset/task/1138">https://cses.fi/problemset/task/1138</a> </dd></dl>
|
||||
<p>Sample I/O at the bottom. </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000010">Todo:</a></b></dt><dd>Support edge weight queries, by storing the edge weight value in it's child algorithm verified by testing in CSES path queries: <a href="https://cses.fi/problemset/task/1138">https://cses.fi/problemset/task/1138</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
Reference in New Issue
Block a user