Question: Implement Stack using array-based list and linked list. Your stack should sup- port the following functions: isEmpty, this function checks whether the current Stack instance
Implement Stack using array-based list and linked list. Your stack should sup- port the following functions: isEmpty, this function checks whether the current Stack instance is empty. It should return true if the Stack is empty. push, this function should takes a data item as input and add it into the Stack. pop, this function should return the data item on the top of the current Stack and remove it from the Stack. top, this function should return the data item on the top of the current Stack without modifying the Stack. size, this function should return the number of data items in the Stack. Write a test code for validating the behavior of five functions. Comment your test code. You can write your test code in the main, i.e., after if name.. -- __main_.": Hints: you need to write a Linked List class first in order to implement Stack. You can create two python files. One for the implementation of Stack using build-in list in Python. The rest for the implementation of Stack using an in- ner class linkedlist. ref: https://www.datacamp.com/community/tutorials/ inner-classes-python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
