Contains loops.py add#2442
Conversation
syncing from upstream repo
…rue if one is found
| def contains_loop(root: Node) -> bool: | ||
| """ | ||
| given a node, returns true if linked list contains a loop | ||
| A linked list contains a loop when traversing through a loop, no null is reached. |
There was a problem hiding this comment.
This explanation is still unclear to me. What is a null in this context?
|
Hey @kanthuc, TravisCI finished with status TravisBuddy Request Identifier: 500c6ff0-f9e9-11ea-8549-e58e00c6eb1f |
|
Hey @kanthuc, TravisCI finished with status TravisBuddy Request Identifier: 04efb2f0-f9eb-11ea-8549-e58e00c6eb1f |
Travis tests have failedHey @kanthuc, TravisBuddy Request Identifier: dde3b520-f9eb-11ea-8549-e58e00c6eb1f |
Travis tests have failedHey @kanthuc, TravisBuddy Request Identifier: bffc4d90-f9ed-11ea-8549-e58e00c6eb1f |
|
Hey @kanthuc, TravisCI finished with status TravisBuddy Request Identifier: c80f7e60-f9ef-11ea-8549-e58e00c6eb1f |
* added an algorithm which checks a linked list for loops and returns true if one is found * added doctests and clarified meaning of loop * Define Node.__iter__() * Update and rename has_loop.py to has_duplicate_data.py * Update has_duplicate_data.py * Update has_duplicate_data.py * Update and rename has_duplicate_data.py to has_loop.py * Update has_loop.py Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
Added an algorithm which checks a linked list for loops and returns true if one is found.
Checklist:
Fixes: #{$ISSUE_NO}.