6.1-stack - CMPT 225 Stack CMPT 225 Problem Statement You...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: CMPT 225 Stack CMPT 225 Problem Statement You have been asked to create a software application that simulates the execution of recursive operations by displaying the required activation records (or stack frames) in memory and their content CMPT 225 Step 2 - Design CMPT 225 What if in our implementation, we use ADT List class (position-oriented) to represent/model the CallStack entity of our design? We need to use the public interface of the ADT List Imagine we use the printElement solution #1 (see Recursion lecture notes) to illustrate this example, i.e., 4 recursive calls, we would then obtain the following main method 4 CMPT 225 Using our printElement Solution #1: Main operation Instantiate an object of CallStack class -> myStack Read in input, i.e., recursive operation Initialiase a variable position to 1 -> position at which the next element will be added To simulate each of the 4 invocations and hence execution of the input (recursive method), we: Instantiate an object of ActivationRecord class -> actRec1 to simulate the 1 st invocation of input operation myStack.add( position++ , actRec1) // add to first position Instantiate an object of ActivationRecord class -> actRec2 to simulate the 2...
View Full Document

This note was uploaded on 01/29/2012 for the course CMPT 225 taught by Professor Annelavergne during the Summer '07 term at Simon Fraser.

Page1 / 19

6.1-stack - CMPT 225 Stack CMPT 225 Problem Statement You...

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

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