摘要:
题目链接:223. 矩形面积 - 力扣(LeetCode) 解析: 确实不擅长几何题,用投影求重叠矩形的边长 看官方题解吧 class Solution { public: int computeArea(int ax1, int ay1, int ax2, int ay2, int bx1, in 阅读全文
摘要:
C++ set 容器基于红黑树实现,其核心操作的时间复杂度如下: 查找、插入、删除操作:平均和最坏情况均为 O(log n),其中 n 是集合中的元素数量。这种对数级性能得益于红黑树的自平衡特性。 遍历操作:时间复杂度为 O(n),需要访问每个元素 需要注意的点: 容器类型限制 阅读全文
摘要:
好多年了,竟然没忘,蓝书上的,之后数据结构书又改一了版 void quick_sort(vector<int>& nums, const int& k, int x, int y) { if (x >= y) return; int p = x, q = y; int stash = nums[x] 阅读全文