【最新编排】编程题 建立一个单链表,实现链表元素的定位,查找,插入,删除。(数据结构编程问题).docVIP

  • 3
  • 0
  • 约5.62千字
  • 约 10页
  • 2018-03-14 发布于湖北
  • 举报

【最新编排】编程题 建立一个单链表,实现链表元素的定位,查找,插入,删除。(数据结构编程问题).doc

【最新编排】编程题 建立一个单链表,实现链表元素的定位,查找,插入,删除。(数据结构编程问题)

#include iostream using namespace std; typedef struct node { char data; struct node *next; }link; link * get(link *l, int i) { link *p;int j=0; p=l; while((ji) (p-next!=NULL)) {p=p-next;j++;} if(j==i) return p; else return NULL; } link * ins (link *l, char ch,int i) { link *p,*s; p=get(l,i-£±); if(p==NULL) coutè?“?…¥??‰èˉˉendl; else { s=(link *)malloc(sizeof(link)); s-data=ch; s-next=p-next; p-next=s; } return l; } link * find(link *l, char ch) { link *p; int i=0; int j=0; p=l; while(p!=NULL) { i++; if(p-data!=ch) p=p-next; else {cout??¨??¥?‰??????°??

文档评论(0)

1亿VIP精品文档

相关文档