blob: 860c0b73b01b6c906f68c5ad5c361d1ee218be35 (
plain) (
tree)
|
|
<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.6"/>
<title>Templates -- Meow: meow::BinaryIndexTree< Value > 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="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<link href="custom.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="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Templates -- Meow
 <span id="projectnumber">204.13.18</span>
</div>
<div id="projectbrief">A C++ template contains kinds of interesting classes and functions</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
</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">
$(document).ready(function(){initNavTree('classmeow_1_1BinaryIndexTree.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classmeow_1_1BinaryIndexTree-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">meow::BinaryIndexTree< Value > Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>極度簡化的 <code><a class="el" href="classmeow_1_1SegmentTree.html" title="中文名 線段樹 ">SegmentTree</a></code> 已無區間更新的操作
<a href="classmeow_1_1BinaryIndexTree.html#details">More...</a></p>
<p><code>#include "<a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>"</code></p>
<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:afe34f33091c5c8267f1d219ff40824c4"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#afe34f33091c5c8267f1d219ff40824c4">BinaryIndexTree</a> ()</td></tr>
<tr class="memdesc:afe34f33091c5c8267f1d219ff40824c4"><td class="mdescLeft"> </td><td class="mdescRight">constructor <a href="#afe34f33091c5c8267f1d219ff40824c4">More...</a><br/></td></tr>
<tr class="separator:afe34f33091c5c8267f1d219ff40824c4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a355a4eacbfbe2112720d529efdbad021"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#a355a4eacbfbe2112720d529efdbad021">BinaryIndexTree</a> (size_t size, Value const &value)</td></tr>
<tr class="memdesc:a355a4eacbfbe2112720d529efdbad021"><td class="mdescLeft"> </td><td class="mdescRight">constructor <a href="#a355a4eacbfbe2112720d529efdbad021">More...</a><br/></td></tr>
<tr class="separator:a355a4eacbfbe2112720d529efdbad021"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8323caade12e478be1e47b7612a60b8f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#a8323caade12e478be1e47b7612a60b8f">BinaryIndexTree</a> (<a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a> const &tree2)</td></tr>
<tr class="memdesc:a8323caade12e478be1e47b7612a60b8f"><td class="mdescLeft"> </td><td class="mdescRight">constructor <a href="#a8323caade12e478be1e47b7612a60b8f">More...</a><br/></td></tr>
<tr class="separator:a8323caade12e478be1e47b7612a60b8f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5634a9420ee864860bbf8605b9e17c32"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#a5634a9420ee864860bbf8605b9e17c32">reset</a> (size_t size, Value const &init)</td></tr>
<tr class="memdesc:a5634a9420ee864860bbf8605b9e17c32"><td class="mdescLeft"> </td><td class="mdescRight">將資料洗掉, 重設 <a href="#a5634a9420ee864860bbf8605b9e17c32">More...</a><br/></td></tr>
<tr class="separator:a5634a9420ee864860bbf8605b9e17c32"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3a4f1799b20d5dab24d8cc584db5d32d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#a3a4f1799b20d5dab24d8cc584db5d32d">update</a> (size_t index, Value const &value)</td></tr>
<tr class="memdesc:a3a4f1799b20d5dab24d8cc584db5d32d"><td class="mdescLeft"> </td><td class="mdescRight">將array中第 <em>index</em> (從零算起)個element多加上指定的值 <a href="#a3a4f1799b20d5dab24d8cc584db5d32d">More...</a><br/></td></tr>
<tr class="separator:a3a4f1799b20d5dab24d8cc584db5d32d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a99f7d954c32c0292a9dda4b74abe5833"><td class="memItemLeft" align="right" valign="top">Value </td><td class="memItemRight" valign="bottom"><a class="el" href="classmeow_1_1BinaryIndexTree.html#a99f7d954c32c0292a9dda4b74abe5833">query</a> (ssize_t index) const </td></tr>
<tr class="memdesc:a99f7d954c32c0292a9dda4b74abe5833"><td class="mdescLeft"> </td><td class="mdescRight">詢問 <em>0~index</em> 的區間值 <a href="#a99f7d954c32c0292a9dda4b74abe5833">More...</a><br/></td></tr>
<tr class="separator:a99f7d954c32c0292a9dda4b74abe5833"><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<class Value><br/>
class meow::BinaryIndexTree< Value ></h3>
<p>極度簡化的 <code><a class="el" href="classmeow_1_1SegmentTree.html" title="中文名 線段樹 ">SegmentTree</a></code> 已無區間更新的操作 </p>
<p>一般來說只能用在維護區間總和, 維護區間最大值只有在特殊情況才可以, 即 <b>針對每個元素</b>, <b>每次update()</b> <b>的值一定會大於等於原本的值</b> . 若要用區間最大值 , 則 <em>Value</em> 的 <code>operator+</code> 要寫成 <code>std::max</code>(...)</p>
<dl class="section author"><dt>Author</dt><dd>cat_leopard </dd></dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00021">21</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="afe34f33091c5c8267f1d219ff40824c4"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::<a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a> </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>constructor </p>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00028">28</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<a class="anchor" id="a355a4eacbfbe2112720d529efdbad021"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::<a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a> </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Value const & </td>
<td class="paramname"><em>value</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> </td>
</tr>
</table>
</div><div class="memdoc">
<p>constructor </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>要維護的區間大小 <b></b>[0,size) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>預設值 </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00037">37</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<a class="anchor" id="a8323caade12e478be1e47b7612a60b8f"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::<a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a>< Value > const & </td>
<td class="paramname"><em>tree2</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>constructor </p>
<p>將另一個 <code><a class="el" href="classmeow_1_1BinaryIndexTree.html" title="極度簡化的 SegmentTree 已無區間更新的操作 ">BinaryIndexTree</a></code> 原封不動的複製過來 </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">tree2</td><td>另外一個 <code><a class="el" href="classmeow_1_1BinaryIndexTree.html" title="極度簡化的 SegmentTree 已無區間更新的操作 ">BinaryIndexTree</a></code> </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00047">47</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a99f7d954c32c0292a9dda4b74abe5833"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Value <a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::query </td>
<td>(</td>
<td class="paramtype">ssize_t </td>
<td class="paramname"><em>index</em></td><td>)</td>
<td> const</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>詢問 <em>0~index</em> 的區間值 </p>
<p>時間複雜度<b>O(logN)</b> </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>指定的index </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>區間值 </dd></dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00090">90</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<a class="anchor" id="a5634a9420ee864860bbf8605b9e17c32"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::reset </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Value const & </td>
<td class="paramname"><em>init</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> </td>
</tr>
</table>
</div><div class="memdoc">
<p>將資料洗掉, 重設 </p>
<p>時間複雜度<b>O(N)</b> </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>要維護的區間大小 <b></b>[0,size) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">init</td><td>預設值 </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>無 </dd></dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00060">60</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<a class="anchor" id="a3a4f1799b20d5dab24d8cc584db5d32d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class Value > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classmeow_1_1BinaryIndexTree.html">meow::BinaryIndexTree</a>< Value >::update </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Value const & </td>
<td class="paramname"><em>value</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> </td>
</tr>
</table>
</div><div class="memdoc">
<p>將array中第 <em>index</em> (從零算起)個element多加上指定的值 </p>
<p>時間複雜度<b>O(logN)</b> </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>指定的index </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>指定的值 </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>無 </dd></dl>
<p>Definition at line <a class="el" href="BinaryIndexTree_8h_source.html#l00074">74</a> of file <a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>meowpp/dsa/<a class="el" href="BinaryIndexTree_8h_source.html">BinaryIndexTree.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespacemeow.html">meow</a></li><li class="navelem"><a class="el" href="classmeow_1_1BinaryIndexTree.html">BinaryIndexTree</a></li>
<li class="footer">Generated on Tue Jun 24 2014 03:53:32 for Templates -- Meow by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>
|