You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB

#include "LinearList/SeqList.c"
#include "LinearList/LinkList.c"
#include "Stack/SeqStack.c"
int main() {
SeqStack seqStack;
initStack(&seqStack);
push(&seqStack, 'a');
push(&seqStack, 'b');
//取栈顶元素
printf("Top = %c\n", getTop(&seqStack));
printStack(&seqStack); //Stack contents: ba
pop(&seqStack);
printStack(&seqStack); //Stack contents: b
pop(&seqStack);
printStack(&seqStack); //Stack contents:
pop(&seqStack); //stack underflow
// SeqList s;
// initList(&s);
// insertList(&s, 1, 100);
// insertList(&s, 2, 200);
// insertList(&s, 3, 300);
// printf("%d\n",deleteList(&s,2));
// printf("%d", s.length);
// readList(&s);
// printf("%d",getElem(&s,1));
// printf("%d",locateElem(&s,400));
// ListNode *l;
// l = initLink();
// display(l);
//
// ListNode *k;
// k = init();
// display(k);
// ListNode *m;
// m = createList();
// display(m);
// ListNode *o;
// o = insertLinkList(m,3,100);
// display(o);
}