Assignment 9, Subprograms and ADT
Due November 11th, 12 noon
(To be done with your group)
- Page 423, # 1
- The static and dynamic links for an activation record may or may not point
to the same activation record.
- Give an example where the static and dynamic links point to the same
activation record. Explain your example.
- Give an example when the static and dynamic links point to different
activation records. Explain your example.
- Write an integer linked list abstract data type in either C++ or Java.
Your linked list implementation needs to support only these two operations:
addFirst which adds an integer (the argument to addFirst) to the
head of he head of the linked list; and removeFirst which removes the
head of the linked list and returns the removed integer. Pay attention
to what parts of your implementation are public and what parts are private.
Discuss why your implementation is an abstract data type.
- Write a routine in C++ that takes an array, the length of the array, and
an element and returns the position of the element in the array. For
example, given the array with values [2,4,6,8] and element 6, the routine
should return 2 (since counting from 0, 6 occurs at position 2 in the array).
Your routine should use templates to enable your routine to be reusable for
different element types.