Program For Optimal Merge Pattern Time