10 2014 档案
摘要:之前是通过hash来做,O(n)。这次为了熟悉通用性的解法,通过双指针来做。时间复杂度为O(nlogn)(即sort的复杂度)。主要是关于sort的用法上不太熟,关于自定义sort规则。C++ Reference中给的示例代码如下: 1 // sort algorithm example 2 #in...
阅读全文
摘要:ls -l |grep "^d"|wc -l统计文件夹下文件的个数,包括子文件夹里的ls -lR|grep "^-"|wc -l如统计/home/han目录(包含子目录)下的所有js文件则:ls -lR /home/han|grep js|wc -l 或 ls -l "/home/han"|grep...
阅读全文
摘要:1 class Solution { 2 public: 3 int minDepth(TreeNode *root) { 4 if (root == nullptr) return 0; 5 if (root->left != nullptr&&root-...
阅读全文
摘要:recursive 1 #include 2 #include 3 using namespace std; 4 5 struct TreeNode { 6 int val; 7 TreeNode *left; 8 TreeNode *right; 9 ...
阅读全文
摘要:diff --git a/include/net/tcp.h b/include/net/tcp.h@@ -1013,8 +1048,13 @@ static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)该函数在2.6.32...
阅读全文
摘要:1.解压缩tar.gz:tar -zxvf archive_name.tar.gz2.解压缩tar.xz(1)首先使用xz解压 tar.xz文件: xz -d linux-3.8.4.tar.xz 这个操作会将linux-3.8.4.tar.xz文件解压成linux-3.8.4.tar,然后我们再对...
阅读全文
摘要:http://cn.opensuse.org/OpenSUSE_%E5%86%85%E6%A0%B8%E7%BC%96%E8%AF%91%E6%95%99%E7%A8%8B_(kernel_2.6.x)Contents[hide]1声明2简述3基础知识3.1什么是内核3.2什么是补丁3.3为什么要重...
阅读全文
摘要:1 Server: 5, win: 20pkt, SRU: 256KB, link_buf: 32pkt, Seed: 1, 2 Block_trans: 1350200B, RTT: 100us, RTT_rand: 20us, SYN_del: 0-0us 3 4 0.99...
阅读全文
摘要:Congestion Avoidance in TCP Consequence of lack of congestion control When a popular resource is shared without regulation the result is always ove...
阅读全文
摘要:Studying TCP's Throughput and Goodput using NS What is Throughput Throughput is the amount of data received by the destination.The Average Throughput ...
阅读全文
摘要:Studying TCP's Congestion Window using NS How to obtain TCP's CWND value The most important value that determine the behavior of TCP is the congestion...
阅读全文
摘要:NS Simulation: Scheduling Events Simulation time A similation system (such as NS) must have a built-in simulation clock - it represents the "clock" ...
阅读全文
摘要:这个网站上的一系列讲解NS2的内容真的是深入浅出,看完立刻豁然开朗。所以就接连转了几篇。Scheduling Events那篇里的例子特别好,看完就懂了。http://www.mathcs.emory.edu/~cheung/Courses/558-old/Syllabus/90-NS/NS Sim...
阅读全文
摘要:http://blog.csdn.net/kenden23/article/details/18696083本题是十分麻烦的题目,情况是非常多,网上也很多方法,其中最有效,优雅的方法是有限状态自动机(Finite automata machine)。其他一般方法都会十分复杂,而代码不能算优雅。为此我...
阅读全文
摘要:Solution: when see question about two strings , DP should be considered first.We can abstract this question to calculate appear times for string T wit...
阅读全文
摘要:属于中规中矩的dp。和unique paths类似。一次ac。但是可以通过滚动数组来节省存储空间。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Solution { 7 public: 8 int...
阅读全文
摘要:一维DP。 1 class Solution { 2 //Best time to buy and sell stock III 3 //correct one 4 public: 5 int maxProfit(vector &prices) { 6 if ...
阅读全文
摘要:Greedy 1 class Solution 3 public: 4 int jump(int A[], int n) { 5 int start = 0; 6 int end = 0; 7 int count = 0; 8 ...
阅读全文
摘要:http://blog.csdn.net/linhuanmars/article/details/20828631这个题是一个NP问题,方法仍然是N-Queens中介绍的套路。基本思路是先排好序,然后每次递归中把剩下的元素一一加到结果集合中,并且把目标减去加入的元素,然后把剩下元素(包括当前加入的元...
阅读全文
摘要:http://changhaz.wordpress.com/2014/10/15/leetcode-find-minimum-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution { 8 public: 9 string getPermutation(int n, int k) {10 ...
阅读全文
摘要:EdgeCase太容易出错。有两处都是应该为 2 #include 3 #include 4 using namespace std; 5 6 class Solution2 { 7 public: 8 void nextPermutation(vector &num) { 9 ...
阅读全文
摘要:LeetCode:SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution...
阅读全文
摘要:http://www.cnblogs.com/remlostime/archive/2012/11/14/2770072.html 1 class Solution { 2 private: 3 vector ret; 4 int pos[4]; 5 public: 6 bo...
阅读全文
摘要:http://yucoding.blogspot.com/2013/08/leetcode-question-132-palindrome.htmlAnalysis:When face the "return all", "get all ", "find all possible", "find ...
阅读全文
摘要:code: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution { 8 public: 9 int largestRectangleArea(vector &he...
阅读全文
摘要:http://www.cnblogs.com/lichen782/p/leetcode_maximal_rectangle.html题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle cont...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class Solution2 8 { 9 public:10 int largestRectangleArea(vector &heig...
阅读全文
摘要:IntroductionMe and my wife had some interesting conversations onObject Oriented Design principles. After publishing the conversation on CodeProject, I...
阅读全文
摘要:IntroductionMy wife Farhana wants to resume her career as a software developer (she started her career as a software developer, but couldn't proceed m...
阅读全文
摘要:http://www.programmerinterview.com/index.php/data-structures/difference-between-stack-and-heap/The differences between the stack and the heap can be c...
阅读全文
摘要:http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.htmlTable of ContentsStack vs HeapThe StackThe HeapStack vs Heap Pros and ConsStackHeapExamples...
阅读全文
摘要:http://www.cnblogs.com/felixfang/p/3676193.htmlLargest Rectangle in HistogramGivennnon-negative integers representing the histogram's bar height where...
阅读全文
摘要:先上代码。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Solution { 7 public: 8 int maxArea(vector &height) { 9 if (hei...
阅读全文
摘要:1 /* 2 * Copyright (c) 1991-1997 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source ...
阅读全文
摘要:托福分类词汇表(共17类863个常用单词)一、psychology 心理1. mental 心理的2. physical 身体的,物质的,物理的3. spiritual 心灵的4. conformity 从众5. majority 多数人6. minority 少数人7. threshold jud...
阅读全文

浙公网安备 33010602011771号