create ancestor matrix of binary tree