PT-BR | Resolução de desafios de algoritmos do HackerRank e Leetcode utilizando Java.
ENGLISH-USA | Solved HackerRank and Leetcode algorithm challenges using Java.
- Solve me First
- Simple Array Sum
- Diagonal Difference
- Extra Long Factorials
- SHA-256
- Queue using Two Stacks
- Array - DS
- Print in Reverse
- Quick Sort 1 - Partition
- Merge Strings Alternately
- Number of Recent Calls
- Invert Binary Tree
- Palindrome Number
- Fibonacci Number
- Sort An Array
- Find the Town Judge
- Maximum Depth of Binary Tree
- Binary Search
- Reverse Linked List
Algoritmo | Complexidade de Tempo (Melhor Caso) | Complexidade de Tempo (Médio Caso) | Complexidade de Tempo (Pior Caso) |
---|---|---|---|
Bubble Sort | O(n) | O(n^2) | O(n^2) |
Insertion Sort | O(n) | O(n^2) | O(n^2) |
Selection Sort | O(n^2) | O(n^2) | O(n^2) |
Merge Sort | O(n log n) | O(n log n) | O(n log n) |
Quick Sort | O(n log n) | O(n log n) | O(n^2) |
Heap Sort | O(n log n) | O(n log n) | O(n log n) |
Counting Sort | O(n + k) | O(n + k) | O(n + k) |
Radix Sort | O(nk) | O(nk) | O(nk) |
Bucket Sort | O(n + k) | O(n + k) | O(n^2) |
Binary Search | O(1) | O(log n) | O(log n) |
Depth-First Search (DFS) | O(V + E) | O(V + E) | O(V + E) |
Breadth-First Search (BFS) | O(V + E) | O(V + E) | O(V + E) |
Dijkstra's Algorithm | O(V^2) | O(V^2) | O(V^2) |
Bellman-Ford Algorithm | O(VE) | O(VE) | O(VE) |
Floyd-Warshall Algorithm | O(V^3) | O(V^3) | O(V^3) |
Greedy Algorithm | O(n log n) | O(n log n) | O(n log n) |
Legenda:
n
é o número de elementos na entrada.k
é o intervalo dos números na entrada.V
é o número de vértices.E
é o número de arestas.