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

selection_sort.cpp: Add cpp implementation for selection sort. #483

Merged
merged 1 commit into from
Oct 31, 2018

Conversation

yashasingh
Copy link
Member

@yashasingh yashasingh commented Oct 29, 2018

This commit adds the Cpp implementation of selection sort for NITSkmOS/Algorithms.

closes #482

For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!

Fixes #482

By submitting this pull request I confirm I've read and complied with the
below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the commit guidelines for this project.
  • My code follows the standard code structure.
  • This pull request has a descriptive title. For example, {Tag}: Add {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous time span of 7 days.
  • This pull request shall only be reviewed and merged once all the checks passes. No maintainer or supporter shall be obliged to review it before this condition is met.
  • I have mentioned the issue number correctly (with hyperlink) in this pull request description.

After you submit your pull request, DO NOT click the 'Update Branch' button.

@TravisBuddy
Copy link

Hey @yashasingh,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: d94ab390-dbc2-11e8-8e0f-4de0fcdedaae

cout << "Enter the length of the array (less than 100)- ";
cin >> n;
cout << "Enter space separated " << n << " numbers- ";
for(int i = 0;i < n; i++){
Copy link
Member

Choose a reason for hiding this comment

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

Missing space before { [whitespace/braces] [5]

Origin: CPPLintBear, Section: all.cpplint.

return 0;
}

void selection_sort(int arr[], int n){
Copy link
Member

Choose a reason for hiding this comment

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

Missing space before { [whitespace/braces] [5]

Origin: CPPLintBear, Section: all.cpplint.

int i, j, temp;
for(i = 0; i < n; i++)
for(j = i+1; j < n; j++){
if(arr[i]>arr[j]){
Copy link
Member

Choose a reason for hiding this comment

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

Missing spaces around > [whitespace/operators] [3]

Origin: CPPLintBear, Section: all.cpplint.

@TravisBuddy
Copy link

Hey @yashasingh,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 14344410-dbc5-11e8-8e0f-4de0fcdedaae

@TravisBuddy
Copy link

Hey @yashasingh,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: cdff9700-dbc5-11e8-8e0f-4de0fcdedaae

@TravisBuddy
Copy link

Hey @yashasingh,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 53429480-dbc6-11e8-8e0f-4de0fcdedaae

@yashasingh
Copy link
Member Author

@sangamcse Please review my PR!

Copy link
Member

@sangamcse sangamcse left a comment

Choose a reason for hiding this comment

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

Also, update README table. Keep both README and selection_sort.cpp in the same commit.

selection_sort/Cpp/selection_sort.cpp Show resolved Hide resolved
@yashasingh yashasingh force-pushed the selection_sort branch 6 times, most recently from c44dc5e to 517f959 Compare October 30, 2018 07:36
@yashasingh
Copy link
Member Author

@sangamcse Please review!

Copy link
Member

@sangamcse sangamcse left a comment

Choose a reason for hiding this comment

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

Everything is fine except one in the README and your commit head is more than 50 characters and commit body is more than 72 characters. Make them correct

README.md Outdated Show resolved Hide resolved
@yashasingh yashasingh force-pushed the selection_sort branch 3 times, most recently from 3bc37ea to ecb4e10 Compare October 30, 2018 12:15
@yashasingh
Copy link
Member Author

@sangamcse I have updated the commit message but regarding the redundant issue in README.md, the line was already poor indented. Updating the same reflects it as a bigger change.
you may refer README.md line 28 to notice the indentation.

@sangamcse
Copy link
Member

Create one issue about README table. That will become one newcomer issue. And for this issue, remove the extra blank line that you have added. :)

@yashasingh
Copy link
Member Author

@sangamcse Required changes have been made. Please review 🙂

README.md Outdated
@@ -71,4 +71,4 @@ Feel free to contact us at our [Gitter channel](https://gitter.im/NITSkmOS/algo)
## Notes

Only project maintainers should merge a PR.
Other members can add their reviews to a PR but the merging should be done by only a project maintainer.
Other members can add their reviews to a PR but the merging should be done by only a project maintainer.
Copy link
Member

Choose a reason for hiding this comment

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

Now, what happened with this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

This must have happened since this branch had conflicts due to prior merging of other PRs.

@sangamcse
Copy link
Member

Also, rebase your branch

Implementation of Cpp selection sort for NITSkmOS/Algorithms.

closes NITSkmOS#482
@yashasingh
Copy link
Member Author

@sangamcse Branch rebased. Please review. 🙂

@sangamcse
Copy link
Member

ack a5277bd

@sangamcse
Copy link
Member

@sangamcse ff

@sangamcse
Copy link
Member

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️

@sangamcse
Copy link
Member

Automated fastforward with GitMate.io was successful! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Algo] Selection sort [Cpp]
3 participants