Design of diverse and focused combinatorial libraries using an alternating algorithm