- 博客(116)
- 资源 (4)
- 收藏
- 关注
原创 GNUPLOT linespoints and save as pdf
set terminal postscript eps enhanced color font ',30'set yrange [0:1]set logscale xset xrange [200:100000]set gridset xlabel "flow duration (us)"set key bottomset output "| ps2pdf -dEPSCrop - w
2016-07-22 02:55:36 867 1
原创 [LeetCode] Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non
2015-08-06 11:52:46 671
原创 写在受洗之前:我为什么成为基督徒
1. 从逻辑上接受有神论的设定--三体的射手原理--反驳罗素的神的causation:知识圆论,他跳不出自己的圆--上帝在人心中的普遍显现:万物的见证--“一花一草皆有佛性”, 命运说,无神论者也会在极度困难时祈祷2. 以前认为只有软弱无知的才要依靠神,后来发现自己,以及每个人,都是软弱无知的,只有神是全能的。--在软弱的时候被黄山的美震撼到哭泣--三体3: 人类自大是多么
2015-07-28 13:28:43 5237
原创 [python] Lift is short, I need python!
class Solution: # @param s, a string # @return a string def reverseWords(self, s): if len(s)==0 : return s #reverse the whole string first s=s[::-1]
2015-07-26 00:27:02 868
原创 [LeetCode] HouseRobber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2015-07-07 11:29:03 784
原创 [LeetCode]Implement Trie (Prefix Tree)
class TrieNode {public: // Initialize your data structure here. TrieNode() { val='0'; end_of_a_word=0; for(int i=0;i<26;i++) {
2015-06-16 13:58:04 927
原创 [LeetCode] Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element
2015-06-11 13:48:11 827
原创 embed all fonts in pdf for camera ready version
gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
2014-08-26 05:01:40 942
原创 Matlab 命令行设置颜色和legend,保存图像,设置title。。。
i=10;goodput=(i-1)*5+2;rtt=goodput+1;lossrate=rtt+1;qpm=lossrate+1;total_request=qpm+1;figureh6=plot(asn12322_smoothed(:,goodput)*100/max(asn12322_smoothed(:,goodput)),'-r');hold on;h7=plot(a
2014-08-12 06:18:42 4455
原创 将文件夹下所有pdf变成黑白的脚本
#!/bin/bashfor file in ./*.pdfdo echo "$file" gs -o black+white.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sColorConversionStrategy=Gray -sColorConversionStrategyForImages=Gray -sProcessColo
2014-08-10 11:51:14 1779
原创 [Latex] 如何将latex的伪代码algorithm保存为大小fit的pdf或者图像
\documentclass{article}\usepackage[margin=0in,paperheight=8in, paperwidth=4.3in]{geometry}\usepackage{amsmath}\usepackage{algorithm}\usepackage[noend]{algpseudocode}\usepackage{setspace}\usepack
2014-08-10 01:21:12 2903
原创 Matlab 绘制 clustered rowstacked bar plot
set terminal postscript font "Helvetica, 16" set boxwidth 0.9 absolute set style fill pattern 2 border lt -1
2014-08-09 12:40:44 1920
原创 GNUPLOT bar plot 绘制,并用条纹填充
set terminal postscript font "Helvetica, 16"set boxwidth 0.9 absoluteset style fill pattern 2 border lt -1set style histogram clustered gap 1 title offset character 0, 0, 0set datafile missing '-
2014-08-08 12:00:22 5264
原创 Matlab绘图marker间距调整脚本
h1=plot(cubicdelay5thttp0500ms(1:180,3),cubicdelay5thttp0500ms(1:180,2)/1000,'--');hold onh2=plot(cubicdelay5thttp0500ms(1:180,3),theorapiddelay5thttp0500ms(1:180,2)/1000);h4=plot(cubicdelay5thttp0
2014-08-03 10:56:48 5600
原创 Matlab 绘图,文件名为变量肿么办
for i=1:100 filename=strcat('RTT/path',num2str(asn12322_counter(i,1)-1),'_loss_smooth_30.dat'); tmpfile=load(filename); h1=plot((tmpfile(:,1)-asn12322(1,1))/60, tmpfile(:,3)); lege
2014-07-31 01:28:44 2398
原创 [matlab]matlab批量导入纯数字文件
将所有文件放入当前文件夹下data文件夹中list=dir('./data');list.nameN=length(list)for i=3:N eval(['load ' 'data\' list(i,1).name]); end
2014-01-10 02:01:35 999
原创 [LeetCode] Remove Duplicate from Sorted Linkded List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1-
2013-10-30 09:31:31 765
原创 [LeetCode] Merge K sorted lists
Solution 1:1. use merge2list(), and merge all lists one by one. Time complexity is O(n*longest list length)2. For each node, find the smallest node among all head nodes in O(k) time, Time complexi
2013-10-27 12:09:01 815
原创 [LeetCode] 2Sum, 3Sum, 4Sum, 3SUm closet
1. 2Sum: hash Table O(n*n)2. 3Sum: 2Sum + 1 : O(n*n)for loop + 左右夹逼法:O(N*N)class Solution {public: vector > threeSum(vector &num) { // Note: The Solution object is instantiated
2013-10-27 09:31:52 1853
原创 [LeetCode] Roman to Integer and Integer to Roman
羅馬數字共有7個,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。按照下述的規則可以表示任意正整數。需要注意的是罗马数字中没有“0”,與進位制無關。一般認為羅馬數字只用來記數,而不作演算。重複數次:一個羅馬數字重複幾次,就表示這個數的幾倍。右加左減:在較大的羅馬數字的右邊記上較小的羅馬數字,表示大數字加小數字。在較大的羅馬數字的左邊
2013-10-27 04:19:22 5740 2
原创 [LeetCode] Regular Expression matching
'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype should be:bool isMatch(c
2013-10-27 00:37:49 1039
原创 string to integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca
2013-10-25 11:18:32 1159
原创 [LeetCode] Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2013-10-24 11:28:07 678
原创 [LeetCode] Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non
2013-10-24 11:03:05 617
原创 [LeetCode] Binary Tree Zigzag level order traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary
2013-10-23 12:13:42 532
原创 [LeetCode] Convert Sorted List to Binary Search Tree
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *//** * Definition for binary tree * stru
2013-10-23 09:38:47 535
原创 [LeetCode] Populating Next RIght Pointer in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr
2013-10-19 04:35:14 603
原创 [LeetCode] Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node.
2013-10-19 00:58:18 697
原创 [LeetCode] Palindrom Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return
2013-10-18 04:35:25 633
原创 [LeetCode] Word Ladder
1. Recursively: time limits exceedclass Solution {public: void ladder(string start, string end, unordered_set dict, int &minPath,int paths) { if(dict.empty()) return; if
2013-10-11 10:33:35 774
原创 [LeetCode] Surrounded Regions
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 in that surrounded region .For example,X X X XX O O
2013-10-09 12:36:33 757
原创 [LeetCode] Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr
2013-10-05 01:08:57 793
原创 [LeetCode] Single Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi
2013-10-04 10:33:20 1967
原创 [LeetCode] Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
2013-10-03 01:28:32 3927
原创 [LeetCode] Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Could you implement it without using extra memory?Solution: 利用异或的可交换性!!!!!!!!!!!!!!clas
2013-10-02 22:28:21 1524
原创 [LeetCode] Recover Binary Search Tree
wo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devise
2013-09-30 11:32:52 573
原创 [LeetCode] CLone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled from 0 to N - 1, where N is the total nod
2013-09-26 12:06:24 2037
原创 [LeetCode]Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).参考:http://fisherlei.blogspot.co
2013-09-25 23:23:18 947
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人