binary index tree cses database dfs dynamic dynamic programming graph index mailbox math paper python resource silly tdhbct