Metadata-Version: 2.1
Name: Optimal-Partition-Search
Version: 0.0.1
Summary: A function used to find the number of partitions required to speed up the array searching process
Home-page: https://github.com/fork123aniket/Optimal-Partition-Search
Author: Aniket Saxena
License: UNKNOWN
Keywords: optimal search,array search,optimal partition search,searching algorithms
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# 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
 ```

