Question: In Java 4:40 PM (b) Given the following specification of the ADT Stack, implement this data structure using linked representation. You should write the class

In Java  In Java 4:40 PM (b) Given the following specification of the

4:40 PM (b) Given the following specification of the ADT Stack, implement this data structure using linked representation. You should write the class LinkedStack that imple- ments the interface Stack Specification of ADT Stack push(Type e): requires: Stack S is not ful. input: Type e. results: Element e is added to the stack as its most recently added elements. output: none pop(Type e: requires: Stack S is not empty. inpu results: the most recently arrived element in S is removed and its value assigned to e. output Type e .empty(boolean flag): requires: none. input: none. results: If Stack S is empty then flag is true, otherwise false. output: flag full(boolean flag): requires: none. Input: none. results. If S is full then Full is true, otherwise Ful is false. output: flag New methods multiPush(Type els0, int k, int ): requires None. nput: Type els, int k results: The first k elements of the array els are pushed to the stack one at a time until the stack is full or all k elements are added. The output 1 is set to the number of elements that have been pushed. output: l multiPop(Type els], int k, int : requires: None. input: Type els0, int k results: The top k elements of the stack are popped and stored in els starting at position 0 unti the stack is empty or all k elements are popped. The output l is set to the number of elements that have been popped. output: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!