We use DFS to rebuild the whole tree by the inorder push pop sequence with simplified code implementation (pop could be ignored) and the use post order the traverse the whole tre
Read More
We give the algorithm to solve the programming ability test problem of perfect sequence with sorting and linear scan techniques. Binary search could also be used but it is slower and more tricky to implement.
Read More

I described Reservoir Sampling algorithm to tackle the problem to generate K (K <= N) items out of N total items uniformly at random while only storing at most K of them. The analysis and proof of the probability is also given and a special case is pointed out which needs to be carefully taken care of.
Read More
This is a quick recap on different elementary sorting including Bubble Sort, Selection Sort, Insertion Sort, Shell Sort, the main point here is to review them and explain why are we interested in each of them.
Read More
I give two solutions for the programming ability test problem 1084. Broken Keyboard. One is native and simple this takes O(M * N) time while the other one involving hash takes linear time in O(M + N)
Read More