Sunday, October 18, 2009

4.0 Stack Algorithms: 4.1 Create Stack

For each stack operation, we give its name, a brief description, and its calling sequence. We then develop algorithms for each one. The operations needed in a program depend on the application.

Create stack initializes the metadata for the stack structure. The pseudocode for create stack is shown in Algorithm 1.

algorithm createStack (ref stack )

Initializes metadata for a stack.

Pre stack is structure for metadata

Post metadata initialized to an empty state

1 stack.top = null;

2 stack.count = 0;

3 return

end createStack

No comments:

Post a Comment