improve the algo, algo generate a normal ordered table, which does not required extra sorting