摘要: Description In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its or 阅读全文
posted @ 2017-05-20 19:31 紫魔戒 阅读(133) 评论(0) 推荐(0)
摘要: DescriptionGiven an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200,... 阅读全文
posted @ 2017-05-15 15:17 紫魔戒 阅读(160) 评论(0) 推荐(0)
摘要: 线程安全 & 线程安全函数 & 线程不安全函数 线程安全 就是多线程访问时,采用了加锁机制,当一个线程访问该类的某个数据时,进行保护,其他线程不能进行访问直到该线程读取完,其他线程才可使用。不会出现数据不一致或者数据污染。 如果每次运行结果和单线程运行的结果是一样的,而且其他的... 阅读全文
posted @ 2017-05-15 07:12 紫魔戒 阅读(658) 评论(0) 推荐(0)
摘要: Linux进程状态Linux内核中的进程状态◆运行状态(TASK_RUNNING) 指正在被CPU运行或者就绪的状态。这样的进程被成为runnning进程。运行态的进程可以分为3种情况:内核运行态、用户运行态、就绪态。◆可中断睡眠状态(TASK_INTERRUPTIBLE) 处于... 阅读全文
posted @ 2017-05-13 10:11 紫魔戒 阅读(203) 评论(0) 推荐(0)
摘要: C++的四种强制类型转换为:static_cast、const_cast、reinterpret_cast和dynamic_cast 类型转换的一般形式:cast-name(expression);static_cast任何具有明确定义的类型转换,只要不包含底层const,都可以使... 阅读全文
posted @ 2017-05-10 07:17 紫魔戒 阅读(313) 评论(0) 推荐(0)
摘要: TCP超时重传 原理是在发送某一个数据以后就开启一个计时器,在一定时间内如果没有得到发送的数据报的ACK报文,那么就重新发送数据,直到发送成功为止。 影响超时重传机制协议效率的一个关键参数是重传超时时间(RTO,Retransmission TimeOut)。RTO的值被设置过... 阅读全文
posted @ 2017-05-08 19:33 紫魔戒 阅读(511) 评论(0) 推荐(0)
摘要: DescriptionImplement int sqrt(int x). Compute and return the square root of x.my program 思路:看似很简单的问题,可以不断的优化算法,最开始容易想到的是定义一个num使其递增,直到num*num... 阅读全文
posted @ 2017-05-07 20:25 紫魔戒 阅读(151) 评论(0) 推荐(0)
摘要: DescriptionGiven a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the... 阅读全文
posted @ 2017-05-04 12:56 紫魔戒 阅读(145) 评论(0) 推荐(0)
摘要: DescriptionGiven an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].my programclass Solution {... 阅读全文
posted @ 2017-04-23 22:15 紫魔戒 阅读(88) 评论(0) 推荐(0)
摘要: HTTP状态码 分类 解释 描述 1XX 信息 服务器收到请求,需要请求者继续执行操作 2XX 成功 操作被成功接收并处理 3XX 重定向 需要进一步的操作以完成请求 4XX 客户端错误 请求包含语法错误或无法完成请求 5XX 服务器错误 服务器在... 阅读全文
posted @ 2017-04-19 15:08 紫魔戒 阅读(402) 评论(0) 推荐(0)