Skip to content

Conversation

rahulYUV
Copy link

Added Files:

max_subarray_circular.py: Implements the maximum sum subarray in a circular array using an optimized O(n) approach, adapting Kadane’s algorithm for circular structures.

sliding_window_maximum.py: Efficient sliding window maximum finder using a deque for optimal O(n) complexity. Both implementations include comprehensive doctests.

References:

Maximum Circular Subarray: https://en.wikipedia.org/wiki/Maximum_subarray_problem#Circular_array

Sliding Window Maximum: https://en.wikipedia.org/wiki/Sliding_window_protocol

Describe your change:
(1) Add new algorithms to solve distinct array manipulation problems.
NO Fix a bug or typo in an existing algorithm?
NO Add or change doctests?
NO Documentation change?
Checklist:
I have read and followed CONTRIBUTING.md
This PR is entirely my own work and original.
I understand that PRs failing automated tests will not be merged.
Although this PR adds two files, each solves different yet related array manipulation tasks, which will streamline review.
Both files are located in existing directories, and all naming conventions align with repo guidelines.
Function parameters and returns use type hints, and doctests pass automated testing.
Each algorithm includes a link for further reference.

- Add max_subarray_circular.py: Finds maximum sum subarray in circular array using O(n) time
- Add sliding_window_maximum.py: Implements efficient sliding window maximum using deque
- Both implementations include doctests and comprehensive documentation
- Follows repository's code style guidelines
@algorithms-keeper
Copy link

Closing this pull request as invalid

@rahulYUV, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 28, 2024
@rahulYUV
Copy link
Author

Add algorithms for maximum sum subarray in circular array and sliding window maximum

  • Implemented max_subarray_circular.py to find the maximum sum subarray in a circular array using an optimized O(n) approach.
  • Added sliding_window_maximum.py for efficient calculation of the maximum in a sliding window using a deque.
  • Included comprehensive doctests for both implementations.

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 invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant