Skip to content

Conversation

@BrianLusina
Copy link
Owner

@BrianLusina BrianLusina commented Jan 4, 2026

Describe your change:

Shortest common supersequence algorithm challenge and refactor on sorting algorithms

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • 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 have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Summary by CodeRabbit

  • New Features

    • Added Shortest Common Supersequence algorithm for computing the shortest string containing two input strings as subsequences
    • Added alternative Heapsort implementation with optimized recursive approach
  • Tests

    • Comprehensive test suites added for Heapsort covering multiple numeric lists
    • Test suite added for Mergesort with edge cases
  • Documentation

    • Navigation structure updated with new algorithm entries
    • Detailed documentation provided for Shortest Common Supersequence algorithm

✏️ Tip: You can customize this high-level summary in your review settings.

@BrianLusina BrianLusina self-assigned this Jan 4, 2026
@BrianLusina BrianLusina added enhancement Algorithm Algorithm Problem Datastructures Datastructures Documentation Documentation Updates Sorting Contains sorting in the algorithm Array Array data structure Dynamic Programming Dynamic Programming algorithm Heap Heap Sort Merge Sort labels Jan 4, 2026
@BrianLusina BrianLusina merged commit 8f7d65b into main Jan 4, 2026
3 of 5 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The pull request adds documentation entries for three new algorithm implementations: Shortest Common Supersequence with its module and tests, heapsort type annotations with an alternative heapsort_2 variant using heapify_2, and test coverage for mergesort. No behavioral changes to existing code.

Changes

Cohort / File(s) Summary
Documentation & Navigation
DIRECTORY.md
Added navigation entries for Shortest Common Supersequence, Heapsort, and Mergesort sections with corresponding test links.
Shortest Common Supersequence
algorithms/dynamic_programming/shortest_common_supersequence/README.md, algorithms/dynamic_programming/shortest_common_supersequence/__init__.py, algorithms/dynamic_programming/shortest_common_supersequence/test_shortest_common_supersequence.py
Introduced new SCS algorithm module with problem documentation, DP-based implementation (builds 2D table, reconstructs sequence via backtracking), and parameterized unit tests covering multiple input pairs.
Heapsort
algorithms/sorting/heapsort/__init__.py, algorithms/sorting/heapsort/test_heap_sort.py
Enhanced heapsort module with comprehensive type annotations (List[Any]) across all functions, introduced heapify_2 and heapsort_2 as alternative recursive heap-building and sorting variants, and added new test module with parameterized cases for both in-place and functional heapsort variants.
Mergesort Tests
algorithms/sorting/mergesort/test_merge_sort.py
Added test module validating merge_sort_in_place and merge_sort_out_of_place implementations with parameterized test cases covering various inputs including negatives and duplicates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

Strings

Poem

🐰 A sequence string unfolds so true,
With heaps and sorts, the code's renewed!
Dynamic paths through letters dance,
Merging order in each glance—
Algorithms bloom from root to leaf! 🌿

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 599b271 and f366e87.

⛔ Files ignored due to path filters (4)
  • algorithms/dynamic_programming/shortest_common_supersequence/images/examples/shortest_common_supersequence_example_1.png is excluded by !**/*.png
  • algorithms/dynamic_programming/shortest_common_supersequence/images/examples/shortest_common_supersequence_example_2.png is excluded by !**/*.png
  • algorithms/dynamic_programming/shortest_common_supersequence/images/examples/shortest_common_supersequence_example_3.png is excluded by !**/*.png
  • algorithms/dynamic_programming/shortest_common_supersequence/images/examples/shortest_common_supersequence_example_4.png is excluded by !**/*.png
📒 Files selected for processing (7)
  • DIRECTORY.md
  • algorithms/dynamic_programming/shortest_common_supersequence/README.md
  • algorithms/dynamic_programming/shortest_common_supersequence/__init__.py
  • algorithms/dynamic_programming/shortest_common_supersequence/test_shortest_common_supersequence.py
  • algorithms/sorting/heapsort/__init__.py
  • algorithms/sorting/heapsort/test_heap_sort.py
  • algorithms/sorting/mergesort/test_merge_sort.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

Algorithm Algorithm Problem Array Array data structure Datastructures Datastructures Documentation Documentation Updates Dynamic Programming Dynamic Programming algorithm enhancement Heap Sort Heap Merge Sort Sorting Contains sorting in the algorithm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants