Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2014年2月4日

摘要: Not hard to know it is simply transform from in-order to post-order.My first idea is to build a tree from in-order string and then traverse the tree by post-order - naive so slow.Subtle stack manipulation solves it - stack only for operators:http://cs.nyu.edu/courses/Fall12/CSCI-GA.1133-002/notes/In 阅读全文
posted @ 2014-02-04 14:59 Tonix 阅读(185) 评论(0) 推荐(0)

摘要: Counting trailing 0s of n! It is not very hard to figure out how to count it - simply count how many 5s. Since even numbers are always more than 5s, we don't have to consider even numbers.But counting 5, is tricky. Naive method is quite slow - I got 12+s for 1000000000. And after reading below a 阅读全文
posted @ 2014-02-04 12:54 Tonix 阅读(164) 评论(0) 推荐(0)