您的位置:首页 > 其它

已知一单链表中的数据元素含有三类字符:字母、数字和其他字符。是编写算法,构造三个循环链表,使每个循环链表中只含同一类字符

2016-10-18 11:00 786 查看
结构体:
struct NodeInt{
int num;
struct NodeInt * next;
};

struct NodeChar{
char character;
struct NodeChar * next;
};

struct NodeDouble{
double dou;
struct NodeDouble * next;
};

template <class T,class N>
N * create(T * array,int n)
{
N *p , *head , *q;
head = (N*)malloc(sizeof(N));
p = head;
int i = 1;
if( 0 != n )
{
while( i <= n )
{
q = (H*)malloc(sizeof(H));
q->a = array[i - 1];
p->next = q;
p = q;
i++;
}
q->next = head->next;
}
free(head);
return q->next;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐