原创 don't forget to append one ';' after every class definition
gcc compiler complains that 'error: expected unqualified-id before string constant' The most possible reason is that y
原创 Weak variable scope control in Python
Variable scope in Python is very similar to that in C. Functions can access any variable in its upper scope. It's a goo
原创 find the two same numbers in 1 million random numbers
Problem: There are two same numbers and other unique numbers in a set which contains 1 million random numbers totally
原创 時間緩存容器TimeCacheMap的實現
Storm中實現了一個容器,它裏面的元素存一定時間,超過該時間的元素便可能被刪除,以保證容器可以加入更多新容器。 實現思想:初始化N個容器,N個容器組成鏈表,元素的最短存儲時間爲T,每次將新元素插入到鏈表頭部的容器內,每隔T/(N-1)時
原创 特殊符號的英文讀音
原文鏈接:http://blog.taihainet.com/user1/65486/archives/2010/105267.html 特殊符號的英文讀音 ` backquote 反引號 ~ tilde ! exclam @ at
原创 separate odd and even numbers in an array in O(n) time complexity and O(1) space complexity
Problem: as title Solution: same as partition algorithm in quick sort. /**after processing, odd number is in the left p
原创 svn: check out a new branch , realse or tag and merge to branches.
create a new branch In SVN, branches, realses and tags are just common directories. Creating a new branch means mak
原创 bitwise trie tree 的參考實現-nedtries簡單解析
trie tree 是一種公共前綴樹,(和關聯規則的一種算法frequent-pattern growth算法的數據結構相同),具體定義見wiki。 上面爲一棵trie tree,直觀上看,如這種數據結構做索引,應該不錯,事實也是如此:
原创 erlang list
list syntax is same to list in python. favourite functions in lists module. nth(N, List). sublist(List1, Len)/sublist
原创 find the kth largest element in a list and find the first k largest elements in a list
Problem 1: Given an unordered list, find the kth largest element in this list. Solution 1 sort this list and you ca
原创 索引優先隊列
一次廣告投放會話(session)中,服務器會分別打印推送日誌(push)、展示日誌(show)(如果廣告成功展示)和點擊日誌(click)(如果廣告被點擊),一次廣告會話由唯一id標記,一個廣告可能被點擊多次,也可能不被點擊。由於廣告服
原创 String object and String literal are different
String s = new String("hello"); String t = "hello"; In above code, s is a String object and t is a String literal, that
原创 Qiuck Sort
Quick Sort is a divide and conquer algorithm. erlang code: %implements the partition method. Just for demonstration.