










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.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。