Skip to content

Add doubly_to_singly() method to convert a doubly linked list to a singly linked list#14410

Open
F-Blaze wants to merge 2 commits intoTheAlgorithms:masterfrom
F-Blaze:doubly-to-singly-conversion
Open

Add doubly_to_singly() method to convert a doubly linked list to a singly linked list#14410
F-Blaze wants to merge 2 commits intoTheAlgorithms:masterfrom
F-Blaze:doubly-to-singly-conversion

Conversation

@F-Blaze
Copy link

@F-Blaze F-Blaze commented Mar 15, 2026

Describe your change:

  • Add an algorithm

This pull request adds a new method doubly_to_singly() to the DoublyLinkedList class.

The method converts a doubly linked list into a singly linked list by creating a new singly linked list and copying the data from each node.

The implementation includes:

  • type hints
  • doctest examples
  • a unit test in test_doubly_linked_list()

Checklist:

  • I have read CONTRIBUTING.md
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass automated testing.
  • A Wikipedia reference has been included for the algorithm.

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Mar 15, 2026
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Mar 15, 2026
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 enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant