Skip to main content

A collection of basic data structures in Python

Project description

Here’s a sample README.md template for your project, which is a collection of common data structures in Python (such as linked lists, stacks, queues, etc.).


My Data Structures

A Python package that provides implementations of common data structures such as:

  • Singly Linked List
  • Doubly Linked List
  • Stack
  • Queue
  • Binary Tree

This package is designed to be an easy-to-use resource for anyone interested in learning or working with fundamental data structures in Python.


Features

  • Singly Linked List: A linked list where each node points to the next node.
  • Doubly Linked List: A linked list where each node points both to the next node and the previous node.
  • Stack: A LIFO (Last In First Out) data structure where elements are added and removed from the top.
  • Queue: A FIFO (First In First Out) data structure where elements are added at the rear and removed from the front.
  • Binary Tree: A tree structure where each node has at most two children, with left and right pointers.

Installation

You can install the package using pip:

pip install my-data-structures

Usage

Singly Linked List

To use the Singly Linked List:

from my_data_structures.linked_list import LinkedList

# Create a LinkedList
ll = LinkedList()

# Insert elements
ll.insertAtBeginning(10)
ll.insertAtEnd(20)
ll.insertAfter(15, 1)

# Display the linked list
ll.display()

# Sort the list
ll.bubble_sort()
ll.display()

Doubly Linked List

To use the Doubly Linked List:

from my_data_structures.doubly_linked_list import DoublyLinkedList

# Create a DoublyLinkedList
dll = DoublyLinkedList()

# Insert elements
dll.insert_at_beginning(10)
dll.insert_at_end(20)
dll.insert_at(1, 15)

# Display the doubly linked list
dll.display()

Stack

To use the Stack:

from my_data_structures.stack import Stack

# Create a Stack
stack = Stack()

# Push elements
stack.push(10)
stack.push(20)

# Pop elements
stack.pop()

# Display the stack
stack.display()

Queue

To use the Queue:

from my_data_structures.queue import MyQueue

# Create a Queue with a size limit
queue = MyQueue(3)

# Enqueue elements
queue.enqueue(10)
queue.enqueue(20)

# Dequeue elements
queue.dequeue()

# Display the queue
queue.display()

Binary Tree

To use the Binary Tree:

from my_data_structures.binary_tree import BinaryTree

# Create a Binary Tree
bt = BinaryTree()

# Insert elements
bt.insert(10)
bt.insert(20)
bt.insert(5)

# Search for a value
bt.search(15)

# Display the tree in different orders
print(bt.inorder())
print(bt.preorder())
print(bt.postorder())

Contributing

Contributions are welcome! If you'd like to improve the project, feel free to fork the repository, make your changes, and submit a pull request. Here are a few ways you can contribute:

  • Implementing new data structures.
  • Adding tests for existing structures.
  • Improving documentation.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Contact

If you have any questions or suggestions, feel free to open an issue on GitHub or contact me directly:


You can customize the content according to your needs, but this should serve as a solid base for your project's README. It includes essential sections like an introduction, installation instructions, usage examples, contributing guidelines, and contact information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

basic_data_structures-0.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

basic_data_structures-0.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file basic_data_structures-0.0.1.tar.gz.

File metadata

  • Download URL: basic_data_structures-0.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for basic_data_structures-0.0.1.tar.gz
Algorithm Hash digest
SHA256 548a2b905191f7ac143cbff5777eb5065d60bfe3ba28b735a15b7db48191763a
MD5 7fc408aacd431d0e7fa4758d40b52abf
BLAKE2b-256 fbc38057e61ed781c76ab770e0682a47b4fbc4f3f1bd0752902f3cdf9fc35c4e

See more details on using hashes here.

File details

Details for the file basic_data_structures-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for basic_data_structures-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 933eb122853bb427f31a7863b546a2d06ef7ded49c15e5e535956ba17b7cff45
MD5 69954a1e48d850ce744dfde491986479
BLAKE2b-256 810bb3ba4ae971869a68a5581cdc4717a6d57ea311e38bbb84f6718cdd8f6681

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page