---
title: "#5qcr54q25pww57ue articles | Hashnode"
description: "Explore 1 articles tagged #5qcr54q25pww57ue on Hashnode. Tutorials, guides, and how-tos from the community."
url: "https://hashnode.com/tag/5qcr54q25pww57ue"
---

Tag

# #5qcr54q25pww57ue

1 posts · 0 followers

[MrHe](https://hashnode.com/@MrHe) · [Oct 4, 2025](https://hashnode.com/posts/binary-indexed-tree/68e11f128ab625b5566341e4)

### [树状数组（ Binary Indexed Tree）](https://xiaoh.hashnode.dev/binary-indexed-tree?utm_source=hashnode&utm_medium=feed)

树状数组（Fenwick Tree / Binary Indexed Tree）这个东西。这玩意儿听起来挺唬人，但本质上就是个用数组模拟树形结构的工具，专门用来解决一类问题：频繁的单点更新和区间查询。如果我们用普通数组，更新是 O(1)，但查区间和就是 O(N)；用前缀和数组，查区间和是 O(1)，但你更新一个点，后面所有的前缀和都得改，又是 O(N)。两边都不讨好。树状数组就把这两个操作都干到了 O(logN)，一下就平衡了。 废话不多说，咱们从题入手，看看这东西到底怎么用，思路是怎么一步步升...

10 min read · [xiaoh.hashnode.dev](https://xiaoh.hashnode.dev/binary-indexed-tree?utm_source=hashnode&utm_medium=feed)
