二叉搜索树

概述

二叉搜索树,是一种特殊形式的二叉树。

二叉搜索树的特性如下:

  • 每个节点的值,必须大于或等于>= 其左子树中的任何值,且小于或等于<= 其右子树中的任何值

    从中序遍历(inorder)遍历的角度看,通过中序遍历得到的是一个递增的有序序列。

    例如,[1,2,3,4,5,6,7]

  • (上面特性包含这条)所有左子树和右子树自身也必须是二叉搜索树。

学习目的:

  1. 理解二叉搜索树的特性;
  2. 熟悉在二叉搜索树中的基本操作;
  3. 理解高度平衡二叉搜索树(height-balanced binary search tree)的概念

这是判断是否为BST题目中,solution中的一个讨论里的回答

1
2
3
Heap is a BT not a BST.
in Heap, value of each node in lesser than value of its children.
in BST, value of each node is between the values of its children.

binary search tree(BST), binary tree(BT)

98.Validate Binary Search Tree

(54) Learn one iterative inorder traversal, apply it to multiple tree questions (Java Solution) - LeetCode Discuss

  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2022-2023 ligongzhao
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信