#include #include #include "lceb.h" unsigned ncombinations(nops, len) int nops, len; { int result = 1; while(len > 0){ if(len & 1) result *= nops; nops *= nops; len >>=1; } return result; } char *combination(ops, len, n) char *ops; /* string to combine */ int len; /* len of result */ int n; /* iteration # */ { static char *res=NULL; static int len_ops; int i; if (!res) { // 1st call len_ops=strlen(ops); res=malloc(len * sizeof(char) + 1); } for(i=0; i