算法技巧-倍增法
文章平均质量分 73
memcpy0
希望探索文理结合的自由之路。
展开
-
【算法学习笔记】Sparse Table
文章目录1. RMQ问题2. Sparse-Table(1) 预处理(动态规划)(2) 区间查询3. 扩展4. 题目 1. RMQ问题 RMQ(Range Minimum/Maximum Query) 区间最小/大值问题。给定一个 nnn 个元素的数组 A1,A2,A3,…,AnA_1, A_2, A_3, \dots, A_nA1,A2,A3,…,An ,设计一个数据结构,支持区间查询操作 QueryMin(L,R) :计算 min{AL,AL+1,…,AR}\min \{A_L, A_{L+原创 2020-09-03 15:33:31 · 234 阅读 · 0 评论 -
LeetCode C++ 1483. Kth Ancestor of a Tree Node【动态规划+倍增】困难
You are given a tree with n nodes numbered from 0 to n-1 in the form of a parent array where parent[i] is the parent of node i. The root of the tree is node 0. Implement the function getKthAncestor(int node, int k)&n原创 2021-04-02 18:40:19 · 201 阅读 · 0 评论