spilt a list and become two sublists
void spilt(struct node *source, struct node** front, struct code** back){
int len = count(source);
int i;
struct node* current =source;
if(len<2)
{
*front = source;
*back = null;
}
else
{
int partion=(len-1)/2;
for(int i=0; i<partion; i++)
{
current=current->next;
}
//cut
*front = source;
*back=current->next;
current->next = null;
}
}
a little funtion is very useful in common. if you have more smarter code, please post it.
转载于:https://www.cnblogs.com/chenjiefree/archive/2007/09/18/897673.html