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.
Source Distribution
File details
Details for the file ds_stack-0.0.1.tar.gz.
File metadata
- Download URL: ds_stack-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
facae73ca2cca044605c01339d1965a6bdf677256d3faf1b74cb958d732da44e
|
|
| MD5 |
2c70906190a4e22b3fa13a22434f8463
|
|
| BLAKE2b-256 |
fca42688815eaf70d4889f0ea6e1d3717dae3578992555794957b27b090de8d1
|