Greyson左手的Blog
Greyson左手的Blog
首页
简历
项目
多人协同看电影
miniOS-一个Web端的操作系统
算法
考研
Github
主页
多人协同看电影
easysports高校体育综合平台
miniOS
登录
包含标签 二叉树 的文章
第六章 二叉树part09
2024-4-27
0 条评论
算法
算法基础
二叉树
Greyson
669. 修剪二叉搜索树 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } 3 1 4 2 */ func trimBST(root *TreeNode, ...
第六章 二叉树part08
2024-4-24
0 条评论
算法
算法基础
二叉树
Greyson
235. 二叉搜索树的最近公共祖先 func lowestCommonAncestor(root, p, q *TreeNode) *TreeNode { if p.Val > q.Val { return lowestCommonAncestor(root, q, p) } rootVal := root.Val lVal := p...
第六章 二叉树 part05
2024-4-20
0 条评论
算法
算法基础
二叉树
Greyson
513.找树左下角的值 先序遍历 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ var depth int var res int var maxDep int fu...
第六章 二叉树part04
2024-4-19
0 条评论
算法
算法基础
二叉树
Greyson
110.平衡二叉树 递归 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func getDept(root *TreeNode) int { if root =...
第六章 二叉树part03
2024-4-18
0 条评论
算法
算法基础
二叉树
Greyson
104.二叉树的最大深度 二叉树 /** * Definition for a Node. * type Node struct { * Val int * Children []*Node * } */ var res int var dept int func dfs(root *Node) { if root == nil { retu...
第六章 二叉树 part02
2024-4-17
0 条评论
算法
算法基础
二叉树
Greyson
二叉树层序遍历登场! 二叉树的层序遍历 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ var q []*TreeNode var head int var ...
第六章 二叉树part01
2024-4-16
0 条评论
算法
算法基础
二叉树
Greyson
二叉树的递归遍历 二叉树的递归遍历 二叉树的统一迭代法
×