Adding code for sequential tree.. However there is a bug in the code.