Recursive algorithm drawing tree