Skip to content

Enhance double_linear_search doctests with comprehensive examples#14285

Open
JesunAhmadUshno wants to merge 2 commits intoTheAlgorithms:masterfrom
JesunAhmadUshno:enhance-double-search-doctests
Open

Enhance double_linear_search doctests with comprehensive examples#14285
JesunAhmadUshno wants to merge 2 commits intoTheAlgorithms:masterfrom
JesunAhmadUshno:enhance-double-search-doctests

Conversation

@JesunAhmadUshno
Copy link

Summary

Enhanced doctest coverage for double_linear_search() with 17 comprehensive test examples covering:

  • Valid searches (first, middle, last element, various positions)
  • Invalid searches (element not found)
  • Edge cases (empty list, single-element list)
  • Duplicates (all elements same, finding first occurrence)
  • Negative numbers and various array sizes
  • Algorithm behavior explanation in docstring

Changes

  • Added 13 new doctest examples (from 4 → 17 total)
  • Improved docstring to explain the two-pointer search approach
  • All tests pass locally: python -m doctest -v double_linear_search.py

Checklist

  • I have read the CONTRIBUTING.md file
  • This is my own work and not plagiarized
  • My work will be distributed under the MIT License once merged
  • My submission follows the coding style and standards of this repository
  • I have tested my changes locally
  • All doctest examples pass
  • Code passes ruff linting

Copilot AI review requested due to automatic review settings February 17, 2026 10:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR claims to enhance doctest coverage for double_linear_search() but actually contains multiple unrelated changes across different files. The main changes include:

Changes:

  • Added 13 new doctest examples to double_linear_search() (lines 26-63)
  • Migrated several files from TypeVar to PEP 695 generic syntax
  • Updated type hints in check_bipatrite.py to be more generic
  • Minor code cleanup in hash_table_with_linked_list.py

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
searches/double_linear_search.py Enhanced docstring with 13 new doctests covering edge cases, duplicates, and negative numbers
searches/jump_search.py Migrated from TypeVar to PEP 695 syntax (def jump_search[T: Comparable])
machine_learning/linear_discriminant_analysis.py Migrated valid_input function from TypeVar to PEP 695 syntax
graphs/check_bipatrite.py Improved type hints to use Mapping[Hashable, Iterable[Hashable]] and removed FIXME comments
data_structures/hashing/hash_table_with_linked_list.py Changed deque([]) to deque() for cleaner initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +20
from typing import Any, Protocol


class Comparable(Protocol):
def __lt__(self, other: Any, /) -> bool: ...


T = TypeVar("T", bound=Comparable)


def jump_search(arr: Sequence[T], item: T) -> int:
def jump_search[T: Comparable](arr: Sequence[T], item: T) -> int:
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The PR description states "Enhanced doctest coverage for double_linear_search()" but this file contains unrelated changes migrating from TypeVar to PEP 695 generic syntax. This change (along with similar changes in machine_learning/linear_discriminant_analysis.py, graphs/check_bipatrite.py, and data_structures/hashing/hash_table_with_linked_list.py) should either be mentioned in the PR description or submitted as a separate PR focused on type annotation modernization.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant