-
Notifications
You must be signed in to change notification settings - Fork 497
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
Conversation
Update fork
merge origin into forked master
Counting sort c#
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments 😄
counting_sort/CountingSort.cs
Outdated
/// Space Complexity: O(n + k) | ||
/// </summary> | ||
/// <param name="arr">The original unsorted array</param> | ||
/// <returns>The sorted array</returns> |
There was a problem hiding this comment.
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.
counting_sort/CountingSort.cs
Outdated
sortedArr[frequency[arr[i]] - 1] = arr[i]; | ||
frequency[arr[i]]--; | ||
} | ||
|
There was a problem hiding this comment.
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
counting_sort/CountingSort.cs
Outdated
{ | ||
int[] arr = new int[10000]; | ||
Random rand = new Random(); | ||
for (int i = 0; i < arr.Length; i++) |
There was a problem hiding this comment.
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.
algos/counting_sort/counting_sort.c
Line 32 in 63ac50b
int arr[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; |
Code refactoring based on PR feedback
origin to fork
Fixes #611
By submitting this pull request I confirm I've read and complied with the below declarations.
Added {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.