Added 2 new linked list operations one for finding cycles and one for reversing the list#1201
Added 2 new linked list operations one for finding cycles and one for reversing the list#1201achak47 wants to merge 2 commits intoTheAlgorithms:masterfrom
Conversation
Added 2 algorithms for linked list
| @@ -0,0 +1,51 @@ | |||
| #include <stdio.h> | |||
There was a problem hiding this comment.
Please add a one-line description of what the library/header is for
|
|
||
| int main() | ||
| { | ||
| struct Node* head = NULL; |
There was a problem hiding this comment.
According the https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#test . What do you think about moving your example into the test method with asserts?
|
|
||
| int detectLoop(struct Node* list) | ||
| { | ||
| struct Node *slow_p = list, *fast_p = list; |
There was a problem hiding this comment.
If I remember correctly, It's a Floyd's tortoise and hare algorithm. Probably it's better to add a comment about this. That would be easy to recognize it in the future.
|
Great comments, @alexpantyukhin. Thanks for your help! 🚀 |
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions! |
Description of Change
References
Checklist
Notes: