New algorithms DP and sorting