Add figures to replace_linear_by_hashing.md

This commit is contained in:
krahets
2023-05-09 00:36:18 +08:00
parent 53ca2144e2
commit fe69f7240d
23 changed files with 85 additions and 80 deletions

View File

@ -43,7 +43,7 @@ let package = Package(
.executable(name: "graph_bfs", targets: ["graph_bfs"]),
.executable(name: "graph_dfs", targets: ["graph_dfs"]),
// chapter_searching
.executable(name: "leetcode_two_sum", targets: ["leetcode_two_sum"]),
.executable(name: "two_sum", targets: ["two_sum"]),
.executable(name: "linear_search", targets: ["linear_search"]),
.executable(name: "hashing_search", targets: ["hashing_search"]),
// chapter_sorting
@ -104,7 +104,7 @@ let package = Package(
.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"]),
// chapter_searching
.executableTarget(name: "leetcode_two_sum", path: "chapter_searching", sources: ["leetcode_two_sum.swift"]),
.executableTarget(name: "two_sum", path: "chapter_searching", sources: ["two_sum.swift"]),
.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"]),
// chapter_sorting

View File

@ -1,5 +1,5 @@
/**
* File: leetcode_two_sum.swift
* File: two_sum.swift
* Created Time: 2023-01-03
* Author: nuomi1 (nuomi1@qq.com)
*/
@ -37,7 +37,7 @@ enum LeetcodeTwoSum {
static func main() {
// ======= Test Case =======
let nums = [2, 7, 11, 15]
let target = 9
let target = 13
// ====== Driver Code ======
//
var res = twoSumBruteForce(nums: nums, target: target)