当前位置:网站首页>13. numeric array
13. numeric array
2022-06-11 02:34:00 【I made the night white_】
The understanding of number - like array
Reference video : What is sacred about tree arrays , Let's lift his veil together !
Blue bridge's understanding ( Just remember the template , After that, you can not see )
#define lowbit(x) ((x) & - (x))
int tree[N];
void update(int x, int d) {
// Modifying elements a[x], a= a[x] + d
while(x <= N) {
tree[x] += d;
x += lowbit(x);
}
}
int sum(int x) {
// Back prefix and ans = a[1] + a[2] +... + a[x]
int ans = 0;
while(x > 0){
ans += tree[x];
x -= lowbit(x);
}
return ans;
}
introduce
The interval and problem of static array
Interval sum of dynamic arrays
边栏推荐
- Sd3.0 notes
- Wechat automatic red envelope grabbing source code
- Bingbing learning notes: find the greatest common divisor and the least common multiple. Complex version reverse string
- Unity HTC and Pico are the same
- Principle of everything for fast search
- 软件测试是否需要掌握编程能力
- String operation methods: replace, delete and split strings
- Blue Bridge Cup: the sixth preliminary round - "temperature recorder"
- How to read PMBOK guide in 3 steps (experience + data sharing)
- 深度学习基础篇【4】从0开始搭建EasyOCR并进行简单文字识别
猜你喜欢

企业展厅设计能为企业带来什么?

When a logical deletion encounters a unique index, what are the problems and solutions?

Test questions and answers of 2022r1 quick opening pressure vessel operation certificate

Colab reported an error: importerror: cannot import name '_ check_ savefig_ extra_ args‘ from ‘matplotlib. backend_ bases‘

扁平数据转tree与tree数据扁平化

SQL | 返回顾客名称和相关订单号以及每个订单的总价

Use of CIN and cout

关于Set集合类你都知道什么?来自《卷Ⅰ》的灵魂提问

多级介孔有机金属骨架材料ZIF-8负载乳酸氧化酶(LOD)/四氧化三铁(Fe304)/阿霉素DOX/胰岛素/cas9蛋白/甲硝唑/大黄素甲醚

查看Redis内数据,除了命令行和客户端,你还有第三种选择
随机推荐
92. CompletableFuture 实战
C language principle explanation and code implementation of scalable / reduced thread pool
Multilevel mesoporous organometallic framework material zif-8 loaded with lactic acid oxidase (LOD) / ferric oxide (Fe304) / doxorubicin / insulin /cas9 protein / metronidazole / emodin methyl ether
【并行与分布式系统】Cache学习
[parallel and distributed systems] cache learning
378. 有序矩阵中第 K 小的元素
To view the data in redis, in addition to the command line and client, you have a third option
Epoll 反应堆模型核心原理及代码讲解
A digit DP
ADVANCE.AI首席执行官寿栋将在2022新兴市场品牌出海线上峰会分享跨境电商运用AI技术合规
Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0
Li Kou brushing questions - hash table
Setting access to win10 shared folder without verification
Optimized dispatching (thermal power, wind energy and energy storage) [matlab code implementation]
多级介孔有机金属骨架材料ZIF-8负载乳酸氧化酶(LOD)/四氧化三铁(Fe304)/阿霉素DOX/胰岛素/cas9蛋白/甲硝唑/大黄素甲醚
NFT insider 61:animoca brands holds US $1.5 billion of encrypted assets in 340 investments
421. 数组中两个数的最大异或值
Why can some programmers get good offers with average ability?
Customized redistemplate in redis
Epoll 原理及应用 && ET模式与LT模式


