Skip to content

Add exponential_search doctest for empty array edge case - #13954

Open
vivekkumarrathour wants to merge 2 commits into
TheAlgorithms:masterfrom
vivekkumarrathour:vivekkumarrathour-patch-3
Open

Add exponential_search doctest for empty array edge case#13954
vivekkumarrathour wants to merge 2 commits into
TheAlgorithms:masterfrom
vivekkumarrathour:vivekkumarrathour-patch-3

Conversation

@vivekkumarrathour

Copy link
Copy Markdown

This doctest demonstrates that exponential_search correctly handles empty arrays by returning -1.

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or other similar explanation.
  • 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".

This doctest demonstrates that exponential_search correctly handles empty arrays by returning -1.
@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Nov 24, 2025
Copilot AI lite review requested due to automatic review settings September 6, 2026 21:40
@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label Sep 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new doctest is mis-indented and, once corrected, currently fails because exponential_search([] , ...) raises IndexError instead of returning -1.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This pull request aims to add a doctest demonstrating how exponential_search behaves on an empty input collection.

Changes:

  • Adds a new doctest example for the empty-collection edge case in exponential_search.
File summaries
File Description
searches/exponential_search.py Adds a doctest intended to validate empty-input behavior for exponential_search.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +84 to +86

>>> exponential_search([], 1) # Empty array edge case
-1
@cclauss cclauss added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes A maintainer has requested changes to this PR enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants