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

View File

@@ -0,0 +1,21 @@
// File: TreeNode.zig
// Created Time: 2023-01-07
// Author: sjinzh (sjinzh@gmail.com)
const std = @import("std");
// Definition for a binary tree node
pub fn TreeNode(comptime T: type) type {
return struct {
const Self = @This();
val: T = undefined,
left: ?*Self = null,
right: ?*Self = null,
// Initialize a tree node with specific value
pub fn init(self: *Self, x: i32) void {
self.val = x;
}
};
}