2023-01-02 21:48:32 +08:00
|
|
|
// swift-tools-version: 5.7
|
|
|
|
|
|
|
|
import PackageDescription
|
|
|
|
|
|
|
|
let package = Package(
|
|
|
|
name: "HelloAlgo",
|
|
|
|
products: [
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_computational_complexity
|
2023-01-02 21:48:32 +08:00
|
|
|
.executable(name: "time_complexity", targets: ["time_complexity"]),
|
|
|
|
.executable(name: "worst_best_time_complexity", targets: ["worst_best_time_complexity"]),
|
|
|
|
.executable(name: "space_complexity", targets: ["space_complexity"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_array_and_linkedlist
|
2023-01-05 21:16:05 +08:00
|
|
|
.executable(name: "array", targets: ["array"]),
|
2023-01-08 20:22:59 +08:00
|
|
|
.executable(name: "linked_list", targets: ["linked_list"]),
|
2023-01-08 23:44:13 +08:00
|
|
|
.executable(name: "list", targets: ["list"]),
|
|
|
|
.executable(name: "my_list", targets: ["my_list"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_stack_and_queue
|
2023-01-09 23:02:22 +08:00
|
|
|
.executable(name: "stack", targets: ["stack"]),
|
|
|
|
.executable(name: "linkedlist_stack", targets: ["linkedlist_stack"]),
|
|
|
|
.executable(name: "array_stack", targets: ["array_stack"]),
|
2023-01-11 23:48:10 +08:00
|
|
|
.executable(name: "queue", targets: ["queue"]),
|
|
|
|
.executable(name: "linkedlist_queue", targets: ["linkedlist_queue"]),
|
|
|
|
.executable(name: "array_queue", targets: ["array_queue"]),
|
2023-01-14 01:06:00 +08:00
|
|
|
.executable(name: "deque", targets: ["deque"]),
|
2023-02-23 23:03:33 +08:00
|
|
|
.executable(name: "linkedlist_deque", targets: ["linkedlist_deque"]),
|
|
|
|
.executable(name: "array_deque", targets: ["array_deque"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_hashing
|
2023-01-17 00:02:23 +08:00
|
|
|
.executable(name: "hash_map", targets: ["hash_map"]),
|
|
|
|
.executable(name: "array_hash_map", targets: ["array_hash_map"]),
|
2023-07-01 20:39:55 +08:00
|
|
|
.executable(name: "hash_map_chaining", targets: ["hash_map_chaining"]),
|
|
|
|
.executable(name: "hash_map_open_addressing", targets: ["hash_map_open_addressing"]),
|
2023-07-03 16:42:49 +08:00
|
|
|
.executable(name: "simple_hash", targets: ["simple_hash"]),
|
|
|
|
.executable(name: "built_in_hash", targets: ["built_in_hash"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_tree
|
2023-01-18 21:34:44 +08:00
|
|
|
.executable(name: "binary_tree", targets: ["binary_tree"]),
|
2023-01-19 00:12:54 +08:00
|
|
|
.executable(name: "binary_tree_bfs", targets: ["binary_tree_bfs"]),
|
|
|
|
.executable(name: "binary_tree_dfs", targets: ["binary_tree_dfs"]),
|
2023-07-24 12:46:48 +08:00
|
|
|
.executable(name: "array_binary_tree", targets: ["array_binary_tree"]),
|
2023-01-27 01:52:51 +08:00
|
|
|
.executable(name: "binary_search_tree", targets: ["binary_search_tree"]),
|
2023-01-29 00:03:28 +08:00
|
|
|
.executable(name: "avl_tree", targets: ["avl_tree"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_heap
|
2023-01-29 14:03:30 +08:00
|
|
|
.executable(name: "my_heap", targets: ["my_heap"]),
|
2023-07-06 03:16:14 +08:00
|
|
|
.executable(name: "top_k", targets: ["top_k"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_graph
|
2023-02-05 15:41:23 +08:00
|
|
|
.executable(name: "graph_adjacency_matrix", targets: ["graph_adjacency_matrix"]),
|
|
|
|
.executable(name: "graph_adjacency_list", targets: ["graph_adjacency_list"]),
|
2023-02-22 19:41:31 +08:00
|
|
|
.executable(name: "graph_bfs", targets: ["graph_bfs"]),
|
|
|
|
.executable(name: "graph_dfs", targets: ["graph_dfs"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_searching
|
2023-05-21 19:26:52 +08:00
|
|
|
.executable(name: "binary_search", targets: ["binary_search"]),
|
2023-05-28 17:26:09 +08:00
|
|
|
.executable(name: "binary_search_edge", targets: ["binary_search_edge"]),
|
2023-05-09 00:36:18 +08:00
|
|
|
.executable(name: "two_sum", targets: ["two_sum"]),
|
2023-01-30 15:43:29 +08:00
|
|
|
.executable(name: "linear_search", targets: ["linear_search"]),
|
|
|
|
.executable(name: "hashing_search", targets: ["hashing_search"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_sorting
|
2023-05-28 17:51:35 +08:00
|
|
|
.executable(name: "selection_sort", targets: ["selection_sort"]),
|
2023-01-31 00:18:40 +08:00
|
|
|
.executable(name: "bubble_sort", targets: ["bubble_sort"]),
|
|
|
|
.executable(name: "insertion_sort", targets: ["insertion_sort"]),
|
|
|
|
.executable(name: "quick_sort", targets: ["quick_sort"]),
|
|
|
|
.executable(name: "merge_sort", targets: ["merge_sort"]),
|
2023-05-29 12:20:32 +08:00
|
|
|
.executable(name: "heap_sort", targets: ["heap_sort"]),
|
2023-03-30 01:59:14 +08:00
|
|
|
.executable(name: "bucket_sort", targets: ["bucket_sort"]),
|
2023-03-23 02:57:13 +08:00
|
|
|
.executable(name: "counting_sort", targets: ["counting_sort"]),
|
2023-01-31 00:18:40 +08:00
|
|
|
.executable(name: "radix_sort", targets: ["radix_sort"]),
|
2023-05-03 18:45:43 +08:00
|
|
|
// chapter_backtracking
|
|
|
|
.executable(name: "preorder_traversal_i_compact", targets: ["preorder_traversal_i_compact"]),
|
|
|
|
.executable(name: "preorder_traversal_ii_compact", targets: ["preorder_traversal_ii_compact"]),
|
|
|
|
.executable(name: "preorder_traversal_iii_compact", targets: ["preorder_traversal_iii_compact"]),
|
|
|
|
.executable(name: "preorder_traversal_iii_template", targets: ["preorder_traversal_iii_template"]),
|
2023-05-04 05:31:06 +08:00
|
|
|
.executable(name: "permutations_i", targets: ["permutations_i"]),
|
|
|
|
.executable(name: "permutations_ii", targets: ["permutations_ii"]),
|
2023-07-08 05:27:40 +08:00
|
|
|
.executable(name: "subset_sum_i_naive", targets: ["subset_sum_i_naive"]),
|
|
|
|
.executable(name: "subset_sum_i", targets: ["subset_sum_i"]),
|
|
|
|
.executable(name: "subset_sum_ii", targets: ["subset_sum_ii"]),
|
2023-05-15 01:13:17 +08:00
|
|
|
.executable(name: "n_queens", targets: ["n_queens"]),
|
2023-07-18 12:49:03 +08:00
|
|
|
// chapter_dynamic_programming
|
|
|
|
.executable(name: "climbing_stairs_backtrack", targets: ["climbing_stairs_backtrack"]),
|
|
|
|
.executable(name: "climbing_stairs_dfs", targets: ["climbing_stairs_dfs"]),
|
|
|
|
.executable(name: "climbing_stairs_dfs_mem", targets: ["climbing_stairs_dfs_mem"]),
|
|
|
|
.executable(name: "climbing_stairs_dp", targets: ["climbing_stairs_dp"]),
|
|
|
|
.executable(name: "min_cost_climbing_stairs_dp", targets: ["min_cost_climbing_stairs_dp"]),
|
|
|
|
.executable(name: "climbing_stairs_constraint_dp", targets: ["climbing_stairs_constraint_dp"]),
|
|
|
|
.executable(name: "min_path_sum", targets: ["min_path_sum"]),
|
|
|
|
.executable(name: "knapsack", targets: ["knapsack"]),
|
|
|
|
.executable(name: "unbounded_knapsack", targets: ["unbounded_knapsack"]),
|
|
|
|
.executable(name: "coin_change", targets: ["coin_change"]),
|
|
|
|
.executable(name: "coin_change_ii", targets: ["coin_change_ii"]),
|
|
|
|
.executable(name: "edit_distance", targets: ["edit_distance"]),
|
2023-01-02 21:48:32 +08:00
|
|
|
],
|
|
|
|
targets: [
|
2023-02-22 19:41:31 +08:00
|
|
|
// helper
|
2023-01-02 21:48:32 +08:00
|
|
|
.target(name: "utils", path: "utils"),
|
2023-02-22 19:41:31 +08:00
|
|
|
.target(name: "graph_adjacency_list_target", dependencies: ["utils"], path: "chapter_graph", sources: ["graph_adjacency_list_target.swift"], swiftSettings: [.define("TARGET")]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_computational_complexity
|
2023-01-02 21:48:32 +08:00
|
|
|
.executableTarget(name: "time_complexity", path: "chapter_computational_complexity", sources: ["time_complexity.swift"]),
|
|
|
|
.executableTarget(name: "worst_best_time_complexity", path: "chapter_computational_complexity", sources: ["worst_best_time_complexity.swift"]),
|
|
|
|
.executableTarget(name: "space_complexity", dependencies: ["utils"], path: "chapter_computational_complexity", sources: ["space_complexity.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_array_and_linkedlist
|
2023-01-05 21:16:05 +08:00
|
|
|
.executableTarget(name: "array", path: "chapter_array_and_linkedlist", sources: ["array.swift"]),
|
2023-01-08 20:22:59 +08:00
|
|
|
.executableTarget(name: "linked_list", dependencies: ["utils"], path: "chapter_array_and_linkedlist", sources: ["linked_list.swift"]),
|
2023-01-08 23:44:13 +08:00
|
|
|
.executableTarget(name: "list", path: "chapter_array_and_linkedlist", sources: ["list.swift"]),
|
|
|
|
.executableTarget(name: "my_list", path: "chapter_array_and_linkedlist", sources: ["my_list.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_stack_and_queue
|
2023-01-09 23:02:22 +08:00
|
|
|
.executableTarget(name: "stack", path: "chapter_stack_and_queue", sources: ["stack.swift"]),
|
|
|
|
.executableTarget(name: "linkedlist_stack", dependencies: ["utils"], path: "chapter_stack_and_queue", sources: ["linkedlist_stack.swift"]),
|
|
|
|
.executableTarget(name: "array_stack", path: "chapter_stack_and_queue", sources: ["array_stack.swift"]),
|
2023-01-11 23:48:10 +08:00
|
|
|
.executableTarget(name: "queue", path: "chapter_stack_and_queue", sources: ["queue.swift"]),
|
|
|
|
.executableTarget(name: "linkedlist_queue", dependencies: ["utils"], path: "chapter_stack_and_queue", sources: ["linkedlist_queue.swift"]),
|
|
|
|
.executableTarget(name: "array_queue", path: "chapter_stack_and_queue", sources: ["array_queue.swift"]),
|
2023-01-14 01:06:00 +08:00
|
|
|
.executableTarget(name: "deque", path: "chapter_stack_and_queue", sources: ["deque.swift"]),
|
2023-02-23 23:03:33 +08:00
|
|
|
.executableTarget(name: "linkedlist_deque", path: "chapter_stack_and_queue", sources: ["linkedlist_deque.swift"]),
|
|
|
|
.executableTarget(name: "array_deque", path: "chapter_stack_and_queue", sources: ["array_deque.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_hashing
|
2023-01-17 00:02:23 +08:00
|
|
|
.executableTarget(name: "hash_map", dependencies: ["utils"], path: "chapter_hashing", sources: ["hash_map.swift"]),
|
2023-07-01 20:39:55 +08:00
|
|
|
.executableTarget(name: "array_hash_map", dependencies: ["utils"], path: "chapter_hashing", sources: ["array_hash_map.swift"]),
|
|
|
|
.executableTarget(name: "hash_map_chaining", dependencies: ["utils"], path: "chapter_hashing", sources: ["hash_map_chaining.swift"]),
|
|
|
|
.executableTarget(name: "hash_map_open_addressing", dependencies: ["utils"], path: "chapter_hashing", sources: ["hash_map_open_addressing.swift"]),
|
2023-07-03 16:42:49 +08:00
|
|
|
.executableTarget(name: "simple_hash", path: "chapter_hashing", sources: ["simple_hash.swift"]),
|
|
|
|
.executableTarget(name: "built_in_hash", dependencies: ["utils"], path: "chapter_hashing", sources: ["built_in_hash.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_tree
|
2023-01-18 21:34:44 +08:00
|
|
|
.executableTarget(name: "binary_tree", dependencies: ["utils"], path: "chapter_tree", sources: ["binary_tree.swift"]),
|
2023-01-19 00:12:54 +08:00
|
|
|
.executableTarget(name: "binary_tree_bfs", dependencies: ["utils"], path: "chapter_tree", sources: ["binary_tree_bfs.swift"]),
|
|
|
|
.executableTarget(name: "binary_tree_dfs", dependencies: ["utils"], path: "chapter_tree", sources: ["binary_tree_dfs.swift"]),
|
2023-07-24 12:46:48 +08:00
|
|
|
.executableTarget(name: "array_binary_tree", dependencies: ["utils"], path: "chapter_tree", sources: ["array_binary_tree.swift"]),
|
2023-01-27 01:52:51 +08:00
|
|
|
.executableTarget(name: "binary_search_tree", dependencies: ["utils"], path: "chapter_tree", sources: ["binary_search_tree.swift"]),
|
2023-01-29 00:03:28 +08:00
|
|
|
.executableTarget(name: "avl_tree", dependencies: ["utils"], path: "chapter_tree", sources: ["avl_tree.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_heap
|
2023-01-29 14:03:30 +08:00
|
|
|
.executableTarget(name: "my_heap", dependencies: ["utils"], path: "chapter_heap", sources: ["my_heap.swift"]),
|
2023-07-06 03:16:14 +08:00
|
|
|
.executableTarget(name: "top_k", dependencies: ["utils"], path: "chapter_heap", sources: ["top_k.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_graph
|
2023-02-05 15:41:23 +08:00
|
|
|
.executableTarget(name: "graph_adjacency_matrix", dependencies: ["utils"], path: "chapter_graph", sources: ["graph_adjacency_matrix.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
.executableTarget(name: "graph_adjacency_list", dependencies: ["utils"], path: "chapter_graph", sources: ["graph_adjacency_list.swift"]),
|
2023-02-22 19:41:31 +08:00
|
|
|
.executableTarget(name: "graph_bfs", dependencies: ["utils", "graph_adjacency_list_target"], path: "chapter_graph", sources: ["graph_bfs.swift"]),
|
|
|
|
.executableTarget(name: "graph_dfs", dependencies: ["utils", "graph_adjacency_list_target"], path: "chapter_graph", sources: ["graph_dfs.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_searching
|
2023-05-21 19:26:52 +08:00
|
|
|
.executableTarget(name: "binary_search", path: "chapter_searching", sources: ["binary_search.swift"]),
|
2023-05-28 17:26:09 +08:00
|
|
|
.executableTarget(name: "binary_search_edge", path: "chapter_searching", sources: ["binary_search_edge.swift"]),
|
2023-05-09 00:36:18 +08:00
|
|
|
.executableTarget(name: "two_sum", path: "chapter_searching", sources: ["two_sum.swift"]),
|
2023-01-30 15:43:29 +08:00
|
|
|
.executableTarget(name: "linear_search", dependencies: ["utils"], path: "chapter_searching", sources: ["linear_search.swift"]),
|
|
|
|
.executableTarget(name: "hashing_search", dependencies: ["utils"], path: "chapter_searching", sources: ["hashing_search.swift"]),
|
2023-02-21 21:35:28 +08:00
|
|
|
// chapter_sorting
|
2023-05-28 17:51:35 +08:00
|
|
|
.executableTarget(name: "selection_sort", path: "chapter_sorting", sources: ["selection_sort.swift"]),
|
2023-01-31 00:18:40 +08:00
|
|
|
.executableTarget(name: "bubble_sort", path: "chapter_sorting", sources: ["bubble_sort.swift"]),
|
|
|
|
.executableTarget(name: "insertion_sort", path: "chapter_sorting", sources: ["insertion_sort.swift"]),
|
|
|
|
.executableTarget(name: "quick_sort", path: "chapter_sorting", sources: ["quick_sort.swift"]),
|
|
|
|
.executableTarget(name: "merge_sort", path: "chapter_sorting", sources: ["merge_sort.swift"]),
|
2023-05-29 12:20:32 +08:00
|
|
|
.executableTarget(name: "heap_sort", path: "chapter_sorting", sources: ["heap_sort.swift"]),
|
2023-03-30 01:59:14 +08:00
|
|
|
.executableTarget(name: "bucket_sort", path: "chapter_sorting", sources: ["bucket_sort.swift"]),
|
2023-03-23 02:57:13 +08:00
|
|
|
.executableTarget(name: "counting_sort", path: "chapter_sorting", sources: ["counting_sort.swift"]),
|
2023-01-31 00:18:40 +08:00
|
|
|
.executableTarget(name: "radix_sort", path: "chapter_sorting", sources: ["radix_sort.swift"]),
|
2023-05-03 18:45:43 +08:00
|
|
|
// chapter_backtracking
|
|
|
|
.executableTarget(name: "preorder_traversal_i_compact", dependencies: ["utils"], path: "chapter_backtracking", sources: ["preorder_traversal_i_compact.swift"]),
|
|
|
|
.executableTarget(name: "preorder_traversal_ii_compact", dependencies: ["utils"], path: "chapter_backtracking", sources: ["preorder_traversal_ii_compact.swift"]),
|
|
|
|
.executableTarget(name: "preorder_traversal_iii_compact", dependencies: ["utils"], path: "chapter_backtracking", sources: ["preorder_traversal_iii_compact.swift"]),
|
|
|
|
.executableTarget(name: "preorder_traversal_iii_template", dependencies: ["utils"], path: "chapter_backtracking", sources: ["preorder_traversal_iii_template.swift"]),
|
2023-05-04 05:31:06 +08:00
|
|
|
.executableTarget(name: "permutations_i", path: "chapter_backtracking", sources: ["permutations_i.swift"]),
|
|
|
|
.executableTarget(name: "permutations_ii", path: "chapter_backtracking", sources: ["permutations_ii.swift"]),
|
2023-07-08 05:27:40 +08:00
|
|
|
.executableTarget(name: "subset_sum_i_naive", path: "chapter_backtracking", sources: ["subset_sum_i_naive.swift"]),
|
|
|
|
.executableTarget(name: "subset_sum_i", path: "chapter_backtracking", sources: ["subset_sum_i.swift"]),
|
|
|
|
.executableTarget(name: "subset_sum_ii", path: "chapter_backtracking", sources: ["subset_sum_ii.swift"]),
|
2023-05-15 01:13:17 +08:00
|
|
|
.executableTarget(name: "n_queens", path: "chapter_backtracking", sources: ["n_queens.swift"]),
|
2023-07-18 12:49:03 +08:00
|
|
|
// chapter_dynamic_programming
|
|
|
|
.executableTarget(name: "climbing_stairs_backtrack", path: "chapter_dynamic_programming", sources: ["climbing_stairs_backtrack.swift"]),
|
|
|
|
.executableTarget(name: "climbing_stairs_dfs", path: "chapter_dynamic_programming", sources: ["climbing_stairs_dfs.swift"]),
|
|
|
|
.executableTarget(name: "climbing_stairs_dfs_mem", path: "chapter_dynamic_programming", sources: ["climbing_stairs_dfs_mem.swift"]),
|
|
|
|
.executableTarget(name: "climbing_stairs_dp", path: "chapter_dynamic_programming", sources: ["climbing_stairs_dp.swift"]),
|
|
|
|
.executableTarget(name: "min_cost_climbing_stairs_dp", path: "chapter_dynamic_programming", sources: ["min_cost_climbing_stairs_dp.swift"]),
|
|
|
|
.executableTarget(name: "climbing_stairs_constraint_dp", path: "chapter_dynamic_programming", sources: ["climbing_stairs_constraint_dp.swift"]),
|
|
|
|
.executableTarget(name: "min_path_sum", path: "chapter_dynamic_programming", sources: ["min_path_sum.swift"]),
|
|
|
|
.executableTarget(name: "knapsack", path: "chapter_dynamic_programming", sources: ["knapsack.swift"]),
|
|
|
|
.executableTarget(name: "unbounded_knapsack", path: "chapter_dynamic_programming", sources: ["unbounded_knapsack.swift"]),
|
|
|
|
.executableTarget(name: "coin_change", path: "chapter_dynamic_programming", sources: ["coin_change.swift"]),
|
|
|
|
.executableTarget(name: "coin_change_ii", path: "chapter_dynamic_programming", sources: ["coin_change_ii.swift"]),
|
|
|
|
.executableTarget(name: "edit_distance", path: "chapter_dynamic_programming", sources: ["edit_distance.swift"]),
|
2023-01-02 21:48:32 +08:00
|
|
|
]
|
|
|
|
)
|