stack data structure
Project description
Data Structure :- Stack
This python module can use the different functions of Stack Data Structure
like:
1.isempty()
2.push(,<item_needed_to_be_added_to_the_stack>)
3.pop()
4.peek()
5.display()
To Install:
pip install ds_stack
Useage:
(1) .isempty function returns True or false , Must input a list and store return value in a variable in main code
(2) .push function returns the stack,top , Must input a list,an value to push in the stack and store return value in a variable in main code
(3) pop function prints the error(or) returns the stack,the removed item, The top .Must input a list and store return value in a variable in main code
(4) .peek function returns the error(or)top's value . Must input a list and store return value in a variable in main code
(5) .display function returns the error(or)stack in order . Must input a list and direct exection in main code
Examples:
(1) .isempty():
import ds_stack as stack
a=[2,3,4,5,6] #stack
x=stack.isempty(a)
print(x)
#O/P
#True
(2) .push(,<item_needed_to_be_added_to_the_stack>):
import ds_stack as stack
a=[2,3,4,5,6]
a,t=stack.push(a,9)
print(a)
print(t)
#O/P
#SUCCESS
#[2,3,4,5,6,9]
#5
(3) .pop():
import ds_stack as stack
a=[2,3,4,5,6] #stack
a,t,i =stack.pop(a)
print(a)
print(t)
print(i)
#O/P
#[2,3,4,5]
#3
#6
(4) .peek():
import ds_stack as stack
a=[2,3,4,5,6] #stack
t=stack.peek(a)
print(t)
#O/P
#6
(5) .display():
import ds_stack as stack
a=[2,3,4,5,6] #stack
stack.display(a)
#O/P
#6 <---top
#5
#4
#3
#2
=========================================================================
😊😊😊 HAPPY CODING😊😊😊
=========================================================================
Kindly point out any error or a feature that needs to be added
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.