Python
Python copied to clipboard
floor_or_ceil_using_binary_search.py
Given an sorted array 'arr' of n integers and an integer x. Find the floor and ceiling of x in arr[0..n-1].
Describe your change:
- [Y ] Add an algorithm?
- [N] Fix a bug or typo in an existing algorithm?
- [N ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
- [N ] Documentation change?
Checklist:
- [Y ] I have read CONTRIBUTING.md.
- [ Y] This pull request is all my own work -- I have not plagiarized.
- [Y ] I know that pull requests will not be merged if they fail the automated tests.
- [Y ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
- [Y ] All new Python files are placed inside an existing directory.
- [Y ] All filenames are in all lowercase characters with no spaces or dashes.
- [ Y] All functions and variable names follow Python naming conventions.
- [ Y] All function parameters and return values are annotated with Python type hints.
- [Y ] All functions have doctests that pass the automated testing.
- [N ] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
- [N ] If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".