zig : upgrade codes && rust : add codes for chapter_searching and chapter_dynamic_programming. (#591)

* zig : update zig codes

* rust : add codes for linear_search and hashing_search

* rust : add codes for linear_search and hashing_search

* rust : add codes for chapter_dynamic_programming
This commit is contained in:
sjinzh
2023-07-10 01:32:12 +08:00
committed by GitHub
parent 6c133d42d5
commit 459449d41a
21 changed files with 485 additions and 187 deletions
@@ -31,7 +31,7 @@ pub fn main() !void {
var map = std.AutoHashMap(i32, i32).init(std.heap.page_allocator);
defer map.deinit();
for (nums, 0..) |num, i| {
try map.put(num, @intCast(i32, i)); // key: 元素,value: 索引
try map.put(num, @as(i32, @intCast(i))); // key: 元素,value: 索引
}
var index = hashingSearchArray(i32, map, target);
std.debug.print("目标元素 3 的索引 = {}\n", .{index});