# This is very simple implementaion of Data Structure like Stack and Singly Linked List
* In Stack you can use many methods.
```python
1) push(val) #provide any valu as argument to push into stack
2) pop() #It will pop or delete the top element of stack
3) peek() #It will give you the top element
4) isEmpty() #It will tell you whether the stack is empty or not
5) printStack() #It will print the stack in form of list
```
<h3><b>Note:- if you initialize the stack size to 5 and you push only 3 element or less then 5 element then rest of the stack will print as 0 because initially all the value in stack is 0.</b></h3>
---
## In linked list I implement singly, doubly, singlyCircular.
* In Singly Linked List you can use so many methods, here is the list:-
```python
1) len()
2) is_empty() #Make sure you use this method inside the print function
3) traverse() #To print the linked list
4) insertAtHead(val) #Provide any value as argument
5) insertAtTail(val) #Provide any value as argument
6) insertAtPos(val, pos) #First provide the value and then position
7) deleteHead() #It will delete the head node
8) deleteTail() #It will delete the tail node
9) deleteAtPosition(pos) #Provide the position of node you want to delete
10) insertAfter(val, newVal) #First provide the value after which you want to add a new value. E.g:- after 5 you want to add 6 then insertAfter(5, 6)
11) insertBefore(val, newVal) #First provide the value before which you want to add a new value. E.g:- before 5 you want to add 6 then insertBefore(5, 6)
12) mergeTwoLL(l1, l2) #Give two arguments. The first argument is the first linked list and second argument is second linked list
13) get_tail() #It will print the tail node
14) get_head() #It will print the head node
```
# Here is the exmaple
<h2><b>Stack</b></h2>
```python
from DScollection import *
#OR
# from DScollection import Stack
# from DScollection import SinglyLL
s1 = Stack(5) #here 5 is the size of stack
s1.push(1)
s1.push(2)
s1.push(3)
s1.push(4)
s1.push(5)
#you can also use loop to push to avoid this number of lines
s1.pop()
s1.peek()
s1.isEmpty()
s1.printStack()
```
<h2><b>Singly Linked List</b></h2>
```python
from DScollection import *
#OR
# from DScollection import Stack
# from DScollection import SinglyLL
l1 = SinglyLL()
l2 = SinglyLL()
l1.insertAtTail(1)
l1.insertAtTail(2)
l1.insertAtTail(3)
l1.traverse()
l2.insertAtTail(4)
l2.insertAtTail(5)
l2.insertAtTail(6)
l2.traverse()
merged_list = SinglyLL()
merged_list.mergeTwoLL(l1, l2)
merged_list.traverse()
len(merged_list)
```
# I will update this with all the data structure with ready to use, stay updated.
Change Log
==========
0.0.7 (23/09/2024)
------------------
-Seventh Release
-All bugs are fixed.
Raw data
{
"_id": null,
"home_page": null,
"name": "DScollection",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "data structures stack linked list",
"author": "Kishan Chauhan",
"author_email": "kishanchauhan2006.25@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ac/2e/c49a04f25fa99f2f0d2d9174db4277976d5b4af35c16951944576326592e/DScollection-0.0.7.tar.gz",
"platform": null,
"description": "# This is very simple implementaion of Data Structure like Stack and Singly Linked List\n\n* In Stack you can use many methods.\n\n ```python\n 1) push(val) #provide any valu as argument to push into stack\n 2) pop() #It will pop or delete the top element of stack\n 3) peek() #It will give you the top element\n 4) isEmpty() #It will tell you whether the stack is empty or not\n 5) printStack() #It will print the stack in form of list\n ```\n<h3><b>Note:- if you initialize the stack size to 5 and you push only 3 element or less then 5 element then rest of the stack will print as 0 because initially all the value in stack is 0.</b></h3>\n---\n\n## In linked list I implement singly, doubly, singlyCircular.\n\n* In Singly Linked List you can use so many methods, here is the list:-\n\n \n ```python\n 1) len()\n 2) is_empty() #Make sure you use this method inside the print function\n 3) traverse() #To print the linked list\n 4) insertAtHead(val) #Provide any value as argument\n 5) insertAtTail(val) #Provide any value as argument\n 6) insertAtPos(val, pos) #First provide the value and then position\n 7) deleteHead() #It will delete the head node\n 8) deleteTail() #It will delete the tail node\n 9) deleteAtPosition(pos) #Provide the position of node you want to delete\n 10) insertAfter(val, newVal) #First provide the value after which you want to add a new value. E.g:- after 5 you want to add 6 then insertAfter(5, 6)\n 11) insertBefore(val, newVal) #First provide the value before which you want to add a new value. E.g:- before 5 you want to add 6 then insertBefore(5, 6)\n 12) mergeTwoLL(l1, l2) #Give two arguments. The first argument is the first linked list and second argument is second linked list\n 13) get_tail() #It will print the tail node\n 14) get_head() #It will print the head node\n ```\n\n# Here is the exmaple \n\n<h2><b>Stack</b></h2>\n \n```python\n from DScollection import *\n\n #OR\n # from DScollection import Stack\n # from DScollection import SinglyLL\n\n s1 = Stack(5) #here 5 is the size of stack\n s1.push(1)\n s1.push(2)\n s1.push(3)\n s1.push(4)\n s1.push(5)\n #you can also use loop to push to avoid this number of lines\n s1.pop()\n s1.peek()\n s1.isEmpty()\n s1.printStack()\n```\n<h2><b>Singly Linked List</b></h2>\n \n```python\n from DScollection import *\n\n #OR\n # from DScollection import Stack\n # from DScollection import SinglyLL\n\n l1 = SinglyLL()\n l2 = SinglyLL()\n\n l1.insertAtTail(1)\n l1.insertAtTail(2)\n l1.insertAtTail(3)\n l1.traverse()\n\n l2.insertAtTail(4)\n l2.insertAtTail(5)\n l2.insertAtTail(6)\n l2.traverse()\n\n merged_list = SinglyLL()\n merged_list.mergeTwoLL(l1, l2)\n\n merged_list.traverse()\n len(merged_list)\n```\n\n# I will update this with all the data structure with ready to use, stay updated.\n\nChange Log\n==========\n\n0.0.7 (23/09/2024)\n------------------\n-Seventh Release\n-All bugs are fixed.\n",
"bugtrack_url": null,
"license": null,
"summary": "A basic implementation of some data structures",
"version": "0.0.7",
"project_urls": null,
"split_keywords": [
"data",
"structures",
"stack",
"linked",
"list"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d25909a1b30e56bdade68e1e04292971b5f5d1e390916f55865ef97491a7bdbe",
"md5": "d156679f9a75ccd05ebd2673f9f12b7d",
"sha256": "5ceaadb291dc8d61fffcfddc2782e47f9d59bbcf8a081f55d1b759aa41580b2b"
},
"downloads": -1,
"filename": "DScollection-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d156679f9a75ccd05ebd2673f9f12b7d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6606,
"upload_time": "2024-09-23T03:55:22",
"upload_time_iso_8601": "2024-09-23T03:55:22.021369Z",
"url": "https://files.pythonhosted.org/packages/d2/59/09a1b30e56bdade68e1e04292971b5f5d1e390916f55865ef97491a7bdbe/DScollection-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac2ec49a04f25fa99f2f0d2d9174db4277976d5b4af35c16951944576326592e",
"md5": "fb2e0dc4c79306774edcf7fcb0f30616",
"sha256": "cdd151e7305cb65e5b6df1cccc3e7cb87cf2e2f3f8cc2ac4cc4857d255029a16"
},
"downloads": -1,
"filename": "DScollection-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "fb2e0dc4c79306774edcf7fcb0f30616",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5259,
"upload_time": "2024-09-23T03:55:23",
"upload_time_iso_8601": "2024-09-23T03:55:23.793814Z",
"url": "https://files.pythonhosted.org/packages/ac/2e/c49a04f25fa99f2f0d2d9174db4277976d5b4af35c16951944576326592e/DScollection-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-23 03:55:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dscollection"
}