Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stephyyi/algorithms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: keon/algorithms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 10 commits
  • 16 files changed
  • 13 contributors

Commits on Feb 5, 2024

  1. Optimize longest_non_repeat.py (keon#914)

    Added window sliding approach to find longest non repeating sub string
    PIYUSH-GOSWAMI authored Feb 5, 2024
    Configuration menu
    Copy the full SHA
    1117ffe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    40c944c View commit details
    Browse the repository at this point in the history
  3. Add Kosaraju algorithm (keon#910)

    * added kosaraju's algorithm under /algorithms/graph
    
    * added test case for /algorithms/graph/strongly_connected_component_kosaraju
    
    ---------
    
    Co-authored-by: Rubal Singh <nbarubz@gmail.com>
    rubalsxngh and Rubal Singh authored Feb 5, 2024
    Configuration menu
    Copy the full SHA
    e9c28af View commit details
    Browse the repository at this point in the history
  4. Add remove duplicates (keon#905)

    * Initial commit for remove duplicates
    
    * Made changes to readme and added test case
    oDqnger authored Feb 5, 2024
    Configuration menu
    Copy the full SHA
    cad4754 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2025

  1. Configuration menu
    Copy the full SHA
    66eb36d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0b04e60 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    486fa37 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2025

  1. Added the validate bst function (keon#2696)

    * Added the validate bst function
    
    * Added the validate bst function
    
    ---------
    
    Co-authored-by: Piyush Goel <piyushgoel@Piyushs-MacBook-Air-4.local>
    PiyushGoel0612 and Piyush Goel authored Oct 9, 2025
    Configuration menu
    Copy the full SHA
    67287d2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5b63e90 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2025

  1. Optimize remove_duplicates from O(n²) to O(n) time complexity (keon#2700

    )
    
    * Optimize remove_duplicates from O(n²) to O(n) time complexity
    
    Use a set for O(1) membership checks instead of checking membership in a list which is O(n). This reduces the overall time complexity from O(n²) to O(n).
    
    Added documentation for time and space complexity.
    
    Co-Authored-By: Keon <kwk236@gmail.com>
    
    * Fix: Handle unhashable items in remove_duplicates
    
    The previous optimization broke when the function received unhashable items
    like lists or dicts, causing TypeError. This commit adds backward compatibility
    by checking if items are hashable:
    - Hashable items use set for O(1) lookup (fast path)
    - Unhashable items fall back to list membership check (preserves original behavior)
    
    This maintains the O(n) optimization for the common case while preserving
    backward compatibility for all input types.
    
    Co-Authored-By: Keon <kwk236@gmail.com>
    
    * Fix: Apply black formatting to remove_duplicates.py
    
    Add blank lines after imports and before function definition to comply
    with black code formatting style, which is checked by CI.
    
    Co-Authored-By: Keon <kwk236@gmail.com>
    
    * Fix: Remove unused nonlocal/global declarations (F824 errors)
    
    Remove unused nonlocal declarations in find_all_cliques.py and unused
    global declaration in construct_tree_postorder_preorder.py to fix
    flake8 F824 errors that were causing CI to fail.
    
    These declarations were unnecessary because:
    - In find_all_cliques: compsub and solutions are only mutated (append/pop),
      not reassigned, so nonlocal is not needed
    - In construct_tree: pre_index is never used or assigned in this function,
      only in construct_tree_util
    
    Also applied black formatting to both files.
    
    Co-Authored-By: Keon <kwk236@gmail.com>
    
    * Fix: Resolve pre-existing test failures blocking CI
    
    Fix two pre-existing test failures that were causing CI to fail:
    
    1. test_remove_duplicates: Added missing expected values to assertListEqual
       calls. The test was malformed with only input arrays but no expected
       outputs, causing TypeError.
    
    2. test_summarize_ranges: Fixed summarize_ranges() to return tuples
       instead of strings. The function was converting tuples to formatted
       strings like '0-2', but tests expected tuples like (0, 2).
    
    Both fixes align implementations with test expectations and docstrings.
    Applied black formatting to both files.
    
    Co-Authored-By: Keon <kwk236@gmail.com>
    
    ---------
    
    Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
    Co-authored-by: Keon <kwk236@gmail.com>
    devin-ai-integration[bot] and keon authored Nov 3, 2025
    Configuration menu
    Copy the full SHA
    5991e05 View commit details
    Browse the repository at this point in the history
Loading