发现一个youtube 视频 https://www.youtube.com/watch?v=ZWez6hOpirY
认真观看后,觉得很有收获。这里记录一下笔记。
Just another WordPress.com site
发现一个youtube 视频 https://www.youtube.com/watch?v=ZWez6hOpirY
认真观看后,觉得很有收获。这里记录一下笔记。
We comparing counting sort, bucket sort and radix sort, i realized it’s all about trade off between memory, time, and simplicity of data structure.
Radix sort: n log_r(k). Essentially radix sort performs bucket sort log_r(K) times. It can deal with larger key range (than bucket sort). r is the base here. the larger is r the better time complexity we got. but it also means more memory. remember the bucket array in radix sort is of length r (shorten than n or maximum value of K) If we use n as the base, it becomes a normal bucket sort. why? cuz now we have only one ‘digit’, so we only do one bucket sort/counting sort.
Bucket sort: is a generalization of counting sort. The number of bucket sort used is n. and range can be larger than n. thus we saved some space than in counting sort. but it loses the worse case of O(n+K). the data has to be uniformly distributed.
Counting sort: O(n+k) time and O(K) space
為天地立心,為生民立命,為往聖繼絕學,為萬世開太平。”(《宋元學案·橫渠學案上》)。
Do more of what you can uniquely do, and less of what other people can do”… Gloria Steinem.
12.23号寄出申请
12.26 USCIS 收到
3.20号左右:Request for more evidence。 要求signature,之前我的签字要么是用了蓝色笔,要么是签字太大,超出范围了。
4.1号把RFE packet寄回, 顺便把跳槽后renewed的H1b/H4 notice 加进去了。
4.5 USCIS 收到
4.10 更新: Card in production
4.19更新: Card mailed out
来美6年半了,读书3年,工作3年半。
从去年开始到现在,所有的积蓄在股市亏光了,玩短期option进入了赌博模式,前后大概亏了12万美金。去年亏了7万,当时想收手了,说要把钱交给老婆管,复习了几个月刷题跳槽成功,今年年初老婆在复习考NY Bar,没空管理家里财务,我又鬼使神差的重新进去想回本,结果一把我又亏了5万。银行里现在一共也只有1万不到。
自己平时生活节约,结果到头来全部输给了股市。
赌徒的日子,太痛。哭了好几天,于事无补。生活还得继续。
对不起自己刚结婚的老婆,对不起父母,工作几年,没给家里寄过几次钱。
恍惚了很多天了。28岁的我,现在清零,从头开始。
You can either get the marriage license on the same day or beforehand. you should at least get the marriage license 30 minutes before the ceremony.
you can get the marriage license in other city hall within California.
Santa Clara City Hall: https://www.sccgov.org/sites/rec/Marriage%20Licenses/Pages/Applying-for-a-Marriage-License.aspx
This is a great post I found on stackoverflow.
http://stackoverflow.com/questions/327311/how-are-pythons-built-in-dictionaries-implemented
Here is everything about Python dicts that I was able to put together (probably more than anyone would like to know; but the answer is comprehensive).
dict
uses open addressing to resolve hash collisions (explained below) (see dictobject.c:296-297).O(1)
lookup by index).0, 1, ..., i, ...
on the left are indices of the slots in the hash table (they are just for illustrative purposes and are not stored along with the table obviously!).
# Logical model of Python Hash table
-+-----------------+
0| <hash|key|value>|
-+-----------------+
1| ... |
-+-----------------+
.| ... |
-+-----------------+
i| ... |
-+-----------------+
.| ... |
-+-----------------+
n| ... |
-+-----------------+
i
, that is based on the hash of the key. CPython initially uses i = hash(key) & mask
(where mask = PyDictMINSIZE - 1
, but that’s not really important). Just note that the initial slot, i, that is checked depends on the hash of the key.<hash|key|value>
). But what if that slot is occupied!? Most likely because another entry has the same hash (hash collision!)==
comparison not the is
comparison) of the entry in the slot against the key of the current entry to be inserted (dictobject.c:337,344-345). If both match, then it thinks the entry already exists, gives up and moves on to the next entry to be inserted. If either hash or the key don’t match, it starts probing.i+1, i+2, ...
and use the first available one (that’s linear probing). But for reasons explained beautifully in the comments (see dictobject.c:33-126), CPython uses random probing. In random probing, the next slot is picked in a pseudo random order. The entry is added to the first empty slot. For this discussion, the actual algorithm used to pick the next slot is not really important (see dictobject.c:33-126 for the algorithm for probing). What is important is that the slots are probed until first empty slot is found.dict
will be resized if it is two-thirds full. This avoids slowing down lookups. (see dictobject.h:64-65)NOTE: I did the research on Python Dict implementation in response to my own question about how multiple entries in a dict can have same hash values. I posted a slightly edited version of the response here because all the research is very relevant for this question as well.
From this graph below we can get an idea how over-valued spy is getting.
Also, you can read this article: http://stockcharts.com/articles/decisionpoint/2016/07/sp-500-2016-q1-earnings-results-market-overvaluation-grows.html
I’m betting Brexit will happen and I have money on spy put right now. I wish I didn’t bet as I realize it is not a wise thing to bet on such a event. My original plan was to enter the position last Friday and then retreat with profits before the brexit result is announced but I was trapped since last Friday. I already sold some of my position with loss yesterday but still keep a large portion. The Market Maker definitely knows what I’m thinking about. The market has been rallying since last Friday and seems so sure Brexit will fail.
Let’s see. Right now the results showing leaving is not that unlikely.
Beyond my investment, I personally believe British should exit from EU for their own benefit, not for some great aspiration of other countries. I couldn’t see any benefit for the country and its people to stay in EU, except for big international companies and its allies who need its voice in EU. I don’t believe British will become less important in world politics if it leaves EU. Quite on the contrary, I believe British will become much more important as now it stands an independent country and gets to sign trade deals with other countries independently, with other commonwealth countries, United States, China, Japan, etc.
I also don’t believe EU will punish British by shutting down its markets. someone would say British will lose the whole market while EU gets to distribute the loss between its members. but I think Germany will be most heavily impacted and it will do something for its own benefit.
Update: : Brexit Won! Congrats!