CDoT: Optimizing MAP Queries on Trees