The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 131 -- Algorithms and Data Structures I
Lab #10
For labs meeting the Oct. 31-Nov. 2, 2000
From Labs 7 and 8, you have a Stacks_Generic package that uses
an array to implement the stack. For this lab, modify the private section,
and the body, of your stacks package, so that the stack is implemented
as a linked list. Do not use any of the subprograms in Chapter 8 or 9--you
need the experience in writing some list code yourself. Your new private
section will look like
PRIVATE
TYPE ListNode;
TYPE ListPointer IS ACCESS ListNode;
TYPE ListNode IS RECORD
Data: Element;
Next: ListPointer;
END RECORD;
TYPE Stack (Capacity: Positive) IS RECORD
CurrentSize : Natural := 0;
Store : ListPointer;
END RECORD;
END Stacks_Generic;
Recompile this package and run it with the calculator program from Lab
8.