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 Counting Sort [C#] #612

Merged
merged 16 commits into from
Dec 15, 2017
Merged

Added Counting Sort [C#] #612

merged 16 commits into from
Dec 15, 2017

Conversation

DimaMukhin
Copy link
Contributor

Fixes #611

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 coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {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 the Travis build 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.

@singhpratyush
Copy link
Member

Hi! Thanks for showing interest in contributing to this repository.

Please make sure that you have ticked the points mentioned in PR description correctly.

Thanks again!

Copy link
Member

@aashutoshrathi aashutoshrathi left a comment

Choose a reason for hiding this comment

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

See comments 😄

/// Space Complexity: O(n + k)
/// </summary>
/// <param name="arr">The original unsorted array</param>
/// <returns>The sorted array</returns>
Copy link
Member

Choose a reason for hiding this comment

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

Make it one block comment instead.

sortedArr[frequency[arr[i]] - 1] = arr[i];
frequency[arr[i]]--;
}

Copy link
Member

Choose a reason for hiding this comment

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

no need of blank line here

{
int[] arr = new int[10000];
Random rand = new Random();
for (int i = 0; i < arr.Length; i++)
Copy link
Member

Choose a reason for hiding this comment

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

Check Counting sort in other languages, try not to use Random and hardcode the input values.

int arr[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};

@singhpratyush singhpratyush merged commit 4cec987 into iiitv:master Dec 15, 2017
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.

Counting Sort [C#]
4 participants