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
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 added 3 commits Oct 4, 2020
@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.

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

3 participants
You can’t perform that action at this time.