mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-21 20:31:43 +08:00
Documentation for db149bf3b7
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<!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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<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.9.4"/>
|
||||
<meta name="generator" content="Doxygen 1.9.5"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: data_structures/sparse_table.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -41,10 +41,10 @@ MathJax.Hub.Config({
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.4 -->
|
||||
<!-- Generated by Doxygen 1.9.5 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
@@ -84,9 +84,16 @@ $(document).ready(function(){initNavTree('d6/d42/data__structures_2sparse__table
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
@@ -99,7 +106,7 @@ $(document).ready(function(){initNavTree('d6/d42/data__structures_2sparse__table
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Implementation of <a href="https://brilliant.org/wiki/sparse-table/" target="_blank">Sparse Table</a> for <code><a class="el" href="../../da/d52/minimum__edit__distance_8cpp.html#a0138c226bd79ffe6d839c787cfc60347" title="Takes input of the cost of three operations: Insert, Replace and Delete and return the minimum cost a...">min()</a></code> function.
|
||||
<p>Implementation of <a href="https://brilliant.org/wiki/sparse-table/" target="_blank">Sparse Table</a> for <code>min()</code> function.
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <array></code><br />
|
||||
<code>#include <cassert></code><br />
|
||||
@@ -107,7 +114,7 @@ $(document).ready(function(){initNavTree('d6/d42/data__structures_2sparse__table
|
||||
</div><div class="textblock"><div class="dynheader">
|
||||
Include dependency graph for sparse_table.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d88/data__structures_2sparse__table_8cpp__incl.svg" width="248" height="127"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d88/data__structures_2sparse__table_8cpp__incl.svg" width="248" height="124"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
@@ -137,7 +144,7 @@ Functions</h2></td></tr>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
|
||||
Variables</h2></td></tr>
|
||||
<tr class="memitem:a10f3ffb3f6f7e1b83d556b9c8de89a5d"><td class="memItemLeft" align="right" valign="top">constexpr uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a> = 12345</td></tr>
|
||||
<tr class="memdesc:a10f3ffb3f6f7e1b83d556b9c8de89a5d"><td class="mdescLeft"> </td><td class="mdescRight">A struct to represent sparse table for <code><a class="el" href="../../da/d52/minimum__edit__distance_8cpp.html#a0138c226bd79ffe6d839c787cfc60347" title="Takes input of the cost of three operations: Insert, Replace and Delete and return the minimum cost a...">min()</a></code> as their invariant function, for the given array <code>A</code>. The answer to queries are stored in the array ST. <a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:a10f3ffb3f6f7e1b83d556b9c8de89a5d"><td class="mdescLeft"> </td><td class="mdescRight">A struct to represent sparse table for <code>min()</code> as their invariant function, for the given array <code>A</code>. The answer to queries are stored in the array ST. <a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">More...</a><br /></td></tr>
|
||||
<tr class="separator:a10f3ffb3f6f7e1b83d556b9c8de89a5d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af7db62f21983565c64d5d42d2a49888e"><td class="memItemLeft" align="right" valign="top"><a id="af7db62f21983565c64d5d42d2a49888e" name="af7db62f21983565c64d5d42d2a49888e"></a>
|
||||
constexpr uint8_t </td><td class="memItemRight" valign="bottom"><b>data_structures::sparse_table::M</b> = 14</td></tr>
|
||||
@@ -145,7 +152,7 @@ constexpr uint8_t </td><td class="memItemRight" valign="bottom"><b>data_str
|
||||
<tr class="separator:af7db62f21983565c64d5d42d2a49888e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Implementation of <a href="https://brilliant.org/wiki/sparse-table/" target="_blank">Sparse Table</a> for <code><a class="el" href="../../da/d52/minimum__edit__distance_8cpp.html#a0138c226bd79ffe6d839c787cfc60347" title="Takes input of the cost of three operations: Insert, Replace and Delete and return the minimum cost a...">min()</a></code> function. </p>
|
||||
<div class="textblock"><p >Implementation of <a href="https://brilliant.org/wiki/sparse-table/" target="_blank">Sparse Table</a> for <code>min()</code> function. </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/manncodes" target="_blank">Mann Patel</a></dd></dl>
|
||||
<p>Sparse Table is a data structure, that allows answering range queries. It can answer most range queries in O(logn), but its true power is answering range minimum queries (or equivalent range maximum queries). For those queries it can compute the answer in O(1) time. The only drawback of this data structure is, that it can only be used on immutable arrays. This means, that the array cannot be changed between two queries.</p>
|
||||
<p >If any element in the array changes, the complete data structure has to be recomputed.</p>
|
||||
@@ -153,7 +160,7 @@ constexpr uint8_t </td><td class="memItemRight" valign="bottom"><b>data_str
|
||||
<dl class="section warning"><dt>Warning</dt><dd>This sparse table is made for <code>min(a1,a2,...an)</code> duplicate invariant function. This implementation can be changed to other functions like <code><a class="el" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd()</a></code>, <code><a class="el" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm()</a></code>, and <code>max()</code> by changing a few lines of code. </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97" name="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">◆ </a></span>main()</h2>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -195,14 +202,14 @@ constexpr uint8_t </td><td class="memItemRight" valign="bottom"><b>data_str
|
||||
</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="../../d6/d42/data__structures_2sparse__table_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="280" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d6/d42/data__structures_2sparse__table_8cpp_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="280" height="184"><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="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">◆ </a></span>test()</h2>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">◆ </a></span>test()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -271,7 +278,7 @@ Here is the call graph for this function:</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="../../d6/d42/data__structures_2sparse__table_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="182" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d6/d42/data__structures_2sparse__table_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="182" height="184"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -279,7 +286,7 @@ Here is the call graph for this function:</div>
|
||||
</div>
|
||||
<h2 class="groupheader">Variable Documentation</h2>
|
||||
<a id="a10f3ffb3f6f7e1b83d556b9c8de89a5d" name="a10f3ffb3f6f7e1b83d556b9c8de89a5d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a10f3ffb3f6f7e1b83d556b9c8de89a5d">◆ </a></span>N</h2>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a10f3ffb3f6f7e1b83d556b9c8de89a5d">◆ </a></span>N</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -298,7 +305,7 @@ Here is the call graph for this function:</div>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>A struct to represent sparse table for <code><a class="el" href="../../da/d52/minimum__edit__distance_8cpp.html#a0138c226bd79ffe6d839c787cfc60347" title="Takes input of the cost of three operations: Insert, Replace and Delete and return the minimum cost a...">min()</a></code> as their invariant function, for the given array <code>A</code>. The answer to queries are stored in the array ST. </p>
|
||||
<p>A struct to represent sparse table for <code>min()</code> as their invariant function, for the given array <code>A</code>. The answer to queries are stored in the array ST. </p>
|
||||
<p >the maximum size of the array. </p>
|
||||
|
||||
</div>
|
||||
@@ -309,7 +316,7 @@ Here is the call graph for this function:</div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_2e746e9d06bf2d8ff842208bcc6ebcfc.html">data_structures</a></li><li class="navelem"><a class="el" href="../../d6/d42/data__structures_2sparse__table_8cpp.html">sparse_table.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.9.4 </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.9.5 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user