Skip to content

Commit e7877bb

Browse files
committed
refactor algorithms
1 parent 87b92a4 commit e7877bb

File tree

10 files changed

+10
-9
lines changed

10 files changed

+10
-9
lines changed

algorithms/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ _lib = { path = "../_lib" }
1010
# =========================[ Searching Algorithms ]=============================
1111
[[bin]]
1212
name = "linear_search"
13-
path = "searching/linear_search.rs"
13+
path = "src/searching/linear_search.rs"
1414
[[bin]]
1515
name = "binary_search"
16-
path = "searching/binary_search.rs"
16+
path = "src/searching/binary_search.rs"
1717
# ==========================[ Sorting Algorithms ]==============================
1818
[[bin]]
1919
name = "bubble_sort"
20-
path = "sorting/bubble_sort.rs"
20+
path = "src/sorting/bubble_sort.rs"
2121

2222
[[bin]]
2323
name = "selection_sort"
24-
path = "sorting/selection_sort.rs"
24+
path = "src/sorting/selection_sort.rs"
2525

2626
[[bin]]
2727
name = "insertion_sort"
28-
path = "sorting/insertion_sort.rs"
28+
path = "src/sorting/insertion_sort.rs"
2929

3030
[[bin]]
3131
name = "quick_sort"
32-
path = "sorting/quick_sort.rs"
32+
path = "src/sorting/quick_sort.rs"
3333
# ===========================[ Greedy Algorithms ]==============================
3434
[[bin]]
3535
name = "huffman"
36-
path = "greedy/huffman_coding.rs"
36+
path = "src/greedy/huffman_coding.rs"
3737

3838
[[bin]]
3939
name = "kruskal"
40-
path = "greedy/kruskal.rs"
40+
path = "src/greedy/kruskal.rs"
File renamed without changes.

algorithms/greedy/huffman_coding.rs renamed to algorithms/src/greedy/huffman_coding.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ impl Huffman {
160160

161161
fn main() {
162162
let mut hm = Huffman::new();
163-
println!("{:?}", hm.encode("SENSELESSNESS")); //RESULT: 01110101110011001011100
163+
let source = "SENSELESSNESS";
164+
println!("source: {source}\nencoded: {:?}", hm.encode(source)); //RESULT: 01110101110011001011100
164165
}
165166

166167
#[cfg(test)]
File renamed without changes.

0 commit comments

Comments
 (0)