MGMT 1050 Lecture Notes - Lecture 16: Subroutine

47 views2 pages
MGMT 1050 Tutorial 16 Notes Stack Instructions
Introduction
Any good introductory textbook will also serve as a further reference.
In addition, there are several good books that describe I/O devices.
White [WHIT05] provides straight-forward explanations of many I/O devices.
Mueller [MUEL08] contains comprehensive treatments of memory, disk storage, optical
disks, video hardware, and more.
One of the most important data storage structures in programming is the stack.
A stack is used to store data when the most recently used data will also be the first
needed.
For that reason, stacks are also known as LIFO, for last-in, first-out, structures.
As an analogy, stacks are frequently described by the way plates are stored and used in
a cafeteria.
New plates are added to the top of the stack, or pushed, and plates already on the stack
move down to make room for them.
Plates are removed from the top of the stack, or popped.
So that the last plates placed on the stack are the first removed.
Similarly, the last number entered onto a computer memory stack will be the first
number available when the stack is next accessed.
Any data that must be retrieved in reverse order from the way it was entered is a
candidate for the use of stacks.
The process of adding to and removing numbers from the stack.
Stacks are an efficient way of storing intermediate data values during complex
calculations.
In fact, storage in Hewlett-Packard calculators is organized around a stack of memory.
As we already noted, stacks are also an excellent method for storing the return
addresses and arguments from subroutine calls.
Progra routies that are recursive ust call theselves.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents