add k-th-num algorithm