Implementing various functions of a stack using the singly linked list class in Python
Stack is one of the most prominent and important data structure. It is a linear data structure which follows a particular order while performing any function on the stack. It either follows First in Last out(FILO) or Last in First out(LIFO). In this project, we have implemented the stack data structure with the help of linked list. The following are the functions that are defined and can be performed on a stack.
This function is used to initialise the data members.
This function is used to push data into the stack. It takes one integer input from the user and then the function will push this value into the stack and return nothing.
This function pops the element of the stack from the top of the stack and returns the element being popped or deleted. In case if the stack is empty, it returns -1.
This function gives the value or element that is being kept at the top of the stack. In case if the stack is empty, it returns -1.
This function gives the size of the stack at any given instance of time.
This function gives a boolean value indicating whether the stack is empty or not.
Submitted by Patnam Venkata Koushik (Koushik)
Download packets of source code on Coders Packet