自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 explanation of the summary of linear model

0: residuals distribution1: coefficients2. stdandard variance of coefficients3: using t-test to test the significant of coefficients.  p-value of Hypothesis: coef=0. The p-value is the accept re

2013-07-16 16:06:12 718

原创 多路归并排序

将一个大文件分割为小文件,对小文件进行内存排序,在对排序后的小文件做合并即可。关于合并,可以采用堆来实现,堆中存储每个小文件中的最小值,以此从堆中取出最小值,输入到结果文件,同时从最小值对应文件中取出下一个最小值,保持堆依然存储每个小文件的最小值。如果只需要对文件按键值分组(不关心键之间的顺序),则采用哈希函数,将不同的键值对应的记录划分到不同的文件,对子文件进行排序即可,然和直接合并子文件即

2013-07-16 14:49:58 710

原创 索引优先队列

一次广告投放会话(session)中,服务器会分别打印推送日志(push)、展示日志(show)(如果广告成功展示)和点击日志(click)(如果广告被点击),一次广告会话由唯一id标记,一个广告可能被点击多次,也可能不被点击。由于广告服务器的并发处理,同一id对应的推送日志,展示日志,点击日志可能不会按照原本的顺序出现(原本顺序指先推送后展示最后点击)。设计算法在内存有限的情况下,统计每一次广告

2013-07-16 14:46:08 1891

原创 时间缓存容器TimeCacheMap的实现

Storm中实现了一个容器,它里面的元素存一定时间,超过该时间的元素便可能被删除,以保证容器可以加入更多新容器。实现思想:初始化N个容器,N个容器组成链表,元素的最短存储时间为T,每次将新元素插入到链表头部的容器内,每隔T/(N-1)时间,将链表尾部的容器删除,同时在链表头部插入新容器,每次删除在N个容器中分别执行删除操作。可以每个元素的存储时间为:[T, T + T/(N-1)]在具体实

2013-07-16 14:45:08 2445

原创 design a regress function whose coeficients satisfy certain conditions

Problem:  Given n points (x_1, x_2, ...x_n) as independent variables, where x_i can be a value or a vector,  and the dependent variables (y_1, y_2, ... y_i), design a regression that satifies:  1.

2013-04-16 11:14:48 663

原创 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. Find out the two same numbers.Ideas:  If the range of numbers is small, we

2013-03-27 17:33:40 668

原创 separate odd and even numbers in an array in O(n) time complexity and O(1) space complexity

Problem: as titleSolution: same as partition algorithm in quick sort./**after processing, odd number is in the left part, even number in the right part*/void separate(int a[], int size) { if (s

2013-03-26 16:53:30 649

原创 bitwise trie tree 的参考实现-nedtries简单解析

trie tree 是一种公共前缀树,(和关联规则的一种算法frequent-pattern growth算法的数据结构相同),具体定义见wiki。上面为一棵trie tree,直观上看,如这种数据结构做索引,应该不错,事实也是如此:)。节点值为0/1的trie tree,称为bitwise trie。bitwise trie是一个二叉查找trie tree。下面看nedtri

2013-03-08 16:53:29 2213

原创 Using Interval Estimation to set prior value in Online Learning method

The below method is a common way to compute ctr:                             ctr = (baseClickNumber + clickNumber)/(baseShowNumber + showNumber)If you know history(yesterday or last month) ctr, ho

2013-03-08 11:13:41 409

原创 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 good  feature for closure. However, It's not satisfying in some situation.Let's u

2013-02-18 20:02:40 257

原创 Intuition of P-value

Let's use an example to demonstrate it. We suppose a coin flip is fair(null hypothesis: H: p=0.5).  We begin to experiment, and toss coins 20 times. But we found the coin tuning up heads 14 times. C

2013-02-18 19:30:23 457

原创 svn: check out a new branch , realse or tag and merge to branches.

<br />create a new branch <br />   In SVN, branches, realses and tags are just common directories. Creating a new branch means making a new directory to contain files copied from other direcotries.<br /><br />commands as below:<br />  svn mkdir -m "creatin

2011-04-27 17:19:00 620

原创 find the kth largest element in a list and find the first k largest elements in a list

<br />Problem 1: Given an unordered  list, find the kth largest element in this list.<br /><br />Solution 1<br />  sort this list and you can immediately get the kth largest element.<br />  The time-complexity is O(NlogN).<br /> <br />Solution 2<br />   py

2011-04-14 16:17:00 1323

原创 Qiuck Sort

<br />Quick Sort is a divide and conquer algorithm.<br /> <br />erlang code:<br />%implements the partition method. Just for demonstration. Actually you can use BIF lists:partition(Cmp, List).part([], _, Smaller, Larger) -> {Smaller, Larger};part([H|L]

2011-04-13 15:01:00 483

原创 erlang list

syntax is same to list in python.favourite functions in lists module.nth(N, List).sublist(List1, Len)/sublist(List, start, len).sort(List).usort(fun, List).seq(From, To , [Incr]) is same to range() in python.append(list of lists).append(List1 , List2), sam

2011-04-08 20:04:00 858

原创 show , append enviroment variables

Show all enviroment variablesCommand:env Show local environment variablesCommand:set Append environment variablesThe most common usage is to append directories that contain executable fi

2011-03-24 15:53:00 529

转载 特殊符号的英文读音

<br />原文链接:http://blog.taihainet.com/user1/65486/archives/2010/105267.html<br /><br /><br />特殊符号的英文读音<br />` backquote 反引号 <br />~ tilde <br />! exclam <br />@ at <br /># numbersign,英语国家是hash,美语是pound,音乐里作sharp,如:C# <br />$ dollar <br />% percent <br />^ c

2011-03-21 17:46:00 1126

原创 Use awk to do simple statistics job

<br />Basic use<br /><br />Example:<br />print requred fields<br />awk -F "/t" '$2>30{print $3"/t"$4}' a.txt > b.txt<br /><br />This sentence means the seperator in a.txt is "/t" and print the third and forth fields when the second filed is greater than 30

2011-03-18 19:33:00 366

原创 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 means 's == t ' is not true. String literals are in 'constant pool' and are compiled into .class file. While String Object is dynamically

2011-03-15 15:59:00 320

原创 don't forget to append one ';' after every class definition

<br />gcc compiler complains that 'error:  expected unqualified-id before string constant'<br />The most possible reason is that you forget one ';' after a class definition. Java programmers  never forget the ';' after every class definition. <br />And rem

2011-03-07 15:42:00 466

转载 Pure Virtual Functions and Abstract Classes

<br /><br />Original Link:http://msdn.microsoft.com/en-us/library/aa273534(v=vs.60).aspx<br /><br />C++ Specific —><br />An abstract class contains at least one pure virtual function. Specify a virtual function as pure by placing = 0 at the end of its decl

2011-03-07 13:21:00 319

原创 basis of javascript

Javascript and Java are alike each other, including control statements and String object.All control statements such as  if, for, while, swith in java also emerge in javascript . Code Example: var lines = new Array("hello", "world");for(var i = 0; i ");

2011-02-27 18:03:00 361

原创 refresh iframe

code :hello iframe reload

2011-02-24 18:25:00 803

原创 inline-block

<br />place many blocks in one line.<br /> <br />code:<br />#left{ margin-left:20px; position: relative; top:20px; display: inline-block;}#right{ display:inline-block; vertical-align: top; /*set block alignment */ position:relati

2011-02-24 17:51:00 347

原创 Notes:java comile flag

<br /><br /><br />article original address:http://www.ibm.com/developerworks/java/library/j-5things11/index.html<br /><br /><br /><br /><br />DisableExplicitGC flag<br />Explicit garbage collection is a really bad idea -- sometimes on the order of locking

2011-02-18 16:15:00 426

原创 notes on ibm:dw"5 things you didn't know about ... Command-line flags for the JVM"

article original address:http://www.ibm.com/developerworks/java/library/j-5things11/index.htmlDisableExplicitGC flagExplicit garbage collection is a really bad idea -- sometimes on the order of locking youreself in a phone booth with a rabid pit bull.Syste

2011-01-17 11:18:00 444

原创 C++ styles

<br />1. An entity (function, class, etc) only has one compact responsibility.<br />    design small class, and seperate incompact functions.<br /> <br />2. Use 'const' as more as possible.<br />    for example:<br />         class Paras{ static co

2010-12-13 18:31:00 345

原创 css: basics and text

three types of selector1. directly apply to html element.    p{ text-align: center; color: red; font-family: times new roman; font-size: 25pt; font-style: bold; } 2. unique selector that occurs at most o

2010-12-13 16:26:00 408

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除