- 博客(39)
- 收藏
- 关注
原创 java pieces,
What is the difference between == vs equals() in Java?, Always remember to override hashCode if you override equals so as not to “break the contract”.equals will only compare what it is written to comp
2016-05-17 22:32:40 623
原创 python in learning math
limit behavior of transition probability of a given markov chain>>> import numpy as np>>> np.set_printoptions(precision=4)>>> g = lambda trans_mat, cnt=20: reduce(lambda x1, x2: print(x1) or x1@x2, (
2016-05-10 19:42:48 319
原创 pydata
numpyx = np.arange(9.).reshape(3, 3)np.where(x>5)x[x>5] # often simple boolean indexing suffices, np.where is not neededpandaspath = 'ch02/usagov_bitly_data2012-03-16-1331923249.txt'records = [json
2016-05-03 21:43:38 501
原创 x pieces
Is integer multiplication really same speed as addition on modern CPU Why is division so much more complex than other arithmetic operations?
2016-04-25 17:29:08 253
原创 latex pieces
math equation multiline alignment minimize f0(x)=x21+x22f_0(x) = x_{1}^2 + x_2^2 subject to f1(x)=x1/(1+x22)f_1(x) = x_1/(1+x_2^2) h1(x)=(x1+x2)2h_1(x) = (x_1 + x_2)^2
2016-04-23 10:00:44 286
原创 math pieces
Jensens’s inequality f(EX) <= Ef(x) f(y+t(x-y)) <= f(y) + t*(f(x)-f(y))
2016-04-22 15:56:26 292
原创 R pieces
set.seed(seed, kind = NULL, normal.kind = NULL), the recommended way to specify seeds.
2016-04-22 11:54:22 276
原创 python pieces
create partial sum of sequence using generator. ref: def partial_sums(iterable): total = 0 for i in iterable: total += i yield total
2016-04-21 23:08:48 912
原创 notes reading word smart for the GRE 2nd Edition
notes reading word smart for the GRE 2nd Edition
2015-10-22 21:25:47 446
原创 abbreviations in english reading, writing, saying
abbreviations in english
2015-09-25 18:58:19 573
原创 my understanding of (lower bound,upper bound) binary search, in C++, thanks to two post
If you understand the comments below, never will you make mistakes with binary search!
2015-08-01 14:35:30 874
原创 learn python, ref, diveintopython
Decide in your heart of hearts what really excites and challenges you, and start moving your life in that direction. Don't let life randomly kick you into the adult you don't want to become.
2015-07-22 14:42:57 569
原创 one recursive approach for 3, hdu 1016 (with an improved version) , permutations, N-Queens puzzle
one recursive approach to solve hdu 1016 , list all permutations, solve N-Queens puzzle. reference: the video of stanford cs106b lecture 10 by Julie Zelenski https://www.youtube.com/watch?v=NdF1QDTRkck
2015-07-19 16:49:37 669
原创 hdu 1503, LCS variants, find a LCS, not just the length, backtrack to find LCS, no extra markup
a typical variant of LCS algo. the key point here is, the dp[][] array contains enough message to determine the LCS, not only the length, but all of LCS candidates, we can backtrack to find all of LCS.
2015-07-18 16:24:57 754
原创 hdu, KMP algorithm, linear string search algorithm, a nice reference provided
Rabin-Karp and Knuth-Morris-Pratt Algorithms
2015-07-18 13:40:00 110
原创 hdu 1232, disjoint set, linked list vs. rooted tree, a minor but substantial optimization for path c
disjoint set, linked list version with weighted-union heuristic, rooted tree version with rank by union and path compression, and a minor but substantial optimization for path compression version FindSet.
2015-07-16 17:13:52 630
原创 hdu 1082, stack emulation, and how to remove redundancy
hdu 1082, stack emulation, and how to remove redundancy
2015-07-16 02:24:46 508
原创 hdu 1231, dp ,maximum consecutive sum of integers, find the boundaries, possibly all negative, C++
hdu 1231, maximum consecutive sum of integers, finding the boundaries, possibly all negative, C++
2015-07-12 03:24:17 682
原创 hdu 1159, LCS, dynamic programming, recursive backtrack vs iterative backtrack vs incremental, C++
hdu 1159, LCS, dynamic programming, recursive backtrack vs iterative backtrack vs incremental, C++
2015-07-10 04:14:59 840
原创 leetcode N-Queens/N-Queens II, backtracking, hdu 2553 count N-Queens, dfs
leetcode N-Queens/N-Queens II, backtracking, hdu 2553 count N-Queens, dfs
2015-07-09 02:07:25 819
原创 hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.)
use sentinel to avoid boudary testing, use swap trick to avoid extra copy.
2015-06-19 11:58:07 471
原创 hdu 1053 (huffman coding, greedy algorithm, std::partition, std::priority_queue )
huffman coding, greedy algorithm.
2015-06-18 19:11:46 705
原创 hdu 1051 (greedy algorithm, how a little modification turn 15ms to 0ms)
(greedy algorithm, how a little modification turn 15ms to 0ms)
2015-06-18 12:54:04 462
原创 hdu 1050 (preinitilization or postcleansing, std::fill)
(preinitilization or postcleansing, std::fill)
2015-06-18 11:33:36 456
原创 hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos)
design of func
2015-06-18 08:21:08 518
原创 hdu 1041 (OO approach, private constructor to prevent instantiation, sprintf)
(OO approach, private constructor to prevent instantiation)
2015-06-17 15:57:17 390
原创 hdu 1039 (string process, fgets, scanf, neat utilization of switch clause)
(string process, fgets, scanf, neat utilization of switch clause)
2015-06-16 22:15:55 419
原创 hdu 1036 (I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol)
(I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol)
2015-06-16 19:37:40 551
原创 hdu 1034 (preprocess optimization, property of division to avoid if, decreasing order process)
(preprocess optimization, use floor property of division to avoid if)
2015-06-16 13:32:00 473
原创 hdu 1035 (usage of sentinel, proper utilization of switch and goto to make code neat)
make your selection based on what you need to accomplish, not on performance considerations.
2015-06-16 12:33:50 461
原创 hdu 1033 (bit masking, utilization of switch, '\0' as end of c string)
bit masking, utilization of switch, '\0' as end of c string
2015-06-15 21:47:47 398
原创 hdu 1031 (partial sort problem, nth_element, stable_partition, lambda expression)
partial sort, nth_element, stable_partition, lambda expression
2015-06-15 17:47:54 493
原创 hdu 1030 Delta-wave (C++, 0ms, explanatory comments.)
(C++, 0ms, explanatory comments.)plus a nice solution from acmerblog
2015-06-15 12:21:59 679
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人