摘要: template<typename T> class BoundedBlockingQueue { public: // make class non-copyable BoundedBlockingQueue(const BoundedBlockingQueue<T>&) = delete; Bo 阅读全文
posted @ 2020-09-09 11:53 肉松松松松 阅读(163) 评论(0) 推荐(0)
摘要: 二分法查找循环有序数组中的某一元素,如果存在返回该值,否则返回 -1。int getNumFromLooOrderArray(int arr[], int target, int left, int right) { while (left < right) { int mid = left + ( 阅读全文
posted @ 2020-09-08 11:13 肉松松松松 阅读(362) 评论(0) 推荐(0)
摘要: class Solution { public: struct cmp { bool operator()(string a,string b) { return a+b>b+a; } }; string minNumber(vector<int>& nums) { priority_queue<s 阅读全文
posted @ 2020-09-06 22:54 肉松松松松 阅读(168) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r 阅读全文
posted @ 2020-09-02 20:22 肉松松松松 阅读(113) 评论(0) 推荐(0)
摘要: #include<iostream> #include<algorithm> using namespace std; int n;//进制定义为全局变量,方便后续使用; string convert(int x) { string rec; while(x){ if(x%n < 10) rec + 阅读全文
posted @ 2020-08-27 21:21 肉松松松松 阅读(195) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-08-23 14:49 肉松松松松 阅读(66) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/coin-change/ class Solution { public: //index 是index及其后面的硬币随便选 int process1(vector<int>& coins, int index,int amount) 阅读全文
posted @ 2020-08-22 00:09 肉松松松松 阅读(93) 评论(0) 推荐(0)
摘要: 首先传统的用链表存储k-v结构的结点,并按照结点有序,那么插入查询删除的时间复杂度都是O(n),如果使用红黑树来存储插入查询删除的时间复杂度都是O(logn),但是一方面红黑树的实现比较复杂,并且每一个节点的插入和删除会操作很多结点,这样不适合多线程操作,这时候跳跃表实现了存储插入查询删除的时间复杂 阅读全文
posted @ 2020-08-20 22:29 肉松松松松 阅读(131) 评论(0) 推荐(0)
摘要: insertTail尾插 1。如果大小为0,就更新头尾节点 2。如果大小不为0且没有满的情况下,尾插法 movetoend把节点移到最后 1.如果尾部已经要操作的结点,不动;如果是头结点换到尾部,更换头结点;结点的前一个的next指向这个节点的next,这个节点的pre是尾结点,那么尾指向它,这个节 阅读全文
posted @ 2020-08-19 09:44 肉松松松松 阅读(104) 评论(0) 推荐(0)
摘要: class Solution { public: int largestRectangleArea(vector<int>& heights) { if(heights.size()==0) return 0; stack<int>st; int res=-1; int len=heights.si 阅读全文
posted @ 2020-08-16 22:31 肉松松松松 阅读(111) 评论(0) 推荐(0)