single stack
ciri2 single stack :
- kosong : top = -1
- penuh : top = n-1
- bisa diisi : top < n-1
- ada isinya : top > -1
kondisi awal :
top1 = -1;
algoritma dasar single stack :
- PUSH
top = top + 1; s[top] = x;
- POP
x = s[top]; top = top - 1;
algoritma lengkap single stack :
- PUSH
void PUSH(void){ if(top < n -1 ){ top = top + 1; s[top] = x }else{ printf("stack penuh"); } }
- POP
void PUSH(void){ if (top>-1){ x = s[top]; top = top - 1; }else{ printf("stack kosong"); } }
Related posts:
- double stack ciri2 double stack : stack 1 kosong : top1 =...
- double ended queue ciri2 double ended queue : kosong : L = R...
- circular queue ciri2 circular queue : kosong : counter = 0 penuh...
- linked list hitung jumlah simpul : Q = FIRST; Jum = 1;...
Related posts brought to you by Yet Another Related Posts Plugin.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


