Skip to content

Create merge_two_lists.py that implements merging of two sorted linked lists #3874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 3, 2020

Conversation

maldz3
Copy link
Contributor

@maldz3 maldz3 commented Nov 10, 2020

…d lists

Describe your change:

Implemented a new algorithm that merges two sorted linked lists into one sorted linked list
Includes:
function that creates a linked list using the Node class from a Python array,
function that creates a string representation of a linked list (1->2->3),
function that merges two lists into one.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

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. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • 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 the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@maldz3
Copy link
Contributor Author

maldz3 commented Nov 10, 2020

Please let me know if there are any changes or additions I can make.

@maldz3
Copy link
Contributor Author

maldz3 commented Nov 23, 2020

@cclauss I'd appreciate some feedback and a code review for my pr, thanks!

@ghost ghost mentioned this pull request Nov 25, 2020
14 tasks
@maldz3 maldz3 mentioned this pull request Nov 30, 2020
Copy link
Contributor

@amaank404 amaank404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhruvmanila, check this out

Also well done

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am struggling with why we need all this code to deliver the equivalent of list_one + list_two

@ghost ghost added the awaiting changes A maintainer has requested changes to this PR label Nov 30, 2020
@ghost ghost added require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html awaiting reviews This PR is ready to be reviewed and removed awaiting changes A maintainer has requested changes to this PR labels Dec 1, 2020
@ghost ghost added tests are failing Do not merge until tests pass and removed awaiting reviews This PR is ready to be reviewed labels Dec 1, 2020
@ghost ghost removed the require type hints https://docs.python.org/3/library/typing.html label Dec 3, 2020
@maldz3
Copy link
Contributor Author

maldz3 commented Dec 3, 2020

@cclauss, @xcodz-dot I've simplified the file by importing the Node and LinkedList classes from https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/singly_linked_list.py
Are there any other changes you would like me to make? Thanks!
Looks like I have conflicts too.

@amaank404
Copy link
Contributor

I can not tell much but wait for @cclauss, I do not find importing relevent in this case

@ghost ghost added the require type hints https://docs.python.org/3/library/typing.html label Dec 3, 2020
@ghost ghost removed the tests are failing Do not merge until tests pass label Dec 3, 2020
@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Dec 3, 2020
@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Dec 3, 2020
@cclauss cclauss merged commit 860d4f5 into TheAlgorithms:master Dec 3, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…d lists (TheAlgorithms#3874)

* Create merge_two_lists.py that implements merging of two sorted linked lists

* Update merge_two_lists.py

Fixed formatting errors

* Fixed trailing whitespace

* Change name of function to def __str__()

* updating DIRECTORY.md

* Imported classes from singly_linked_list.py

* Update merge_two_lists.py

* Update merge_two_lists.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
peRFectBeliever pushed a commit to peRFectBeliever/Python that referenced this pull request Apr 1, 2021
…d lists (TheAlgorithms#3874)

* Create merge_two_lists.py that implements merging of two sorted linked lists

* Update merge_two_lists.py

Fixed formatting errors

* Fixed trailing whitespace

* Change name of function to def __str__()

* updating DIRECTORY.md

* Imported classes from singly_linked_list.py

* Update merge_two_lists.py

* Update merge_two_lists.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
…d lists (TheAlgorithms#3874)

* Create merge_two_lists.py that implements merging of two sorted linked lists

* Update merge_two_lists.py

Fixed formatting errors

* Fixed trailing whitespace

* Change name of function to def __str__()

* updating DIRECTORY.md

* Imported classes from singly_linked_list.py

* Update merge_two_lists.py

* Update merge_two_lists.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
…d lists (TheAlgorithms#3874)

* Create merge_two_lists.py that implements merging of two sorted linked lists

* Update merge_two_lists.py

Fixed formatting errors

* Fixed trailing whitespace

* Change name of function to def __str__()

* updating DIRECTORY.md

* Imported classes from singly_linked_list.py

* Update merge_two_lists.py

* Update merge_two_lists.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants