Tree Node Data Structure, Quicksort Algorithm, and BFS Algorithm with Python for Department Store’s Shops, Categories and Products

Project with Data Structures and Algorithms for Python

Tree Node Data Structure, Quicksort Algorithm, and BFS Algorithm with Python for Department Store’s Shops, Categories and Products

1.Idea:

Build a system of stores with their categories and products.

2.Requirements:

  • In this system we must be able to add and delete a product.

  • The user must be able to search for a product by its name, in which store, and in which category is this product.

3.My Girgub Repo: GitHub - scallopy/product_search

4.In script.py I create my own minimal sets of data and show Data Structure of my Project and how algorithms work.

5.What I use in my Project?

  • I use Tree data structures to store data in my project.

  • I use quicksort algorithm to sort products by name after adding a new product.

  • I use Breadth_First Algorithm to serch for a product by name and to save and show path to this product in the Data Structure.

  • I use 1. Breadth-First search algorithm to remove a product in department store by product name.

  • I represent my Tree Node Data Structure like this:

Department Store
├─Hardware Store
...├─Bath
...├─Tools
......├─Hand Tools
.........├─['Asterisks', 'Description', 1222]
.........├─['Mine', 'Description', 23]
.........├─['Nolan', 'Description', 34]
.........├─['Some', 'Something', 121]
.........├─['This', 'Thisthing', 12]
......├─Electrical Tools
...├─Building Materials
...├─Cleaning
...├─Lighting
......├─['Lamp', 'lighting', 24]
├─Souvenirs
├─Services

6.Refactoring:
I removed unused code and add a user input to search for a product.

7.Blog Post in Medium