自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

天行健,君子以自强不息

守住心灵的宁静

  • 博客(19)
  • 资源 (1)
  • 收藏
  • 关注

原创 【LeetCode】Best Time to Buy and Sell Stock总结

LeetCode上买卖股票的问题如下:121. Best Time to Buy and Sell Stock 122. Best Time to Buy and Sell Stock II 123. Best Time to Buy and Sell Stock III 188. Best Time to Buy and Sell Stock IV 309. Best Time to...

2019-07-29 00:39:02 252

原创 Nginx源码解析——线程池

nginx是采用多进程模型,master和worker之间主要通过pipe管道的方式进行通信,多进程的优势就在于各个进程互不影响。其实,nginx代码中也提供了一个thread_pool(线程池)的核心模块来处理多任务的。主要放在ngx_thread_pool.c文件中。线程池的数据结构task结构,为单链表组成任务队列,主要成员是event事件和handler回调方法id每次pu...

2019-07-23 02:26:48 716

原创 Nginx源码结构

Nginx源码文件主要放在src文件夹下:.├── core├── event├── http├── mail├── misc├── os└── stream输出结果显示有 6 个目录文件,以下是这些目录文件的功能:core :Nginx的核心源代码,包括常用数据结构的以及Nginx 内核实现的核心代码; event:Nginx事件驱动模型,以及定时器的实现相关...

2019-07-19 02:35:51 398

原创 Nginx源码解析——内存池

目录1.内存池的数据结构2.内存池的操作.创建内存池:销毁内存池重置内存池内存分配cleanup资源方法:内存池就是为了降低程序员犯错几率的: 模块开发者只需要关心内存的分配, 而释放则交由内存池来负责。Nginx内存池思路:把内存分配归结为大内存分配和小内存分配。若申请的内存大小比同页的内存池最大值 max 还大,则是大内存分配,否则为小内存分配。大块内存的分...

2019-07-17 02:46:51 276

原创 STL源码剖析——hash_map解析

目录hash table 的节点定义:hashtable 的迭代器:hashtable 的数据结构rehash和插入操作复制与整体删除C++实现的hashmap简易类STL的的hash_set,hash_map都是基于hash_table实现的,SGI STL 中哈希表采用链接法解决冲突。结构中维护了一个 vector,vector 中每一个元素称为一个桶(bucket...

2019-07-09 02:01:41 648

原创 STL源码剖析——vector的实现

目录vector的数据结构vector的构造与析构vector的插入与删除vector的其他操作reserve()与resize()的区别vector的简单实现vector的扩容系数vector的数据结构vector采用简单的线性连续空间。以两个迭代器start和end分别指向头尾,并以迭代器end_of_storage指向容量尾端。容量可能比(尾-头)还大,多...

2019-07-07 03:17:13 282

原创 STL源码剖析——空间配置器

目录构造和析构基本工具:construct() 和 destroy()空间的配置与释放:std::alloc二级空间配置器简述空间配置函数allocate()空间释放函数deallocate()重新填充free lists内存池多线程环境下内存池互斥访问小结在STL中,空间配置在C++的基础上增加了一些特性。STL allocator 将这两个阶段分开操...

2019-07-07 02:17:08 268

原创 MySQL索引解析

目录1.MyISAM的索引实现2.InnoDB的索引模型3.B-Tree和B+Tree分析4.覆盖索引5.最左前缀原则6.唯一索引和普通索引的性能差异索引的出现是为了提高查询效率,但是实现索引的方式却有很多种,本质上就是用于提高读写效率的数据结构,主要有哈希表、有序数组和搜索树。这里主要讲MyISAM和InnoDB两个存储引擎的索引实现方式。1.MyISAM的索引实...

2019-07-04 02:41:52 194

原创 MySQL事务隔离解析

目录1.隔离级别2.事务隔离的实现3.事务的启动方式4.“快照”在MVCC里的实现5.事务更新的逻辑1.隔离级别SQL标准的事务隔离级别包括: 读未提交( read uncommitted) 、读提交( read committed) 、 可重复读( repeatable read) 和串行化( serializable )。读未提交是指, 一个事务还没提交时,...

2019-07-02 23:52:32 139

原创 【LeetCode】739. Daily Temperatures

Given a list of daily temperaturesT, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which...

2019-07-01 02:00:17 125

原创 【LeetCode】901. Online Stock Span

Write a classStockSpannerwhich collects daily price quotes for some stock, and returns thespanof that stock's price for the current day.The span of the stock's price todayis defined as the maxi...

2019-07-01 01:55:54 174

原创 【LeetCode】42. Trapping Rain Water

Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array...

2019-07-01 01:41:29 171

原创 【LeetCode】Largest Rectangle in Histogram

Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of ea...

2019-07-01 01:31:04 193 1

原创 【LeetCode】Container With Most Water

Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two...

2019-07-01 01:14:32 141

原创 【LeetCode】239. Sliding Window Maximum

Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window ...

2019-07-01 01:00:58 103

原创 【LeetCode】904. Fruit Into Baskets

In a row of trees, the i-th tree produces fruit with type tree[i].You start at any tree of your choice, then repeatedly perform the following steps:Add one piece of fruit from this tree to your b...

2019-07-01 00:53:42 173

原创 【LeetCode】Longest Substring with At Most Two Distinct Characters

给定一个字符串 s ,找出至多包含两个不同字符的最长子串 t 。示例 1:输入: "eceba"输出: 3解释: t 是 "ece",长度为3。示例 2:输入: "ccaabbb"输出: 5解释: t 是 "aabbb",长度为5。来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/longest-substrin...

2019-07-01 00:47:50 203

原创 【LeetCode】Minimum Window Substring

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Example:Input: S = "ADOBECODEBANC", T = "ABC"Output: "BANC"Note:I...

2019-07-01 00:26:19 127

原创 【LeetCode】713. Subarray Product Less Than K

Your are given an array of positive integers nums.Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than k.Example 1:Input: nums ...

2019-07-01 00:17:05 143

网易新闻客户端

新闻阅读客户端,界面优美,可离线阅读,代码量大,对于android开发者和android学习人员都有很大的帮助

2015-04-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除