bisectsearch


Namebisectsearch JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/bisectsearch
SummaryFunctions for performing binary search on sorted lists
upload_time2023-07-03 02:37:04
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords bisect search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Functions for performing binary search on sorted lists

## pip install bisectsearch

#### Tested against Windows 10 / Python 3.10 / Anaconda 

	
```python
from bisectsearch import (
rightmost_value_equal_to,
leftmost_value_equal_to,
rightmost_value_less_than,
rightmost_value_less_than_or_equal,
leftmost_value_greater_than,
leftmost_value_greater_than_or_equal,
)
l = sorted(list(range(0, 5)) * 3)

print(f'{(h:=rightmost_value_equal_to(l, 4)), l[h]=}')
print(f'{(h:=rightmost_value_equal_to(l, 0)),l[h]=}')
print(f'{(h:=rightmost_value_equal_to(l, 1)),l[h]=}')
print(f'{(h:=leftmost_value_equal_to(l, 4)),l[h]=}')
print(f'{(h:=leftmost_value_equal_to(l, 0)),l[h]=}')
print(f'{(h:=leftmost_value_equal_to(l, 1)),l[h]=}')
print(f'{(h:=rightmost_value_less_than(l, 4)),l[h]=}')
print(f'{(h:=rightmost_value_less_than(l, 2)),l[h]=}')
print(f'{(h:=rightmost_value_less_than(l, 1)),l[h]=}')
print(f'{(h:=rightmost_value_less_than_or_equal(l, 40)),l[h]=}')
print(f'{(h:=rightmost_value_less_than_or_equal(l, 0)),l[h]=}')
print(f'{(h:=rightmost_value_less_than_or_equal(l, 1)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than(l, 2)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than(l, 3)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than(l, 0)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than(l, 1)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than_or_equal(l, 3)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than_or_equal(l, 0)),l[h]=}')
print(f'{(h:=leftmost_value_greater_than_or_equal(l, 1)),l[h]=}')

# output

# (h:=rightmost_value_equal_to(l, 4)), l[h]=(14, 4)
# (h:=rightmost_value_equal_to(l, 0)),l[h]=(2, 0)
# (h:=rightmost_value_equal_to(l, 1)),l[h]=(5, 1)
# (h:=leftmost_value_equal_to(l, 4)),l[h]=(12, 4)
# (h:=leftmost_value_equal_to(l, 0)),l[h]=(0, 0)
# (h:=leftmost_value_equal_to(l, 1)),l[h]=(3, 1)
# (h:=rightmost_value_less_than(l, 4)),l[h]=(11, 3)
# (h:=rightmost_value_less_than(l, 2)),l[h]=(5, 1)
# (h:=rightmost_value_less_than(l, 1)),l[h]=(2, 0)
# (h:=rightmost_value_less_than_or_equal(l, 40)),l[h]=(14, 4)
# (h:=rightmost_value_less_than_or_equal(l, 0)),l[h]=(2, 0)
# (h:=rightmost_value_less_than_or_equal(l, 1)),l[h]=(5, 1)
# (h:=leftmost_value_greater_than(l, 2)),l[h]=(9, 3)
# (h:=leftmost_value_greater_than(l, 3)),l[h]=(12, 4)
# (h:=leftmost_value_greater_than(l, 0)),l[h]=(3, 1)
# (h:=leftmost_value_greater_than(l, 1)),l[h]=(6, 2)
# (h:=leftmost_value_greater_than_or_equal(l, 3)),l[h]=(9, 3)
# (h:=leftmost_value_greater_than_or_equal(l, 0)),l[h]=(0, 0)
# (h:=leftmost_value_greater_than_or_equal(l, 1)),l[h]=(3, 1)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/bisectsearch",
    "name": "bisectsearch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "bisect,search",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/10/ef/6f56167d83f9819ae1d1fc43978e4c8616d035b15da805931bcc98cb749a/bisectsearch-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# Functions for performing binary search on sorted lists\r\n\r\n## pip install bisectsearch\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n\t\r\n```python\r\nfrom bisectsearch import (\r\nrightmost_value_equal_to,\r\nleftmost_value_equal_to,\r\nrightmost_value_less_than,\r\nrightmost_value_less_than_or_equal,\r\nleftmost_value_greater_than,\r\nleftmost_value_greater_than_or_equal,\r\n)\r\nl = sorted(list(range(0, 5)) * 3)\r\n\r\nprint(f'{(h:=rightmost_value_equal_to(l, 4)), l[h]=}')\r\nprint(f'{(h:=rightmost_value_equal_to(l, 0)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_equal_to(l, 1)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_equal_to(l, 4)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_equal_to(l, 0)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_equal_to(l, 1)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than(l, 4)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than(l, 2)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than(l, 1)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than_or_equal(l, 40)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than_or_equal(l, 0)),l[h]=}')\r\nprint(f'{(h:=rightmost_value_less_than_or_equal(l, 1)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than(l, 2)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than(l, 3)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than(l, 0)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than(l, 1)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than_or_equal(l, 3)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than_or_equal(l, 0)),l[h]=}')\r\nprint(f'{(h:=leftmost_value_greater_than_or_equal(l, 1)),l[h]=}')\r\n\r\n# output\r\n\r\n# (h:=rightmost_value_equal_to(l, 4)), l[h]=(14, 4)\r\n# (h:=rightmost_value_equal_to(l, 0)),l[h]=(2, 0)\r\n# (h:=rightmost_value_equal_to(l, 1)),l[h]=(5, 1)\r\n# (h:=leftmost_value_equal_to(l, 4)),l[h]=(12, 4)\r\n# (h:=leftmost_value_equal_to(l, 0)),l[h]=(0, 0)\r\n# (h:=leftmost_value_equal_to(l, 1)),l[h]=(3, 1)\r\n# (h:=rightmost_value_less_than(l, 4)),l[h]=(11, 3)\r\n# (h:=rightmost_value_less_than(l, 2)),l[h]=(5, 1)\r\n# (h:=rightmost_value_less_than(l, 1)),l[h]=(2, 0)\r\n# (h:=rightmost_value_less_than_or_equal(l, 40)),l[h]=(14, 4)\r\n# (h:=rightmost_value_less_than_or_equal(l, 0)),l[h]=(2, 0)\r\n# (h:=rightmost_value_less_than_or_equal(l, 1)),l[h]=(5, 1)\r\n# (h:=leftmost_value_greater_than(l, 2)),l[h]=(9, 3)\r\n# (h:=leftmost_value_greater_than(l, 3)),l[h]=(12, 4)\r\n# (h:=leftmost_value_greater_than(l, 0)),l[h]=(3, 1)\r\n# (h:=leftmost_value_greater_than(l, 1)),l[h]=(6, 2)\r\n# (h:=leftmost_value_greater_than_or_equal(l, 3)),l[h]=(9, 3)\r\n# (h:=leftmost_value_greater_than_or_equal(l, 0)),l[h]=(0, 0)\r\n# (h:=leftmost_value_greater_than_or_equal(l, 1)),l[h]=(3, 1)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Functions for performing binary search on sorted lists",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/bisectsearch"
    },
    "split_keywords": [
        "bisect",
        "search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f86059ea9b7aea35ccd4593db415406ed4d6c733c71876086d7caf31ea7cff12",
                "md5": "ad170cf6dfeedf4c92170108c4196193",
                "sha256": "bbcb999f998b0cc747432b9abebf4ab493d138e267ba6fed237cacef4bc38844"
            },
            "downloads": -1,
            "filename": "bisectsearch-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad170cf6dfeedf4c92170108c4196193",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4131,
            "upload_time": "2023-07-03T02:37:02",
            "upload_time_iso_8601": "2023-07-03T02:37:02.598944Z",
            "url": "https://files.pythonhosted.org/packages/f8/60/59ea9b7aea35ccd4593db415406ed4d6c733c71876086d7caf31ea7cff12/bisectsearch-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10ef6f56167d83f9819ae1d1fc43978e4c8616d035b15da805931bcc98cb749a",
                "md5": "2442370a18624dd9b338f702f0b0526b",
                "sha256": "7d8fe758035a1818a27f2c546adc5ae5a0d20fb59af7390a9a38703cd2d2b86b"
            },
            "downloads": -1,
            "filename": "bisectsearch-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "2442370a18624dd9b338f702f0b0526b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3299,
            "upload_time": "2023-07-03T02:37:04",
            "upload_time_iso_8601": "2023-07-03T02:37:04.255805Z",
            "url": "https://files.pythonhosted.org/packages/10/ef/6f56167d83f9819ae1d1fc43978e4c8616d035b15da805931bcc98cb749a/bisectsearch-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-03 02:37:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "bisectsearch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "bisectsearch"
}
        
Elapsed time: 0.08248s