Ch3-1-Stack

# Ch3-1-Stack - DataStructureStack SangYongHan...

This preview shows pages 1–8. Sign up to view the full content.

Data Structure - Stack                 Sang Yong Han            http://ec.cse.cau.ac.kr/ Chung-Ang University Spring 2011 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Stacks Stack: what is it? ADT Applications Implementation(s) Tower of Hanoi Maze (Maze Routing) Mathematical Expression
What is a stack? Stores a set of elements in a particular order Stack principle:  LAST  IN  FIRST  OUT LIFO It means: the last element inserted is the first one to  be removed Example Which is the first element to pick up?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Last In First Out B A D C B A C B A D C B A E D C B A top top top top top A
Stack  Applications Real life Pile of books Plate trays More applications related to computer science Program execution stack (read more from your text) Evaluating expressions

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Method Invocation And Return public   void  a() { …; b(); …} public   void  b() { …; c(); …} public   void  c() { …; d(); …} public   void  d() { …; e(); …} public   void  e() { …; c(); …} return address in a() return address in b() return address in c() return address in d() return address in e() return address in c() return address in d()
objects:  a finite ordered list with zero or more elements.    methods:     for all  stack     Stack ,  item     element max_stack_size         positive integer     Stack  createS( max_stack_size ) ::=                create an empty stack whose maximum size is                  max_stack_size     Boolean  isFull( stack, max_stack_size ) ::=                 if  (number of elements in  stack == max_stack_size )                return  TRUE

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 33

Ch3-1-Stack - DataStructureStack SangYongHan...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online