Skip to content

Add deleteByValue to circular linked list and expose in CLI menu#27

Merged
Nullkernel merged 1 commit intomainfrom
codex/add-deletebyvalue-method-in-circularlinkedlists
Apr 7, 2026
Merged

Add deleteByValue to circular linked list and expose in CLI menu#27
Nullkernel merged 1 commit intomainfrom
codex/add-deletebyvalue-method-in-circularlinkedlists

Conversation

@Nullkernel
Copy link
Copy Markdown
Owner

Motivation

  • Provide a safe deleteByValue operation for the circular linked list that handles common edge cases and makes value-based deletion available from the interactive menu.
  • Ensure deletions correctly maintain the circular list invariants (especially tail and tail.next) and avoid infinite loops when the key is absent.

Description

  • Added public void deleteByValue(int key) to Data-Structures/Linked-Lists/CircularLinkedLists.java with handling for tail == null, single-node circles, deleting the tail (updates tail), deleting the head (updates tail.next), and stopping after one full cycle when the key is not found.
  • Wired the new operation into the CLI: added menu option 5. Delete by Value, shifted subsequent options, and changed the exit choice from 7 to 8 accordingly.
  • Updated the switch in main to read the delete key from the user and call deleteByValue, and added a sample output block demonstrating insertion, delete-by-value, and display.

Testing

  • Compiled the modified file with javac Data-Structures/Linked-Lists/CircularLinkedLists.java and the compilation succeeded.

Codex Task

@Nullkernel Nullkernel merged commit e68b092 into main Apr 7, 2026
1 check passed
@Nullkernel Nullkernel deleted the codex/add-deletebyvalue-method-in-circularlinkedlists branch April 7, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant