Search Insert Position

Description https://oj.leetcode.com/problems/climbing-stairs/ Difficulty: 0.5/5 star Analysis It is the simplest DP problem. The only trick here is that we can solve it with constant space. class Solution { public: int climbStairs(int n) { int numDistinctWays[3] = {1, 1, 2}; for...

Binary Tree Traversal

Description Traverse a binary tree in pre/in/post-order, with/out extra space. Difficulty: recursive solution: 0.5/5.0 star pre/post-order without recursion with stack: 1.5/5.0 star in-order without recursion with stack: 2.0/5.0 star in-order without any extra space: 3.0/5.0 Definition of TreeNode struct TreeNode...

Numpy Basics

Array Creation (1) Initialize an array from a list numpy.array(list) (2) Initialize a array all zeros: numpy.zeros( (n, m) ) all ones: numpy.ones( (n, m) ) “wild” random numbers (depends on memory):numpy.empty( (n, m) ) random numbers([0,1]):numpy.random.random((2,3)) identity matrix: eye(n)...

Tobit Regression

Tutorial http://www.stat.columbia.edu/~madigan/G6101/notes/logisticTobit.pdf http://cran.r-project.org/web/packages/censReg/vignettes/censReg.pdf http://cran.r-project.org/web/packages/censReg/censReg.pdf

Introduction to Survival Analysis (Ch4)

This summarizes some very basic concepts in survival analysis from this amazing tutorial, which helps me a lot. Chapter 4: Estimiating the Survival or Hazard Function (Non-Parametric) If there is no censoring data, the empirical estimate of survival distribution is...