上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 23 下一页
摘要: 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++ 阅读(2735) 评论(0) 推荐(0)
摘要: 学习flexible array member是因为阅读Redis源码遇到的,sds.h中一开始就用到了。==============================================================================================在讲述... 阅读全文
posted @ 2014-11-21 21:27 Ryan in C++ 阅读(582) 评论(0) 推荐(0)
摘要: 原文链接在这篇文章中, 我将向大家介绍一种我认为比较合理的 Redis 源码阅读顺序, 希望可以给对 Redis 有兴趣并打算阅读 Redis 源码的朋友带来一点帮助。第 1 步:阅读数据结构实现刚开始阅读 Redis 源码的时候, 最好从数据结构的相关文件开始读起, 因为这些文件和 Redis 中... 阅读全文
posted @ 2014-11-20 23:57 Ryan in C++ 阅读(1448) 评论(0) 推荐(0)
摘要: http://www.cppblog.com/cuijixin/archive/2008/03/14/44480.html是不是还对用c怎么实现网络编程感到神秘莫测阿,我们这里就要撕开它神秘的面纱,呵呵。一起来:诶,不要着急,我们先来介绍一些网络程序的主要执行过程,主要是便于大家更好的理解下面的程序... 阅读全文
posted @ 2014-11-20 23:47 Ryan in C++ 阅读(1965) 评论(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++ 阅读(287) 评论(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++ 阅读(234) 评论(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++ 阅读(517) 评论(0) 推荐(0)
摘要: 原文出处复习数据结构的时候看到指针的引用,两年前学的细节确实有点想不起来,于是查了一下网上的资料,并且自己实践了一下,总结了一句话就是:指针作为参数传给函数,函数中的操作可以改变指针所指向的对象和对象的值,但函数结束后还是会指向原来的对象,若要改变,可用指针的指针或者指针的引用。 ps:对原po的... 阅读全文
posted @ 2014-11-16 13:57 Ryan in C++ 阅读(185) 评论(0) 推荐(0)
摘要: 这道题让我切身体会了引用传递和值传递这两种方式的巨大差异。在isValid子函数中,若采用引用传递将board传参,程序运行时间在0.068左右,可以AC.若采用值传递将board传参,程序运行时间在2.011左右,直接TLE。一切只因为一个"&". 引用传递与值传递效率差异可以如此明显。 1 cl... 阅读全文
posted @ 2014-11-16 09:48 Ryan in C++ 阅读(222) 评论(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++ 阅读(290) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 23 下一页