<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>BIT on BenzHub</title><link>https://benzhub.github.io/tags/bit/</link><description>Recent content in BIT on BenzHub</description><generator>Hugo</generator><language>zh-TW</language><lastBuildDate>Sat, 27 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://benzhub.github.io/tags/bit/index.xml" rel="self" type="application/rss+xml"/><item><title>樹狀陣列 Fenwick Tree — lowbit 原理與前綴和查詢完整實作 | 資料結構與演算法</title><link>https://benzhub.github.io/post/javascript/data-structures--algorithms/014-fenwick-tree/</link><pubDate>Sat, 27 Jun 2026 00:00:00 +0000</pubDate><guid>https://benzhub.github.io/post/javascript/data-structures--algorithms/014-fenwick-tree/</guid><description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;樹狀陣列（Fenwick Tree，又稱 Binary Indexed Tree，簡稱 BIT）&lt;/strong&gt; 是一種利用二進位表示中最低位元（&lt;strong&gt;lowbit&lt;/strong&gt;）巧妙設計索引的資料結構，能以 &lt;strong&gt;O(log n)&lt;/strong&gt; 時間同時支援單點更新與前綴和查詢。相較於 &lt;strong&gt;線段樹&lt;/strong&gt;，BIT 程式碼極為精簡（核心不超過 10 行），常數因子更小，是處理前綴和動態維護與逆序對計數問題的首選工具。&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>