单链表递归举例.ppt

单链表递归举例

a1 a2 a3 a4 a5 L(1) L L(2) Status Creat_LinkList (LinkList L){ //建立单链表 int ch; scanf(%d,ch); if(ch==-1){ L=NULL; return OK;} else{ L=(LinkList) malloc(sizeof(LNode)); if(!L) return ERROR; L-data=ch; return Creat_LinkList (L-next); } } 1 Status Creat_LinkList (LinkList L){ //建立单链表 int ch; scanf(%d,ch); if(ch==-1){ L=NULL; return OK;} else{ L=(LinkList) malloc(sizeof(LNode)); if(!L) return ERROR; L-data=ch; return Creat_LinkList (L-next); } } 12, 25, 32, -1 L(1)=? L(1)=? 1 Status Creat_LinkList (LinkList L){ //建立单链表 int ch; scanf(%d,ch

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档