G
YouTube TikTok Games
Skip to content

feat(searches): add type hints and edge-case doctests to sentinel_linear_search - #15707

Open
adiityakr wants to merge 2 commits into
TheAlgorithms:masterfrom
adiityakr:feat/improve-sentinel-linear-search
Open

adiityakr wants to merge 2 commits into
TheAlgorithms:masterfrom
adiityakr:feat/improve-sentinel-linear-search

Conversation

@adiityakr

Copy link
Copy Markdown

Describe your change

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests?
  • Documentation change?
  • Added Python 3 type annotations (sequence: list[Any], target: Any) -> int | None) to sentinel_linear_search.
  • Added comprehensive edge-case doctests (empty list, duplicates, negative values, strings, absent target).
  • Standardized __main__ to run doctest.testmod() per contributing guidelines.

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 another similar explanation.

…ear_search

- Add type annotations (sequence: list[Any], target: Any) -> int | None
- Add comprehensive doctests covering empty list, duplicates, negative numbers, and strings
- Update return expectation for absent target (test with 'is None')
- Replace interactive input() in __main__ with doctest.testmod() per contributing guidelines
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Nov 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant