problemscpp
A collection of my answers to algorithm problems in c++.
载入中...
搜索中...
未找到
leetcode::count_good_triplets_in_an_array::FenwickTree< T > 模板类 参考

#include <leetcode.h>

Public 成员函数

 FenwickTree (int limit)
 
query (int idx)
 
void update (int idx, T delta)
 

静态 Private 成员函数

static int lowbit (int x)
 

Private 属性

vector< T > arr
 
int limit {}
 

详细描述

template<class T>
class leetcode::count_good_triplets_in_an_array::FenwickTree< T >

在文件 leetcode.h1226 行定义.

构造及析构函数说明

◆ FenwickTree()

成员函数说明

◆ lowbit()

template<class T>
static int leetcode::count_good_triplets_in_an_array::FenwickTree< T >::lowbit ( int x)
inlinestaticprivate

在文件 leetcode.h1230 行定义.

1230{ return x & -x; }

被这些函数引用 query() , 以及 update().

◆ query()

template<class T>
T leetcode::count_good_triplets_in_an_array::FenwickTree< T >::query ( int idx)
inline

在文件 leetcode.h1244 行定义.

1244 {
1245 T ans = 0;
1246 for(; idx > 0; idx -= lowbit(idx)) {
1247 ans += arr[idx];
1248 }
1249 return ans;
1250 }

引用了 arr , 以及 lowbit().

被这些函数引用 leetcode::count_good_triplets_in_an_array::Solution::goodTriplets().

◆ update()

template<class T>
void leetcode::count_good_triplets_in_an_array::FenwickTree< T >::update ( int idx,
T delta )
inline

在文件 leetcode.h1238 行定义.

1238 {
1239 for(; idx <= limit; idx += lowbit(idx)) {
1240 arr[idx] += delta;
1241 }
1242 }

引用了 arr, limit , 以及 lowbit().

被这些函数引用 leetcode::count_good_triplets_in_an_array::Solution::goodTriplets().

类成员变量说明

◆ arr

template<class T>
vector<T> leetcode::count_good_triplets_in_an_array::FenwickTree< T >::arr
private

在文件 leetcode.h1228 行定义.

被这些函数引用 FenwickTree(), query() , 以及 update().

◆ limit

template<class T>
int leetcode::count_good_triplets_in_an_array::FenwickTree< T >::limit {}
private

在文件 leetcode.h1227 行定义.

1227{};

被这些函数引用 FenwickTree() , 以及 update().


该类的文档由以下文件生成: