Skip to content
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

Added Floyd Algorithm for searching for duplicates #1179

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

@CyberIkshit
Copy link

@CyberIkshit CyberIkshit commented Oct 4, 2020

Added a cpp file for Floyd Algorithm for cycle detection Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

@CyberIkshit
Copy link
Author

@CyberIkshit CyberIkshit commented Oct 4, 2020

Could someone please help me why these automated tests are failing even though my code is perfect?

@kvedala
Copy link
Collaborator

@kvedala kvedala commented Oct 4, 2020

image

@CyberIkshit
Copy link
Author

@CyberIkshit CyberIkshit commented Oct 4, 2020

Yeah, I've gone through that but unable to rectify the error from it as it is showing numerous errors in code despite my code is compiling just perfect. Actually, this is my first PR that's why having some difficulty doing it. Hope you'll help.

Output: 3
*/
#include<bits/stdc++.h>
using namespace std;

This comment has been minimized.

@Pardeep009

Pardeep009 Oct 9, 2020
Contributor

as per repo standards, you cannot use namespaces globally.
using cout, cin etc directly is not allowed, instead use std::cout, std::cin

#include<bits/stdc++.h>
using namespace std;
int findDuplicate(vector<int>& nums) {
int slow=nums[0];

This comment has been minimized.

@Pardeep009

Pardeep009 Oct 9, 2020
Contributor

you have declared c style arrays, use std::array, for example see https://github.com/TheAlgorithms/C-Plus-Plus/pull/1085

This comment has been minimized.

@Pardeep009

Pardeep009 Oct 9, 2020
Contributor

bits/stdc++ library is not allowed, as it is Linux specific and it also slows down compilation process. so include only required libraries.

@CyberIkshit
Copy link
Author

@CyberIkshit CyberIkshit commented Oct 9, 2020

Thanks @Pardeep009 for giving such a detailed step by step solution to my problem, it was a great help.

@CyberIkshit
Copy link
Author

@CyberIkshit CyberIkshit commented Oct 16, 2020

Kindly review and update me if any furthur changes are to be made

@mishraabhinn
Copy link
Member

@mishraabhinn mishraabhinn commented Oct 16, 2020

Kindly review and update me if any furthur changes are to be made

Not upto repo standards.
Refer
Thank you.

@Pardeep009
Copy link
Contributor

@Pardeep009 Pardeep009 commented Oct 16, 2020

make sure you must add comments for all functions, what they are going to do, what their parameters are, what will be their return type, also add testing for your code. Refer https://github.com/TheAlgorithms/C-Plus-Plus/pull/1085.
if possible, add Wikipedia link.

@kvedala
Copy link
Collaborator

@kvedala kvedala commented Oct 16, 2020

@Pardeep009 thank you for providing your reviews 😄
Contribution guidelines
A complete example of the code structure, writing a good code, the details on find the errors, etc have been elaborated to the greatest extant possible.

Note that "prefect" code, as you refer it, is subjective. The repository goals and objectives and standards might be much more higher and stricter. Following the norms can help you become a good programmer as that is one of the objectives of the repo. The code contributed should be such that any layman reading it can learn from the code.

@stale
Copy link

@stale stale bot commented Jun 18, 2021

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.

@stale stale bot added the abandoned label Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants