差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
programming_algorithm:data_structure:balancing_binary_search_tree:tree_free [2020/09/03] – [Binary Indexed Tree] ikatakos | programming_algorithm:data_structure:balancing_binary_search_tree:tree_free [2021/09/04] – [Binary Indexed Tree] ikatakos | ||
---|---|---|---|
行 57: | 行 57: | ||
|erase |$O(\log{N})$| | |erase |$O(\log{N})$| | ||
|upper_bound \\ lower_bound|$O(\log{N})$| | |upper_bound \\ lower_bound|$O(\log{N})$| | ||
+ | |||
+ | === 例 === | ||
+ | |||
+ | 累積和 | ||
+ | 初期状態 | ||
+ | [0 0 0 0 0 0 0 0] {} | ||
+ | 5を追加 | ||
+ | [0 0 0 0 1 1 1 1] {5} | ||
+ | 3を追加 | ||
+ | [0 0 1 1 2 2 2 2] {3, 5} | ||
+ | 小さい方から2番目を取得 | ||
+ | [0 0 1 1 2 2 2 2] {3, 5} | ||
+ | | ||
+ | 2, | ||
+ | [0 1 3 3 4 4 5 5] {2, 3, 3, 5, 7} | ||
+ | 6以上の最小の値を取得 | ||
+ | [0 1 3 3 4 4 5 5] {2, 3, 3, 5, 7} | ||
+ | | ||
+ | | ||
+ | 7を削除 | ||
+ | [0 1 3 3 4 4 4 4] {2, 3, 3, 5} | ||
+ | 6以上の最小の値を取得 | ||
+ | [0 1 3 3 4 4 4 4] {2, 3, 3, 5} | ||
+ | | ||
+ | (BITの実装にも依るが) | ||
+ | |||
=== バリエーション === | === バリエーション === |