# Dev Notes 01

These days I am trying my best effort to adapt to the new environment. A lot of things need to learn, a lot of people need to know.

During this period, I read a number of articles. Some of them are really good ones and worth to record here.

## git

Most of my spare time is spending on reading git related articles, which is well worth. After a lot of reading, finally, I got agreed with the point of view that we should “Commit Often, Perfect Later, Publish Once”.

Git is amazing for its free branching, so we’d better make use of this. After learning from the article below, we could become a guru in git branch technology.

At last, there is a very cool site, where we could find some really good tutorials and articles about git.

## linux performance

There are many very useful tools in linux. I have a chance to use several of them during the work, like: strace, ltrace, pdb, etc.

Above is a detailed “Linux Performance Observability Tools” diagram, from here:

## unit test

Before joining this team, I seldom wrote unit tests. So there are lots of things I need to catch up. There are two articles about BDD test:

## timing and profiling

When I tried to analyze my python code, these tools (lprun, mprun, timeit, etc) in IPython help a lot.

That’s all.

# Morris二叉树遍历算法

## 总结

Morris算法虽然在时间复杂度上有着系数级别的差异，但却带来了空间复杂度量级上的降低。总体看来，在某些空间苛刻的场景中，该算法非常实用。

# 帕尔哈提

“我没有什么梦想，就是很认真地做自己的事情。”

“99年我有个朋友问我，如果有机会去国外演出，你去哪儿？当时我跟他说德国。结果我十年以后就去德国演出了。我一直在弹、一直在唱，是梦想自己找我，不是我去找这个梦想。”

# 散列的探测次数

1.分离链接法：将所有散列到同一个值的元素保留到一个链表中，理论上可以插入任意多的元素。

2.开放定址法：冲突发生时，尝试选择另外的单元，直到找到为止。（大侠和的一手好稀泥！）

$$I(\lambda) = \frac{1}{\lambda} \int_0^\lambda \frac{1}{1-x} \mathrm{d}x = \frac{1}{\lambda} ln \frac{1}{1-\lambda}$$

S为成功查找；U为不成功查找；而I为插入

# 暴君

《暴君》的创意是我见过的电视剧中最棒的一部,这部剧让我兴奋。 — 李安

# 二分查找

Donald Knutha computer scientist

## 逸闻趣事

Donald Knuth在叙述查找算法的历史时指出，尽管第一篇有关二分查找（折半查找）算法的文章在1946年就发布了，可16年后才有人发表了（这是一个很好的限定）能正确查找各种规模的列表算法。

When I wrote TeX originally in 1977 and ’78, of course I didn’t have literate programming but I did have structured programming. I wrote it in a big notebook in longhand, in pencil.

Six months later, after I had gone through the whole project, I started typing into the computer. And did the debugging in March of ’78 while I had started writing the program in October of ’77. The code for that is in the Stanford archives—it’s all in pencil—and of course I would come back and change a subroutine as I learned what it should be.

1.中值的计算方式

2.选择区间是否对称

3.重复元素的处理

# Network Attacks

Facebook being massive DDOS attack by China showed on Norse Attack Timeline

This is the video on youtube.