search
HomeCommon ProblemWhat is a binary search tree

What is a binary search tree

Jun 29, 2020 am 10:03 AM
binary search tree

Binary search tree is also called binary search tree or binary sorting tree. A binary search tree is organized as a binary tree and can be represented by a linked list data structure, in which each node is An object; generally, in addition to key and satellite data, each node also contains attributes lchild, rchild and parent.

What is a binary search tree

Binary Search Tree (Binary Search Tree), (also: binary search tree, binary sorting tree) it is either an empty tree, or is a binary tree with the following properties: If its left subtree is not empty, then the values ​​of all nodes on the left subtree are less than the value of its root node; If its right subtree is not empty, then the values ​​of all nodes on the right subtree are less than the value of its root node. The values ​​of all nodes are greater than the value of its root node; its left and right subtrees are also binary sorted trees respectively. As a classic data structure, binary search tree has the characteristics of fast insertion and deletion operations of linked lists, and the advantage of fast search of arrays. Therefore, it is widely used. For example, it is generally used in file systems and database systems. Data structures perform efficient sorting and retrieval operations.

Principle

Binary search tree (BST) is also called binary search tree or binary sorting tree. A binary search tree is organized as a binary tree and can be represented by a linked list data structure, in which each node is an object. Generally, in addition to key and satellite data, each node also contains attributes lchild, rchild, and parent, which point to the node's left child, right child, and parents (parent nodes) respectively. If a child node or parent node does not exist, the value of the corresponding attribute is NIL. The root node is the only node in the tree whose parent pointer is NIL, and the child node pointers of leaf nodes are also NIL.

Structure

Binary search tree is a data structure that can efficiently perform the following operations.

1. Insert a value

2. Query whether a certain value is included

3. Delete a certain value

The above is the detailed content of What is a binary search tree. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment