add generate all combinations algorithm