-
Notifications
You must be signed in to change notification settings - Fork 13
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
Adiciona implementação para o RadixSort #13
base: master
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
private static int getDigit(int N, int 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.
n
} | ||
|
||
private static int getDigit(int N, int i) { | ||
return (int) (N / Math.pow(10, i - 1)) % 10; |
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.
n
. usar padrão de java para nomear variáveis.
|
||
public class RadixSort { | ||
|
||
public static void radixSort(int[] v) { |
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.
vamos fazer esses métodos pertencer à abstração RadixSort. Tira os static
de todos eles.
|
||
private static int getMax(int[] v) { | ||
// Considerando que não vamos receber número inteiros < 0 | ||
int max = -1; |
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.
melhor começar considerando o maior o primeiro elemento do array e fazer o for de 1 até o final.
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.
Comentários no código. Cadê os testes? :)
-> In god we probably trust. All others must bring tests. |
Devo fazer os testes em um main mesmo usando asserts ou crio uma classe de testes com Junit? Caso seja usando o Junit, devo criar a estrutura de diretório reservadas pros testes, certo? |
Isso! |
Código com a implementação do RadixSort.