问:树状数组

学术版

快多少?
by K0stlin @ 2020-08-04 17:47:55


发现第一种写法中,每个树节点维护的信息与第二种的很不同: ``` 假设执行for(int i = 1;i<=10;++i) add(i,i); tree1:+1 tree2:+2 tree3:+1+2+3 tree4:+4 tree5:+4+5 tree6:+6 tree7:+1+2+3+4+5+6+7 tree8:+8 tree9:+8+9 tree10:+10 ```
by testbot @ 2020-08-04 17:49:10


@[Gooder_tmi](/user/114830) 总时间快大概0.1s
by testbot @ 2020-08-04 17:49:37


第二种要比第一种多做很多次运算。
by impuk @ 2020-08-04 17:50:20


@[一只爬行者](/user/279700) 并不见得会多很多运算
by testbot @ 2020-08-04 17:53:45


现在你没有tag了。
by Andy_chen @ 2020-08-04 17:54:23


@[Andy_chen](/user/247553) ?
by critnos @ 2020-08-04 17:56:12


[也许能帮到你](https://godbolt.org/)
by impuk @ 2020-08-04 17:56:58


@[mcyl35](/user/203623) 在他的犇犇里可以看到,以棕名有tag为炫耀点
by Andy_chen @ 2020-08-04 17:57:14


@[Andy_chen](/user/247553) ?
by critnos @ 2020-08-04 17:57:55


| 下一页