Skip to content

A few improvments of counting sort - #409

Merged
christianbender merged 2 commits into
TheAlgorithms:masterfrom
nikitapodsh:master
Apr 9, 2018
Merged

christianbender merged 2 commits into
TheAlgorithms:masterfrom
nikitapodsh:master

Conversation

@nikitapodsh

@nikitapodsh nikitapodsh commented Apr 6, 2018 •

Copy link
Copy Markdown
Contributor

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

@christianbender christianbender left a comment

Copy link
Copy Markdown

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

Comment thread Sorts/CountingSort.java Outdated

// 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.

Comment thread Sorts/CountingSort.java Outdated

// 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
@nikitapodsh

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