// Interface to the Stack ADT // !!! DO NOT MODIFY THIS FILE !!! #ifndef STACK_H #define STACK_H #include #include typedef struct stack *Stack; /** * Creates a new empty stack * Time complexity: O(1) */ Stack StackNew(void); /** * Frees all memory allocated to the given stack * Time complexity: O(n) */ void StackFree(Stack s); /** * Adds an item to the top of the stack * Time complexity: O(1) */ void StackPush(Stack s, char *it); /** * Removes an item from the top of the stack and returns it * Assumes that the stack is not empty * Time complexity: O(1) */ char *StackPop(Stack s); /** * Gets the item at the top of the stack without removing it * Assumes that the stack is not empty * Time complexity: O(1) */ char *StackTop(Stack s); /** * Gets the size of the given stack * Time complexity: O(1) */ int StackSize(Stack s); /** * Returns true if the stack is empty, and false otherwise * Time complexity: O(1) */ bool StackIsEmpty(Stack s); /** * Prints the stack to stdout with items space-separated * Time complexity: O(n) */ void StackShow(Stack s); #endif