Skip to content

feat: Project Euler Problem #107#653

Closed
Daves1245 wants to merge 7 commits into
TheAlgorithms:masterfrom
Daves1245:pe107
Closed

feat: Project Euler Problem #107#653
Daves1245 wants to merge 7 commits into
TheAlgorithms:masterfrom
Daves1245:pe107

Conversation

@Daves1245

@Daves1245 Daves1245 commented Oct 11, 2020

Copy link
Copy Markdown

Description of Change

Add a solution to project euler problem 107 using Kruskal's algorithm.
I've followed the contribution guidelines to the best of my abilities, please lmk of any changes you would like to be made.
Thank you for your time!

References

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • 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:

@kvedala kvedala left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Comment thread project_euler/problem_107/sol1.c Outdated
* The union find data structure
*/
struct ufds {
int rank[NUM_VERTICES], parent[NUM_VERTICES], size[NUM_VERTICES];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int rank[NUM_VERTICES], parent[NUM_VERTICES], size[NUM_VERTICES];
int rank[NUM_VERTICES]; /**< 1-line description of variable here */
int parent[NUM_VERTICES];/**< 1-line description of variable here */
int size[NUM_VERTICES];/**< 1-line description of variable here */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 67e24f4

Comment thread project_euler/problem_107/sol1.c Outdated
*/
struct ufds {
int rank[NUM_VERTICES], parent[NUM_VERTICES], size[NUM_VERTICES];
int num_sets;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int num_sets;
int num_sets; /**< 1-line description of variable here */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Applied in 67e24f4

#include <stdlib.h>
#include <string.h>
#include <assert.h>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/**
* @addtogroup project_euler_107 Project Euler 107
* @{
*/

Since there are many associated functions and variables involved, better to group them for easy navigation on documentation site

Comment thread project_euler/problem_107/sol1.c
Comment thread project_euler/problem_107/sol1.c Outdated
}
}

/* Compare two edges by their weight */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* Compare two edges by their weight */
/** Compare two edges by their weight
* @param a pointer to ...
* @param b pointer to ......
* @returns .....
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Applied in 67e24f4

Comment thread project_euler/problem_107/sol1.c Outdated
}
}

/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/*
/**

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 67e24f4

Comment thread project_euler/problem_107/sol1.c
Comment thread project_euler/problem_107/sol1.c Outdated
int w;
};

/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/*
/**

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 67e24f4

Comment thread project_euler/problem_107/sol1.c Outdated
#define NUM_LINES 40
#define MAX_LINE_LEN 4 * 40 // a line is at most 40 3-digit numbers and a comma

/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/*
/**

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 67e24f4

Comment thread project_euler/problem_107/sol1.c Outdated
* get the savings and the solution to the problem.
*/

/** Main function */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/** Main function */
/** Main function
* @return 0
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 67e24f4

@Panquesito7 Panquesito7 added Changes requested enhancement New feature or request labels Oct 16, 2020
@Daves1245

Copy link
Copy Markdown
Author

Thanks @kvedala, done.

@Daves1245

Copy link
Copy Markdown
Author

Could I also ask to have the hacktoberfest tag added? I just realized I forgot to include it with my inital PR and can't seem to add it now, my bad.

@Panquesito7

Panquesito7 commented Oct 16, 2020

Copy link
Copy Markdown
Member

Hacktoberfest label added

This repository has the hacktoberfest topic, so, once your PR is
merged, it shall count towards completing the Hacktoberfest challenge. 🙂

@Daves1245

Copy link
Copy Markdown
Author

Sweet, thanks!

@kvedala

kvedala commented Oct 19, 2020

Copy link
Copy Markdown
Collaborator

Thanks @kvedala, done.

Most of the comments have not been addressed. Please review them

Add syntax correction.

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
@Daves1245

Copy link
Copy Markdown
Author

My bad,
I've applied the changes in the past two commits, I suppose I should have batch committed them instead?
I'm still new to contributing so I appreciate your patience lol. Thank you and lmk if anything else is needed.

@kvedala

kvedala commented Oct 19, 2020

Copy link
Copy Markdown
Collaborator

My bad,
I've applied the changes in the past two commits, I suppose I should have batch committed them instead?
I'm still new to contributing so I appreciate your patience lol. Thank you and lmk if anything else is needed.

No worries. I am marking this PR as "draft" and make your changes. Once the code is ready for review, you can then mark it as such.

@kvedala
kvedala marked this pull request as draft October 19, 2020 23:54
@github-actions

github-actions Bot commented Nov 5, 2021

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the Stale label Nov 5, 2021
@Panquesito7 Panquesito7 removed the Stale label Nov 5, 2021
@github-actions

github-actions Bot commented Dec 6, 2021

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the Stale label Dec 6, 2021
@Panquesito7 Panquesito7 removed the Stale label Dec 6, 2021
@github-actions

github-actions Bot commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the Stale label Jan 6, 2022
@Panquesito7 Panquesito7 removed the Stale label Jan 6, 2022
@github-actions

github-actions Bot commented Feb 6, 2022

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the Stale label Feb 6, 2022
@github-actions

Copy link
Copy Markdown
Contributor

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!

@github-actions github-actions Bot closed this Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants