Skip to content

Implement two-pointer / sliding-window detector (MVP) #4

Description

@MaximilianRau04

Context

src/algorithm_pattern_classifier/detectors/ is currently empty. We need a first working detector to validate the detection pipeline end-to-end before adding more patterns.

What

Implement the first concrete BaseDetector for the two-pointer and sliding-window patterns:

  • Two-pointer: two index variables initialized at opposite (or same) ends of a sequence, advanced conditionally within a shared loop.
  • Sliding-window: a window defined by a start/end index pair that expands/contracts over a single pass, typically tracking a running aggregate (sum, count, max).

Detection should work on the parsed AST (or structural metadata from #1) and produce evidence (line numbers, matched sub-structure) supporting the classification.

Depends on #1.

Acceptance Criteria

  • Detector correctly flags reference implementations of two-sum (sorted array, two-pointer) and longest-substring-without-repeat (sliding window)
  • Detector does not false-positive on a plain single-pointer linear scan
  • Unit tests cover true positives, true negatives, and near-miss cases (e.g. two independent loops that aren't actually two-pointer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions