add bin search and permutation