Coder Social home page Coder Social logo

fork123aniket / optimal-partition-search Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 11 KB

Official Implementation of Optimal Partition Search Algorithm

License: MIT License

Python 100.00%
array array-methods data-structures data-structures-and-algorithms data-structures-python python search search-algorithm search-algorithms searching

optimal-partition-search's Introduction

Optimal Partition Search

Python 3.6

Overview and Functionality

  • Official Implementation of the paper - "Optimal Partition Search" (IEEE Xplore) (ResearchGate)
  • 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
  • More details on how to install this package and other relevant information can be found here

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

optimal-partition-search's People

Contributors

fork123aniket avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.