11 2014 档案

摘要:This page will describe the steps you have to take to install LAMP, which stands for Linux Apache MariaDB PHP. This page will show you, how to set up ... 阅读全文
posted @ 2014-11-25 16:00 Ryan in C++ 阅读(252) 评论(0) 推荐(0)
摘要:https://github.com/huangz1990/redis-3.0-annotated/blob/unstable/src/sds.c#L120 1 /* SDSLib, A C dynamic strings library 2 * 3 * Copyright (c) ... 阅读全文
posted @ 2014-11-21 23:52 Ryan in C++ 阅读(2832) 评论(0) 推荐(0)
摘要:学习flexible array member是因为阅读Redis源码遇到的,sds.h中一开始就用到了。==============================================================================================在讲述... 阅读全文
posted @ 2014-11-21 21:27 Ryan in C++ 阅读(588) 评论(0) 推荐(0)
摘要:原文链接在这篇文章中, 我将向大家介绍一种我认为比较合理的 Redis 源码阅读顺序, 希望可以给对 Redis 有兴趣并打算阅读 Redis 源码的朋友带来一点帮助。第 1 步:阅读数据结构实现刚开始阅读 Redis 源码的时候, 最好从数据结构的相关文件开始读起, 因为这些文件和 Redis 中... 阅读全文
posted @ 2014-11-20 23:57 Ryan in C++ 阅读(1459) 评论(0) 推荐(0)
摘要:http://www.cppblog.com/cuijixin/archive/2008/03/14/44480.html是不是还对用c怎么实现网络编程感到神秘莫测阿,我们这里就要撕开它神秘的面纱,呵呵。一起来:诶,不要着急,我们先来介绍一些网络程序的主要执行过程,主要是便于大家更好的理解下面的程序... 阅读全文
posted @ 2014-11-20 23:47 Ryan in C++ 阅读(1970) 评论(0) 推荐(0)
摘要:1. Triangle 1 class Solution { 2 public: 3 int minimumTotal(vector > &triangle) { 4 int n=triangle.size(); 5 int* res=new int[n]; ... 阅读全文
posted @ 2014-11-19 16:45 Ryan in C++ 阅读(296) 评论(0) 推荐(0)
摘要:1. Search Insert Position 1 class Solution { 2 public: 3 int searchInsert(int A[], int n, int target) { 4 int left=0,right=n-1; 5 ... 阅读全文
posted @ 2014-11-18 19:18 Ryan in C++ 阅读(238) 评论(0) 推荐(0)
摘要:Skip List | Set 1 (Introduction)Can we search in a sorted linked list in better than O(n) time?The worst case search time for a sorted linked list is ... 阅读全文
posted @ 2014-11-16 15:28 Ryan in C++ 阅读(523) 评论(0) 推荐(0)
摘要:原文出处复习数据结构的时候看到指针的引用,两年前学的细节确实有点想不起来,于是查了一下网上的资料,并且自己实践了一下,总结了一句话就是:指针作为参数传给函数,函数中的操作可以改变指针所指向的对象和对象的值,但函数结束后还是会指向原来的对象,若要改变,可用指针的指针或者指针的引用。 ps:对原po的... 阅读全文
posted @ 2014-11-16 13:57 Ryan in C++ 阅读(195) 评论(0) 推荐(0)
摘要:这道题让我切身体会了引用传递和值传递这两种方式的巨大差异。在isValid子函数中,若采用引用传递将board传参,程序运行时间在0.068左右,可以AC.若采用值传递将board传参,程序运行时间在2.011左右,直接TLE。一切只因为一个"&". 引用传递与值传递效率差异可以如此明显。 1 cl... 阅读全文
posted @ 2014-11-16 09:48 Ryan in C++ 阅读(227) 评论(0) 推荐(0)
摘要:【15.5.25】贴一段实用的代码,linux下跑过。 1 #include /* printf */ 2 #include /* clock_t, clock, CLOCKS_PER_SEC */ 3 #include /* sqrt */ 4 #inclu... 阅读全文
posted @ 2014-11-16 09:29 Ryan in C++ 阅读(293) 评论(0) 推荐(0)
摘要:http://blog.baozitraining.org/2014/09/how-to-prepare-system-design-questions.html如何准备面试中的系统设计问题一直都是包子的学员,尤其是fresh new grad比较头疼的一个问题。我们的好朋友在mitbbs上面与大家... 阅读全文
posted @ 2014-11-15 10:50 Ryan in C++ 阅读(444) 评论(0) 推荐(0)
摘要:这题的边边角角太多了。写的挺蛋疼的。 1 class Solution {//by myself and AC 2 public: 3 vector fullJustify(vector &words, int L) { 4 vector res; 5 vec... 阅读全文
posted @ 2014-11-13 16:19 Ryan in C++ 阅读(280) 评论(0) 推荐(0)
摘要:Given a string S, find the longest palindromic substring in S.Note:This is Part II of the article:Longest Palindromic Substring. Here, we describe an ... 阅读全文
posted @ 2014-11-12 20:21 Ryan in C++ 阅读(445) 评论(0) 推荐(0)
摘要:这道题就是大数运算。lexi's的想法很好,在操作之前先把num1和num2给逆置,方便操作。Tenos的文章通过一张图把计算过程直观的展示出来。 1 class Solution { 2 public: 3 string multiply(string num1, string num2)... 阅读全文
posted @ 2014-11-11 23:58 Ryan in C++ 阅读(217) 评论(0) 推荐(0)
摘要:http://yucoding.blogspot.com/2013/02/leetcode-question-123-wildcard-matching.html几个例子:(1)acbdeabda*c*d(2)acbdeabdkadfaa*c*dfaAnalysis:For each element... 阅读全文
posted @ 2014-11-11 00:23 Ryan in C++ 阅读(257) 评论(0) 推荐(0)
摘要:一共用两个栈。一个栈elements用来放所有数据,另一个栈mins专门用来存放最小值。入栈时所有元素都能加入elements栈,但只有当前元素小于等于mins栈的栈顶元素时才能加入mins栈。 1 class MinStack { 2 public: 3 void push(int x) ... 阅读全文
posted @ 2014-11-10 18:04 Ryan in C++ 阅读(2071) 评论(0) 推荐(1)
摘要:Problem Statement(link):Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's i... 阅读全文
posted @ 2014-11-07 18:39 Ryan in C++ 阅读(370) 评论(0) 推荐(0)
摘要:linux下 ss -i 可显示rto.how to display tcp rtohttp://linuxaleph.blogspot.com/2013/07/how-to-display-tcp-rto.html 1 /* 2 * ss.c "sockstat", soc... 阅读全文
posted @ 2014-11-06 15:21 Ryan in C++ 阅读(1378) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2014-11-06 00:27 Ryan in C++ 阅读(3) 评论(0) 推荐(0)
摘要:In most cases you will need root permission to be able to capture packets on an interface. Using tcpdump (with root) to capture the packets and saving... 阅读全文
posted @ 2014-11-03 13:18 Ryan in C++ 阅读(501) 评论(0) 推荐(0)
摘要:对于第2个pascal triangle,通过观察可以发现,其实只需要2个额外的变量来记录,于是就设了个tmp数组。整体有点DP问题中的滚动数组的感觉。 1 #include 2 #include 3 using namespace std; 4 5 class Solution { 6 pu... 阅读全文
posted @ 2014-11-02 16:04 Ryan in C++ 阅读(236) 评论(0) 推荐(0)
摘要:http://linux-circles.blogspot.com/2012/11/how-to-capture-packets-with-tcpdump.htmlSee the list of interfaces on which tcpdump can listen# /usr/sbin/tc... 阅读全文
posted @ 2014-11-01 22:01 Ryan in C++ 阅读(418) 评论(0) 推荐(0)