51
Dev开发社区
首页
文章
问答
工具
搜索
登录
注册
#Binary
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
543. Diameter of Binary Tree
Givenabinarytree,youneedtocomputethelengthofthediameterofthetree.Thediameterofabinarytreeisthelengthofthelongestpathbetweenanytwonodesinatree.Thispathmayormayno...
代码星球
·
2021-02-08
543.
Diameter
of
Binary
Tree
自己实现数据结构系列五---BinarySearchTree
一.二分搜索树:1.代码:publicclassBST<EextendsComparable<E>>{privateclassNode{publicEe;publicNodeleft;publicNoderight;publicNode(Ee){this.e=e;left=null;right=...
代码星球
·
2021-01-30
自己
实现
数据结构
系列
---BinarySearchTree
二叉树BinaryTree构建测试(无序)
此测试仅用于二叉树基本的性质测试,不包含插入、删除测试(此类一般属于有序树基本操作)。//二叉树树类publicclassBinaryTree{publicTreeNoderoot;//有一个根节点publicstaticintindex;publicTreeNodeCreateBTree(int[]a){Tree...
代码星球
·
2021-01-24
二叉
BinaryTree
构建
测试
无序
leetcode 654. Maximum Binary Tree
Givenanintegerarraywithnoduplicates.Amaximumtreebuildingonthisarrayisdefinedasfollow:Therootisthemaximumnumberinthearray.Theleftsubtreeisthemaximumtreeconstruct...
代码星球
·
2021-01-23
leetcode
654.
Maximum
Binary
Tree
convert decimal to binary
publicclassSolution{publicstaticvoidmain(String[]args){intdNum=1264;Stringstr="";while(dNum>0){intrem=dNum%2;str=rem+str;dNum=dNum/2;}System.out.printl...
代码星球
·
2020-11-02
convert
decimal
to
binary
convert decimal to binary using inbuilt function
packagetestpacknm;importjava.util.Scanner;publicclasstestcnm{publicstaticvoidmain(String[]args){intdNum=5;System.out.println("Binaryis:"+Integer.toBinaryS...
代码星球
·
2020-11-02
convert
decimal
to
binary
using
650. Find Leaves of Binary Tree
classSolution{public:vector<vector<int>>findLeaves(TreeNode*root){vector<vector<int>>res;while(root){vector<int>leaves...
代码星球
·
2020-10-13
650.
Find
Leaves
of
Binary
首页
上一页
1
2
3
4
5
...
下一页
尾页
按字母分类:
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
其他