# CH3 --- ## **Stack** :::info **Array** ```C++ #include<stdio.h> int maxsize=8; int stack[8]; int top=-1; int isempty(){ if (top==-1) return 1; else return 0; } int isfull(){ if (top==maxsize) return 1; else return 0; } int pop(int n){ if(!isEmpty()){ data=stack[top]; top=top-1; return data; } else{ printf('Stack為空') } } int push(int data){ if (!isFull()){ top=top+1; stack[top]=data; } else{ printf('Stack已滿') } } ``` **Link List** ```clike= Stuct Node{ int Data; Node Next; } Stuct Stack{ } bool isEmpty(){ Node *top; } ``` ::: --- ## **Queue** :::info **Array** ``` ``` **Link List** ``` ``` :::
{"metaMigratedAt":"2023-06-17T07:41:58.510Z","metaMigratedFrom":"Content","title":"CH3","breaks":true,"contributors":"[{\"id\":\"fa1ba941-2327-418e-85d9-8a8ec9ac6602\",\"add\":963,\"del\":181}]"}
Expand menu