Skip to content

Conversation

@devaryankhare
Copy link
Contributor

Description:
This program modifies a singly linked list such that it retains the first M nodes and then deletes the next N nodes, repeating this process until the end of the list.
This operation helps understand pointer manipulation and traversal in linked lists.

Algorithm / Approach:

Start from the head of the linked list.

Traverse M nodes, keeping them as part of the final list.

After reaching the Mth node, start deleting the next N nodes.

Connect the Mth node’s next pointer to the node right after the deleted section.

Repeat this process until the end of the list is reached.

Implement a function to delete N nodes after M nodes in a linked list. Includes a main method to demonstrate functionality.
@dimpeshpanwar dimpeshpanwar added the hacktoberfest-accepted hacktoberfest-accepted 2025 label Oct 26, 2025
@dimpeshpanwar dimpeshpanwar merged commit c6adf74 into dimpeshpanwar:main Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted hacktoberfest-accepted 2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants