In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to understand the tree in programming". The content in the article is simple and clear, and it is easy to learn and understand. let's follow the editor's train of thought to study and learn how to understand the tree in programming.
Tree
Tree is a very commonly used data structure, which keeps pace with linear tables and stacks.
Definition of tree
Tree is abstracted from nature. It refers to a finite set of N parent and child nodes. For this finite set, the following conditions need to be met:
When Numb0, the node collection is empty and the tree is empty.
In any non-empty tree, there can be only one root node
When N > 1, the other nodes that are unexpected to the node are also gathered to form a tree. That is, a tree is recursive, a tree is made up of several subtrees, and each tree is made up of several smaller subtrees, as shown in the figure
Binary tree
A binary tree is an ordered tree in which each node can only have at most two subtrees. Usually the left subtree is called the left subtree and the right tree is called the right subtree. A binary tree can only have two symmetrical trees at most, and a binary tree can be divided into left and right. The difference between a tree and a binary tree
1. There is no limit on the degree of the nodes of the tree, the binary tree is limited to 2, and the tree has no limit.
two。 The nodes of the unordered tree are not divided into left and right, while the nodes of binary tree are divided into left and right.
Binary search tree
Binary search tree is an empty tree. A binary tree with the following properties is called binary search tree.
Its left subtree is not empty, and all node values of the left subtree are less than the values of the following nodes.
If its right subtree is not empty, the value of all nodes in the right subtree is greater than the value of the following node.
Its left and right subtrees are binary sorting trees respectively.
Balanced binary tree
A balanced binary tree has the following properties: it is an accusation or the absolute height difference between its left and right subtrees is not more than 1, and both left and right subtrees are a balanced binary tree. The nodes of balanced binary tree are red-black tree, AVL tree, stretching tree, and the node of minimum binary balanced tree is F (n) = F (nmur1) + F (nmur2) + 1.
B-tree
An m-order B tree, which is a balanced m-path search tree, or an empty tree, satisfies the following properties
1 root node has at least two children
Each non-follower node contains 1 element of k Mel and k children, of which m prime 2
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.