Skip to content

Instantly share code, notes, and snippets.

@izeye
izeye / CountingSorter.java
Created February 17, 2012 16:42
Counting Sort (Java Version)
public class CountingSorter implements Sorter {
private final int maxValue;
public CountingSorter(int maxValue) {
this.maxValue = maxValue;
}
@Override
public int[] sort(int[] values) {
int[] counts = new int[maxValue + 1];
@izeye
izeye / CountingSortBasedRankingService.java
Created February 17, 2012 14:25
Study/Algorithm/SpringSprout/Telepathy/Quiz 1. Ranking Service/Counting Sort-based Ranking Service
package study.algorithm.telepathy.sort.quiz.problem1;
public class CountingSortBasedRankingService implements RankingService {
private final int maxScore;
public CountingSortBasedRankingService(int maxScore) {
this.maxScore = maxScore;
}
@Override