题目: 解答: 1 class Solution { 2 public: 3 vector<int> getLeastNumbers(vector<int>& arr, int k) 4 { 5 vector<int> res; 6 priority_queue<int> q; 7 for (int ...
分类:
其他好文 时间:
2020-05-09 16:45:57
阅读次数:
52
# ```class MedianFinder {public: /** initialize your data structure here. */ MedianFinder() { } priority_queue max_heap; priority_queue, greater> min_... ...
分类:
其他好文 时间:
2020-05-03 20:26:14
阅读次数:
66
link class Solution { public: struct Comp{ bool operator()(vector<int>& v1, vector<int>& v2){ return v1[0]+v1[1]>v2[0]+v2[1]; } }; int kthSmallest(vec ...
分类:
其他好文 时间:
2020-05-03 20:13:29
阅读次数:
92
多线程 创建线程方式1 /** * 创建线程方式1: * 1、继承Thread类 * 2、重写run方法 * 3、调用start开启线程 * 注意:线程开启不一定执行,由CPU调度 */ public class ThreadTest extends Thread{ @Override public ...
分类:
编程语言 时间:
2020-05-01 20:31:23
阅读次数:
67
--start with ... connect by prior --case1 select * from org o --excute order=>first:start with connect by prior, then where condition where o.flag = ' ...
分类:
数据库 时间:
2020-05-01 10:30:14
阅读次数:
86
手写堆 算法思想 堆是一颗完全二叉树 STL里的堆就是优先队列priority_queue 用一维数组存储 下标一定是从1开始,避免0的左儿子2x还是0的冲突 核心操作:down(x)下移节点 up(x)上移节点 插入一个数 heap[++size] = x; up(size); 求集合当中的最小值 ...
分类:
其他好文 时间:
2020-04-29 12:33:48
阅读次数:
52
1 class Twitter 2 { 3 public: 4 unordered_map<int,priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>> u;//用户 -> (出现的次数,推文) 小根堆 ...
分类:
其他好文 时间:
2020-04-22 23:00:19
阅读次数:
114
boost serialization it has 2 modes: intrusive and non intrusive intrusive mode non intrusive mode How does boost impl the 2 modes? A: By function over ...
分类:
其他好文 时间:
2020-04-21 15:28:44
阅读次数:
71
D D HDU 3282 思路 题意:给我一个奇数长度为n的序列,从左到右依次输出 1~当前技术位置的 这个子区间内的中位数。 思路 1 .法一: 维护一个最小根堆、最大根堆(注意less 在priority_queue 中的数字排列的顺序是按从头部top 按数字大小逐渐递减,而gerater 在p ...
分类:
其他好文 时间:
2020-04-21 12:54:09
阅读次数:
59
今天讲一下队列,用到一个python自带的库,queue 队列的三种方法有: 1、FIFO先入先出队列(Queue) 2、LIFO后入先出队列(LifoQueue) 3、优先级队列(PriorityQueue) 先讲一下Queue中的几个方法 # 三种 FIFO LIFO Priority # 创建 ...
分类:
编程语言 时间:
2020-04-19 00:54:35
阅读次数:
60