BF算法实现
#include<stdio.h>
int Index_BF(int *a,int *b){
int i,j;
i=j=0;
while(i<10&&j<4){
if(a[i]==b[j]){
i++;
j++;
}else{
i=(i-j)+2;
j=1;
}
}
return i-4;
};
int main(){
int a[10]={1,2,3,4,5,6,7,8,9,10};
int b[4]= {5,6,7,8};
int x= Index_BF(a,b);
printf("%d",x);
return 0;
}