摘要: 1. strstr() - retun pointer to the first occurence of substring in string.char* strstr(char *str, char *substr){ int i = 0; int str_len = strlen(str); int sub_len = strlen(substr); while (i <= str_len - sub_len) { int j = 0; while (str[i] == substr[j] && j<sub_len) { i++; j++; } if (j 阅读全文
posted @ 2011-10-24 06:15 Sw_R 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1. Shallow (member wise) vs Deep copies:http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying/2. C++ 11 的新特性:http://blog.csdn.net/lanphaday/article/details/6564162 阅读全文
posted @ 2011-09-20 10:02 Sw_R 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 先分享一个关于HTTP协议的文章:http://blog.csdn.net/gueter/article/details/15244471. 需要安装chorme 14,还有python 2.7,和native client sdk。http://code.google.com/chrome/nativeclient/在chorme (about://flags)把native client 的enable。2. 创建项目的模板文件:在examples下面创建一个叫hello_tutorial的project。cd project_templatespython init_project.py 阅读全文
posted @ 2011-09-19 14:59 Sw_R 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1. list pair倒序~ 如: 1->2->3->4; after: 2->1->4->3;void MyList::pairReverse(ListNode *p) // p is head{ ListNode *ptr1 = p; // ListNode *ptr2 = p->next; ListNode *prev = p; head = ptr2; while(ptr1->next!=0 && ptr2->next!=0) { prev->next = ptr2; ptr1->next = ptr2 阅读全文
posted @ 2011-09-04 12:10 Sw_R 阅读(157) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2011-08-25 13:36 Sw_R 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1. Join:Return rows that at least there is one match in both tables. left join: return all rows from the left table, even if there is no match in right table. ritht join: return all row from the right table, even if there is no match in left table. 阅读全文
posted @ 2011-08-22 13:46 Sw_R 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 一些算法:http://www.cs.utexas.edu/users/djimenez/utsa/cs3343/lecture25.html1. Print all permutations of a string.一位网友的博文:http://n1b-algo.blogspot.com/2009/01/string-permutations.html2.Given a telephone number, find all the permutations of the letters.char letters[10][5] = { " ", //0 " &qu 阅读全文
posted @ 2011-08-13 05:00 Sw_R 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 好的入门资料:http://progit.org/book/zh/ch3-0.html还有这是windows下的git配置:http://www.cnblogs.com/sorex/archive/2011/08/10/2132359.html纠结了一下午鸟~ 阅读全文
posted @ 2011-08-12 06:43 Sw_R 阅读(111) 评论(0) 推荐(0) 编辑
摘要: One method to find prime numbers isSieve of Eratosthenes :http://en.wikipedia.org/wiki/Sieve_of_eratosthenesvoid sieve_prime(int n, bool prime[]){ prime[0] = false; prime[1] = false; int m = sqrt((double)n); for(int i=2; i<n; i++) { prime[i] = true; } for(int i=2; i<=m; i++) { for(int j=i*i; j 阅读全文
posted @ 2011-08-06 13:34 Sw_R 阅读(140) 评论(0) 推荐(0) 编辑
摘要: You are given an array ' containing 0s and 1s. Find O(n) time and O(1) spacealgorithm to find the maximum sub sequence which has equal number of 1s and0s.Examples1) 10101010The longest sub sequence that satisfies the problem is the input itself2)1101000The longest sub sequence that satisfies the 阅读全文
posted @ 2011-08-05 23:18 Sw_R 阅读(151) 评论(0) 推荐(0) 编辑