The problem is that when the Apriori algorithm is implemented, the association rules of each frequent set are required, and the true subset of each frequent set needs to be obtained in the most frequent concentration. Then in the implementation of this step is the card master, the first reaction is to complete with recursion, but in the face of data mining large project set, recursion is obviously very inefficient, and estimated to run, so the iterative method is obviously more reliable.
On-line non-recursive method useful binary addition simulation implementation, in particular, such as ABCD, with 0000 plus 1-"0001 here 1 is mapped to the corresponding position of the string, for example, 0101 is BD, then we will continue to add 1 to him, then we can simulate the process." This method is obviously good, but it has to be calculated 2^n-1 times. Oneself later arranged the next, for 1234 such form, can have 112,13,14,123,124,1234223,242343344 namely uses a variable to circulate 1234 on the element, How to use a variable to control the length of each display, for example, if the length is 2, then all the possibilities, such as 12,13,14, are shown with this element. The thought is relatively simple, the realization is also relatively simple. Attach C code
#include # includevoidPrintint*a,intStartintcount) { while(count>=0) {printf ("%d", A[start]); Start++; Count--; } }intMain () {intm[4]={1,2,3,4}; intLength=sizeof(m)/sizeof(int);//Request Length inti,j,k; for(i=0; I printf ("%d\n", M[i]); for(j=1; J for(k=j+i;k Print (m,i,j-1); printf ("%d\n", M[k]); }}} System ("Pause"); return 1;}
C language implementation to find the problem of string subset