C language implementation to find the problem of string subset

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.