顺序表
#include
#include
void prt_sq_LList(); int flag_sq_LList();
void ins_sq_LList(int,T); void del_sq_LList(int); };
template
sq_LList(T)::sq_LList(int m) {mm=m;
v=new T[mm]; nn=0; return; }
template
void sq_LList
cout<<\
for (i=0;i 单链表 template void linked_LList if(head==null) {head=p;p->next=null;return;} if(head->d==x) {p->next=head;head=p;return;} q=head; while((q->next!=NULL)&&(((q->next)->d)!=x)) q=q->next; p->next=q->next;q->next=p; return; } linked_Llist.h #include node*next: }; template node template linked_LList void linked_LList if(p==NULL){cout<<\空链表!\do{cout< }while(p!=NULL); return; } #include node*next: }; //定义线性链表类 template node //建立空链表 template linked_LList void linked_LList if(p==NULL){cout<<\空链表!\do{cout< }while(p!=NULL); return; } template void linked_LList if(head==null) {head=p;p->next=null;return;} if(head->d==x) {p->next=head;head=p;return;} q=head; while((q->next!=NULL)&&(((q->next)->d)!=x)) q=q->next; p->next=q->next;q->next=p; return; } 查找 #include v=new T[mm]; nn=0; return; } template if(v[k-1]==x)return(k-1); if(v[k-1]>x)j=k-1; else i=k+1; } return(-1); } template if(nn==mm) {cout<<\上溢!\k=nn-1; while(v[k]>x) {v[k+1]=v[k];k=k-1;} v[k+1]=x; nn=nn+1; return(1); } template k=search_SL_List(x) if(k>=0) {for(i=k;i template