Hierarchical bases for elliptic problems