add zig codes for Section 'Space Complexity' and 'Space Time Tradeoff'

This commit is contained in:
sjinzh
2023-01-09 19:31:45 +08:00
parent 97ee638d31
commit 2d461b03a4
6 changed files with 292 additions and 44 deletions
+20
View File
@@ -0,0 +1,20 @@
// File: ListNode.zig
// Created Time: 2023-01-07
// Author: sjinzh (sjinzh@gmail.com)
const std = @import("std");
// Definition for a singly-linked list node
pub fn ListNode(comptime T: type) type {
return struct {
const Self = @This();
val: T = 0,
next: ?*Self = null,
// Initialize a list node with specific value
pub fn init(self: *Self, x: i32) void {
self.val = x;
}
};
}