Skip to content

Conversation

@Shuklax
Copy link
Contributor

@Shuklax Shuklax commented Oct 31, 2025

This contribution includes:

Creating a new file rotate_linked_list.js in dsa/linkedlist/.
Implementing an optimized rotation algorithm using a circular connection and modular arithmetic.
Adding detailed comments, example usage, and a self-check in the console.

fixes #298

@github-actions
Copy link

🧩 PR Checklist

Hi @Shuklax, before merging please ensure:

  • Updated contributor.md
  • Added proper commit message
  • Verified build/test success ✅

@github-actions
Copy link

⭐ Hey @Shuklax, if you like this project, don't forget to star the repository! 🚀

@ayushHardeniya ayushHardeniya merged commit 0ccf781 into HarshitPachori:main Nov 1, 2025
6 checks passed
@ayushHardeniya ayushHardeniya added enhancement New feature or request javascript labels Nov 1, 2025
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 introduces two new linked list manipulation algorithms: rotating a linked list to the right by k places and reordering a linked list by odd and even indices.

  • Implements rotateRight function that rotates a linked list to the right by k positions using a circular linked list approach
  • Implements oddEvenLinkedList function that groups nodes at odd indices together followed by nodes at even indices
  • Both implementations include helper functions for printing lists and self-test code for browser environments

Reviewed Changes

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

File Description
dsa_in_js/linkedlist/rotate_linked_list.js Adds rotation algorithm with circular linking technique, including ListNode class, rotation logic, and test code
dsa_in_js/linkedlist/odd_even_linked_list.js Adds odd-even reordering algorithm with two-pointer approach, including ListNode class, reordering logic, and test code

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

Repository owner locked and limited conversation to collaborators Nov 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request javascript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'Rotate linked list' in JS

2 participants