Exercicio Complexidade de Algoritmos completo + desafios #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exercicio 1
Resposta 1
Complexidade: O(n)
Exercicio 2
Resposta 2
Complexidade O(n)
Exercicio 3
Resposta 3
Complexidade O(2)
Obs: Evaluação do if é um ciclo do processador, igualmente como o throw new Error ou adicionar o valor na matriz, então para mim
a complexidade é 2, e não 1 como o gabarito.
Exercicio 4
Resposta 4
Complexidade O(N^2)
Exercicio 5 e Resposta
Mais eficiente primeiro
DESAFIOS
Exercicio 6
Resposta 6
Complexidade: O(b)
Exercicio 7
Resposta 7
Complexidade: O(1)
Exercicio 8
Resposta 8
Complexidade: O(n^2)