Skip to content

Add deleteByValue and menu option to LinkedList demo#26

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

Add deleteByValue and menu option to LinkedList demo#26
Nullkernel merged 1 commit intomainfrom
codex/add-deletebyvalue-method-in-linkedlist

Conversation

@Nullkernel
Copy link
Copy Markdown
Owner

Motivation

  • Provide a convenient way to remove the first node matching a value from the singly linked list without using a position index.
  • Make the CLI demo cover deletion-by-value so users can exercise the new operation interactively.

Description

  • Added deleteByValue(int key) to SinglyLinkedList which handles an empty list, removes the head when it matches, traverses with prev/curr to unlink the first matching node, and prints a clear message when no node matches.
  • Updated the interactive menu in LinkedList.main to include a Delete by Value option and adjusted subsequent menu numbering and the loop exit condition accordingly.
  • Kept existing deletion-by-position and other list operations unchanged except for menu wiring.

Testing

  • Ran javac Data-Structures/Linked-Lists/LinkedList.java and compilation completed successfully.

Codex Task

@Nullkernel Nullkernel merged commit 449514d into main Apr 7, 2026
1 check passed
@Nullkernel Nullkernel deleted the codex/add-deletebyvalue-method-in-linkedlist 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