栈 之前已经写过了顺序栈的表示方式link 今天来实现链式栈: typedef int DataType; typedef struct stack { DataType data; struct stack* next; }ST; 初始化栈 ST* Init() { ST* phead=(ST*)malloc(sizeof(ST)); phead->data=-1; phead->next=NULL; return phead; } 入栈 入栈和出栈,分别对应头插和头删 ST* Create(DataType x) { ST* new=(ST*)malloc(sizeof(ST)); new->data=x; new->next=NULL; return new; } void Push(ST* head,DataType x) { ST* new=Create(x); new->next=head->next; head->next=new; } 出栈 void Pop(ST* head) { if(isEmpty(head)) return; ST*...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile