[Algorithm] Level Order Binary Tree Traversal (Iterative and Recursive)

Traverse a binary tree in level order is intuitive. We can initialize a queue and add elements. Every cycle you need to print out the nodes in the queue, and add their children to queue, until queue is empty. However, since the recursive solution for pre-order, in-order, and post-order traverse is quite easy, I wonder … Read more [Algorithm] Level Order Binary Tree Traversal (Iterative and Recursive)

[LeetCode] Longest Valid Parentheses

Got stuck in this problem for one hour. I was trying to use a variable left to count the left parentheses. However, we should not only count the number of them, but also the position of them. Then we need to use stack. There is a very elegant solution here (In Java): http://rleetcode.blogspot.com/2014/01/longest-valid-parentheses.html This problem really cost … Read more [LeetCode] Longest Valid Parentheses

Android Development: Use WiFi as USB cable to test apps

Nowadays, we often use USB to connect to our device to test our programs. But how about wireless test? It may be more convenient. The default debug mode in Android is USB debug. We can do some small changes so that we can debug wirelessly. Let’s do it step by step.  Your should root your … Read more Android Development: Use WiFi as USB cable to test apps

Java Problem: java.lang.NoSuchMethodError

I was doing a project to implement TCP over UDP. I used makefile to compile these java files easily. After editing and compiling several times, the Server became unavailable in terminal. It shows just like below.

However, it works well in Eclipse. I tried it in ubuntu and it also works. I have no … Read more Java Problem: java.lang.NoSuchMethodError

Hello world!

When I want to learn a programming language, most tutorials and books often let me start with “Hello world” programs.

So I start this blog with “Hello world”, which is also a new start of graduate student life.