摘要:
已知BST的前序遍历,还原BST arr数组:前序遍历 list:排序后的 arr 数组【BST的 中序遍历】 public static TreeNode getRoot(int[] arr, List<Integer> list){ int index = -1; for (int i = 0; 阅读全文
posted @ 2023-10-23 11:00
爱新觉罗LQ
阅读(20)
评论(0)
推荐(0)
摘要:
给定二叉树的前序遍历,遍历是否是 BST public static boolean isValid(int[] arr, int start, int end, int min, int max){ if (start > end){ // start > end:当前子树为空,返回 true,因 阅读全文
posted @ 2023-10-23 10:58
爱新觉罗LQ
阅读(17)
评论(0)
推荐(0)