PPT-Subroutines and Stacks Stack

Author : kittie-lecroy | Published Date : 2018-11-10

The stack is a special area in memory used by the CPU to store register information or general data information during program execution The stack has a top

Presentation Embed Code

Download Presentation

Download Presentation The PPT/PDF document "Subroutines and Stacks Stack" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Subroutines and Stacks Stack: Transcript


The stack is a special area in memory used by the CPU to store register information or general data information during program execution The stack has a top and a bottom The SP register is the special register that controls the address . 1 Objectives A subroutine is a reusable program module A main program can call or jump to t he subroutine one or more times The stack is used in several ways whe n subroutines are called In this lab you will learn How to write subroutines and call th reasons for subroutines. repeat . same code, or similar code with slightly different parameters. hide . design decisions or design complexity. partition . off code likely to change. provide . for separate compilation. The Stack. Data structure deals with the study of how data is organized in memory and how efficiently data can be retrieved and manipulated.. Data structures allows programmers to write efficient programs. data is efficiently retrieved ,manipulated and organized in memory.. A LINKED LIST IMPLEMENTATION OF A QUEUE. data. next. data. next. NULL. data. next. cnt. front. rear. queue. node. node. node. Queue: First-In-First-Out (FIFO) data structure. The header file: queue.h. Buflab. 15/18-213: Introduction to Computer Systems. Recitation 5. February . 9, . 2015. Mukund Tibrewala. News!. Bomb Lab is due tomorrow (Tuesday) at 11.59pm!. If you haven’t started yet, good luck . Subroutines . and Stacks. 1. Subroutines. Separate, independent module of program, performs a specific task. shortens code, provide reusable “tools”. High-level languages typically have libraries of subroutines.. Lecture 7: Subroutines and stack framesParameter passing though the stackAn exampleLocal variables and the stack frameand ULNK instructionsParameter passing through stack framesAn exampleThe need for 1. Stacks. Stack: what is it?. ADT. Applications. Implementation(s). 2. 3. Stacks and queues. A . stack. is a very important data structure in computing science.. A stack is a sequence of elements to which new elements are added (. Characteristics of Data Structures. Disadvantages . Advantages. . Data Structure . Slow search,. slow deletion, fixed size.. Quick insertion, very search,. Fast access if index known.. Array. Slow insertion and deletion, fixed size. . Call . suba. Call . suba. Call . suba. Next instruction. Next instruction. Next instruction. Start of subroutine. Subroutine . suba. Jump back. Only one copy of the code is placed in memory. Whenever we wish to use the code, a jump is made to it . IN KOLAR SINCE 2014. Almitra. H Patel. Member, Supreme Court Committee . for Solid Waste Management . in Class 1 Cities . almitrapatel@rediffmail.com . www.almitrapatel.com. 1. 1. KOLAR CMC . www.kolarcity.gov.in. Sorting can be custom according to the type of nodes. Offers speedups over non-sorted list. Inserting into a sorted linked list. Similar to before, but we will remove the need to “append” nodes to our list. push. pop. LIFO . list - only top element is visible. t. op. Defining the ADT . "Stack". Data. :. a linear collection of data items in which all operations occur at one end, called the . top. Basic Operations. Hiba. . Sayed. . Data Structures and Algorithms. Stack. :a data structure which is used to store data of the same type.. . . Stack . : . also an ordered collection of elements like arrays. , but it has a special feature that deletion and insertion of elements can be done only from one end called the top of the stack “TOP.

Download Document

Here is the link to download the presentation.
"Subroutines and Stacks Stack"The content belongs to its owner. You may download and print it for personal use, without modification, and keep all copyright notices. By downloading, you agree to these terms.

Related Documents