-
-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Added algorithm for searching in a rotated sorted array #13240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
+932
−124
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.9 → v0.12.10](astral-sh/ruff-pre-commit@v0.12.9...v0.12.10) - [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](pre-commit/mirrors-mypy@v1.15.0...v1.17.1) * Update word_break.py * Update word_break.py * Update word_break.py * Update word_break.py * Update word_break.py * Update covid_stats_via_xpath.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update pyproject.toml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update pyproject.toml * Update pyproject.toml * Update covid_stats_via_xpath.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
* Add new solution for the euler project problem 9 - precompute the squares. * Update sol4.py * updating DIRECTORY.md * Update sol4.py * Update sol4.py * Update sol4.py --------- Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]>
* Create cyclic_sort.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update cyclic_sort.py * updating DIRECTORY.md * Update cyclic_sort.py * Update cyclic_sort.py * Update cyclic_sort.py * Update cyclic_sort.py * Update cyclic_sort.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]>
…ation (TheAlgorithms#9295) * enhance knapsack problem * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * wei/refactor code * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update test_knapsack.py * Update knapsack.py * Update test_knapsack.py * Update knapsack.py * Update knapsack.py * Update knapsack.py * Update knapsack.py * Update knapsack.py * Update test_knapsack.py --------- Co-authored-by: weijiang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
* added coordinate_compression algorithm * added coordinate_compression & doctest * adding return type hints and utilized enumerate * adding exmaple usage in main function * added type hints, for list and dict * updating DIRECTORY.md * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update other/coordinate_compression.py Co-authored-by: Christian Clauss <[email protected]> * Update coordinate_compression.py * Create coordinate_compression.py * updating DIRECTORY.md * Delete other/coordinate_compression.py * updating DIRECTORY.md * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py * Update coordinate_compression.py --------- Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]> Co-authored-by: Christian Clauss <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Update README.md * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update blockchain/README.md Co-authored-by: Tianyi Zheng <[email protected]> * Update README.md --------- Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: Tianyi Zheng <[email protected]>
* algorithm to find unique prime factors * Update prime_factors.py * Update prime_factors.py * Update prime_factors.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* fixed_incorrect_test_combination_sum * reverting fn arg * ruff * Update combination_sum.py * Update combination_sum.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* Generate parantheses iterative * Generate parantheses iterative * Generating parantheses code using iterative approach * Update generate_parentheses_iterative.py * updating DIRECTORY.md * Update generate_parentheses_iterative.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update generate_parentheses_iterative.py * Update generate_parentheses_iterative.py * Update generate_parentheses_iterative.py --------- Co-authored-by: nightmare10123 <[email protected]> Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fixes bug in PriorityQueue Algorithm; Fixes syntax in code for array. * Update dijkstra_algorithm.py * Update dijkstra_algorithm.py * Update dijkstra_algorithm.py * Update dijkstra_algorithm.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* Add weierstrass_method for approximating complex roots - Implements Durand-Kerner (Weierstrass) method for polynomial root finding - Accepts user-defined polynomial function and degree - Uses random perturbation of complex roots of unity for initial guesses - Handles validation, overflow clipping, and includes doctest * Update weierstrass_method.py * add more tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update weierstrass_method.py * Update weierstrass_method.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Adding doctests in simpson_rule.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update stock_span_problem.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update subset_generation.py * Update subset_generation.py * Update data_structures/stacks/stock_span_problem.py Co-authored-by: Christian Clauss <[email protected]> * Update stock_span_problem.py * Update data_structures/stacks/stock_span_problem.py Co-authored-by: Christian Clauss <[email protected]> * Update stock_span_problem.py * Update stock_span_problem.py * updating DIRECTORY.md * Update stock_span_problem.py * Update stock_span_problem.py * Update stock_span_problem.py * Update stock_span_problem.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <[email protected]> Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]>
…rithms#11553) * Seperate slow_solution and solution * Add performance benchmark * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix issues * Update sol1.py * Update sol1.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
…gorithms#11605) * Add new test for bucket sort algorithm in sorts/bucket_sort.py * Update fractional_knapsack.py * Update matrix_class.py * Update bucket_sort.py * Update bucket_sort.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* Added space complexity Space complexity of merge sort is a key factor, when compared to quick sort * Update merge_sort.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* test: Add unit tests * test: Add successful tests in binaree_tree_path_sum * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update binary_tree_path_sum.py * Update binary_tree_path_sum.py * Update binary_tree_path_sum.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
* Update README.md Add emojis for enhanced visual appeal and readability in README . * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md * Update README.md * Update README.md --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
…2372) * Adding a 3D plot to the k-means clustering algorithm * Update k_means_clust.py * Update k_means_clust.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* Create stalin_sort.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update stalin_sort.py * updating DIRECTORY.md * Update stalin_sort.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]> Co-authored-by: MaximSmolskiy <[email protected]>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.10 → v0.12.11](astral-sh/ruff-pre-commit@v0.12.10...v0.12.11) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…thms#12946) * Fix: is_palindrome_recursive logic for 2-char strings * Update palindrome.py * Update palindrome.py * Update palindrome.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Adding the function isProthNumber(n : int) which returns true if n is a Proth number * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixing the issues of the isprothnumber function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * New fixes on isprothnumber() * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes on isprothnumber() * Fixes on isprothnumber * Fixes on isprothnumber() * Fixes on isprothnumber * Update proth_number.py * Update proth_number.py * Update proth_number.py * Update proth_number.py * Update proth_number.py * Update proth_number.py * Update proth_number.py * Update proth_number.py --------- Co-authored-by: Juanitoupipou <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <[email protected]>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.11 → v0.12.12](astral-sh/ruff-pre-commit@v0.12.11...v0.12.12) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit autoupdate 2025-09-11 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates: - [github.com/pre-commit/mirrors-mypy: v1.17.1 → v1.18.1](pre-commit/mirrors-mypy@v1.17.1...v1.18.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix covid_stats_via_xpath.py Improve error handling. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix covid_stats_via_xpath.py typo * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix ruff * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * upgrade covid_stats_via_xpath.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update and fix covid_stats_via_xpath.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.0 → v0.13.1](astral-sh/ruff-pre-commit@v0.13.0...v0.13.1) - [github.com/pre-commit/mirrors-mypy: v1.18.1 → v1.18.2](pre-commit/mirrors-mypy@v1.18.1...v1.18.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added edit_distance test cases * Update edit_distance.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
…heAlgorithms#12991) * Add doctests for cross function. Contributes to TheAlgorithms#9943 * Update sudoku_solver.py --------- Co-authored-by: Maxim Smolskiy <[email protected]>
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.1 → v0.13.2](astral-sh/ruff-pre-commit@v0.13.1...v0.13.2) * ci: autoupdate_schedule: monthly --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <[email protected]>
Please rebase.
|
Can you tell me how can I rebase and which branch I should have raised pull request? It will be very helpful. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Searching in a rotated sorted array: