Question: Implement Stack using array-based list and linked list. Write a test code for validating the behavior of five functions mentoned below. Your stack should support

Implement Stack using array-based list and linked list. Write a test code for validating the behavior of five functions mentoned below. Your stack should support the following functions: is empty, 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. Other requirements: All data structures involved need to be implemented by yourself. Except for build-in data type, i.e., List in Python. Comment your code. You must write your test code in the main function. Coding style will be evaluated using PEP8 .

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!