# Optimal Partition Search
[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)
[![Python 3.6](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-395/)
## Overview and Functionality
- Official Implementation of the paper - ["***Optimal Partition Search***"](https://www.researchgate.net/publication/336638736_Optimal_Partition_Search)
- Searches for the optimal number of partitions required to speed up the search process
- Works for arrays having any data type (int, float, char, long, etc.)
- Independent of the order of the elements in the array, i.e. can work for both sorted and unsorted array settings
## Usage
- Make sure you have ***Python version 3.9 or greater*** installed on your system
- Run the following command on the terminal to install this package:
```
pip install Optimal-Partition-Search
```
## Example
```
# test.py
from Optimal_Partition_Search import optimal_partition_search
import random
import numpy as np
# Example for array having integer values
array = random.sample(range(150), 100)
print(f'array: {array}')
element = int(input("Enter the item you want to search\n"))
optimal_partition = optimal_partition_search(array, element)
print("Optimal no. of partitions", optimal_partition)
# Example for array having float values
array = np.random.uniform(low=600.5, high=705.2, size=(10,))
print(f'array: {array}')
element = float(np.random.choice(array, 1))
optimal_partition = optimal_partition_search(array, element)
print("Optimal no. of partitions", optimal_partition)
# Example for array having character and string values
array = ['a', 'c', 'q', 'l', 'h', 's', 'tr', 'input']
print(f'array: {array}')
element = input("Enter the item you want to search\n")
optimal_partition = optimal_partition_search(array, element)
print("Optimal no. of partitions", optimal_partition)
```
Use the following command to run the examples given in the `test.py` file above:
```
python test.py
```
Raw data
{
"_id": null,
"home_page": "https://github.com/fork123aniket/Optimal-Partition-Search",
"name": "Optimal-Partition-Search",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "optimal search,array search,optimal partition search,searching algorithms",
"author": "Aniket Saxena",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# Optimal Partition Search \n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/) \n[![Python 3.6](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-395/)\n\n## Overview and Functionality\n\n- Official Implementation of the paper - [\"***Optimal Partition Search***\"](https://www.researchgate.net/publication/336638736_Optimal_Partition_Search)\n- Searches for the optimal number of partitions required to speed up the search process\n- Works for arrays having any data type (int, float, char, long, etc.)\n- Independent of the order of the elements in the array, i.e. can work for both sorted and unsorted array settings\n\n## Usage\n\n- Make sure you have ***Python version 3.9 or greater*** installed on your system\n- Run the following command on the terminal to install this package:\n ```\n pip install Optimal-Partition-Search\n ```\n\n## Example\n\n ```\n# test.py\n\nfrom Optimal_Partition_Search import optimal_partition_search\nimport random\nimport numpy as np\n\n# Example for array having integer values\narray = random.sample(range(150), 100)\nprint(f'array: {array}')\nelement = int(input(\"Enter the item you want to search\\n\"))\noptimal_partition = optimal_partition_search(array, element)\nprint(\"Optimal no. of partitions\", optimal_partition)\n\n# Example for array having float values\narray = np.random.uniform(low=600.5, high=705.2, size=(10,))\nprint(f'array: {array}')\nelement = float(np.random.choice(array, 1))\noptimal_partition = optimal_partition_search(array, element)\nprint(\"Optimal no. of partitions\", optimal_partition)\n\n# Example for array having character and string values\narray = ['a', 'c', 'q', 'l', 'h', 's', 'tr', 'input']\nprint(f'array: {array}')\nelement = input(\"Enter the item you want to search\\n\")\noptimal_partition = optimal_partition_search(array, element)\nprint(\"Optimal no. of partitions\", optimal_partition)\n ```\n\nUse the following command to run the examples given in the `test.py` file above: \n ```\n python test.py\n ```\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A function used to find the number of partitions required to speed up the array searching process",
"version": "0.0.1",
"split_keywords": [
"optimal search",
"array search",
"optimal partition search",
"searching algorithms"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "40b35a7cdcd2a7324917f389deda0259",
"sha256": "35bbe380ba8c1ee3efe53345858598a69d35d380879977e4501467a557e163f3"
},
"downloads": -1,
"filename": "Optimal_Partition_Search-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "40b35a7cdcd2a7324917f389deda0259",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3730,
"upload_time": "2022-12-02T18:24:09",
"upload_time_iso_8601": "2022-12-02T18:24:09.522460Z",
"url": "https://files.pythonhosted.org/packages/81/5d/c39b995a414f3610b515a5857df518f95f6a3400c318db15492ce8200767/Optimal_Partition_Search-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-02 18:24:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "fork123aniket",
"github_project": "Optimal-Partition-Search",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "optimal-partition-search"
}