introC_lec11

introC_lec11 - Computer Programming for Engineering...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
10/5/2010 1 Computer Programming for Engineering Applications ECE 175 Intro to Programming 10/5/2010 1 ECE 175, Fal 2010 Stack: An allocation of memory to store data (usually temporary data) Data are inserted, and deleted in a special way Stacks follow the Last in First out (LiFo) principle Why would we want to restrict the way data is accessed? Very simple implementation No need for addresses for every element in the memory, just handle the top most element Intuitive for many computer operations The Stack Data Structure 10/5/2010 ECE 175, Fal 2010 2 Examples from Real Life 10/5/2010 ECE 175, Fal 2010 3 Your midterm exams Use of stacks in software The undo button Example from Computer Software 10/5/2010 ECE 175, Fal 2010 4 Undo button picture The undo button Use of stacks in software Make list PowerPoint title Push Operation: Pushes the element on the stack Pop: Pops the topmost element of the stack The Push and Pop Operations 10/5/2010 ECE 175, Fal 2010 5 Img Source: Wikipedia Using an Array to Represent a stack 10/5/2010 ECE 175, Fal 2010 6 5 7 8 -6 top (index) element
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

introC_lec11 - Computer Programming for Engineering...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online