51
Dev开发社区
首页
文章
问答
工具
搜索
登录
注册
#TREE
104. Maximum Depth of Binary Tree
104.MaximumDepthofBinaryTreeEasyGivenabinarytree,finditsmaximumdepth.Themaximumdepthisthenumberofnodesalongthelongestpathfromtherootnodedowntothefarthestleafnod...
代码星球
·
2021-02-08
104.
Maximum
Depth
of
Binary
102. Binary Tree Level Order Traversal 广度优先遍历
Givenabinarytree,returnthelevelordertraversalofitsnodes'values.(ie,fromlefttoright,levelbylevel).Forexample:Givenbinarytree[3,9,20,null,null,15,7],3/920/157&nbs...
代码星球
·
2021-02-08
102.
Binary
Tree
Level
Order
BFS广度优先 vs DFS深度优先 for Binary Tree
https://www.geeksforgeeks.org/bfs-vs-dfs-binary-tree/WhatareBFSandDFSforBinaryTree?ATreeistypicallytraversedintwoways:BreadthFirstTraversal(OrLevelOrderTraversa...
代码星球
·
2021-02-08
优先
BFS
广度
vs
DFS
108. Convert Sorted Array to Binary Search Tree
https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Givenanarraywhereelementsaresortedinascendingorder,convertittoaheightbalancedBST.Forthi...
代码星球
·
2021-02-08
108.
Convert
Sorted
Array
to
111. Minimum Depth of Binary Tree
Givenabinarytree,finditsminimumdepth.Theminimumdepthisthenumberofnodesalongtheshortestpathfromtherootnodedowntothenearestleafnode.Note: Aleafisanodewithnoc...
代码星球
·
2021-02-08
111.
Minimum
Depth
of
Binary
110. Balanced Binary Tree
Givenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedas:/abinarytreeinwhichthedepthofthetwosubtreesofeverynodenever...
代码星球
·
2021-02-08
110.
Balanced
Binary
Tree
BinaryTree
publicclassTreeNode{publicintval;publicTreeNodeleft;publicTreeNoderight;publicTreeNode(intx){val=x;}}打印代码privatevoidWriteTreeNode(TreeNodenode){StringBuil...
代码星球
·
2021-02-08
BinaryTree
226. Invert Binary Tree
Invertabinarytree.Example:Input:4/27//1369Output:4/72//9631Trivia:ThisproblemwasinspiredbythisoriginaltweetbyMaxHowell:/Google:90%ofourengineersusethesoftwareyo...
代码星球
·
2021-02-08
226.
Invert
Binary
Tree
235. Lowest Common Ancestor of a Binary Search Tree
Givenabinarysearchtree(BST),findthelowestcommonancestor(LCA)oftwogivennodesintheBST.AccordingtothedefinitionofLCAonWikipedia:“Thelowestcommonancestorisdef...
代码星球
·
2021-02-08
235.
Lowest
Common
Ancestor
of
257. Binary Tree Paths
Givenabinarytree,returnallroot-to-leafpaths.Note: Aleafisanodewithnochildren.Example:Input:1/235Output:["1->2->5","1->3"]Explanation:Allroot-to-le...
代码星球
·
2021-02-08
257.
Binary
Tree
Paths
501. Find Mode in Binary Search Tree
Givenabinarysearchtree(BST)withduplicates,findallthe mode(s) (themostfrequentlyoccurredelement)inthegivenBST.AssumeaBSTisdefinedasfollows:Theleftsubtr...
代码星球
·
2021-02-08
501.
Find
Mode
in
Binary
538. Convert BST to Greater Tree
GivenaBinarySearchTree(BST),convertittoaGreaterTreesuchthateverykeyoftheoriginalBSTischangedtotheoriginalkeyplussumofallkeysgreaterthantheoriginalkeyinBST.Examp...
代码星球
·
2021-02-08
538.
Convert
BST
to
Greater
543. Diameter of Binary Tree
Givenabinarytree,youneedtocomputethelengthofthediameterofthetree.Thediameterofabinarytreeisthelengthofthelongestpathbetweenanytwonodesinatree.Thispathmayormayno...
代码星球
·
2021-02-08
543.
Diameter
of
Binary
Tree
HashSet非常的消耗空间,TreeSet因为有排序功能,因此资源消耗非常的高,我们应该尽量少使用
注:HashMap底层也是用数组,HashSet底层实际上也是HashMap,HashSet类中有HashMap属性(我们如何在API中查属性)。HashSet实际上为(key.null)类型的HashMap。有key值而没有value值。 正因为以上的原因,TreeSet和TreeMap的实现也有些类似的关...
代码星球
·
2021-02-08
非常
消耗
HashSet
空间
TreeSet
linux下tree命令产生乱码,通过修改字符集解决
aliastree='tree--charsetASCII' ...
代码星球
·
2021-02-03
linux
tree
命令
产生
乱码
首页
上一页
...
4
5
6
7
8
...
下一页
尾页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他