feat: add Rust theory guides (terminology, algorithms, testing, debugging) and 2 new crates
This commit is contained in:
1 parent
2e002b6176
commit
015eae08c3
14 files changed
+357
-5
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 11 — Algorytmy i Złożoność Obliczeniowa (`O(log n)`, `O(n)`)
|
||||
|
||||
Teoria: [notes/03-algorithms-and-complexity.md](../../../notes/03-algorithms-and-complexity.md)
|
||||
|
||||
## Zadania (`src/lib.rs`)
|
||||
1. `binary_search(sorted: &[i32], target: i32) -> Option<usize>` — wyszukiwanie binarne w `O(log n)`.
|
||||
2. `two_sum(nums: &[i32], target: i32) -> Option<(usize, usize)>` — znajdź parę indeksów `(i, j)` (`i < j`) dającą `nums[i] + nums[j] == target` w `O(n)` używając `HashMap`.
|
||||
3. `is_palindrome(text: &str) -> bool` — metoda **dwóch wskaźników** (*two pointers*) na znakach alfanumerycznych (lowercase, obsługa UTF-8).
|
||||
4. `max_window_sum(nums: &[i32], k: usize) -> Option<i32>` — maksymalna suma spójnego podciągu długości `k` metodą **okna przesuwnego** (*sliding window*) w `O(n)`.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=core11-algorithms
|
||||
```
|
||||
Reference in new issue
Block a user