X Tutup
Skip to content

A few improvments of counting sort#409

Merged
christianbender merged 2 commits intoTheAlgorithms:masterfrom
nikitap492:master
Apr 9, 2018
Merged

A few improvments of counting sort#409
christianbender merged 2 commits intoTheAlgorithms:masterfrom
nikitap492:master

Conversation

@nikitap492
Copy link
Copy Markdown
Contributor

@nikitap492 nikitap492 commented Apr 6, 2018

Added the counting sort method which uses stream API
Changed the original sorting method: creating and throwing an exception it costs much more then using getOrDefault for a map

Changed the original sorting method: creating and throwing an exception it costs then using getOrDefault for a map
Copy link
Copy Markdown

@christianbender christianbender left a comment

Choose a reason for hiding this comment

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

Good Work! I have some requests


// Filling the sortedArray
for(Map.Entry<T, Integer> element : frequency.entrySet()) {
public static <T extends Comparable<T>> List<T> CS(List<T> list) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please change the name of the method according to naming conventions in java.


// Filling the sortedArray
for(Map.Entry<T, Integer> element : frequency.entrySet()) {
for(int j=0; j<element.getValue(); j++)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please use curly braces.

Added curly braces for the loop
@nikitap492
Copy link
Copy Markdown
Contributor Author

Great! I've fulfilled your requests

@christianbender christianbender merged commit 1880817 into TheAlgorithms:master Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup