In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What are the uses of binary trees? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Binary tree can be used to realize binary search tree and binary heap. In computer science, binary tree is a tree structure with at most two subtrees at each node, which is usually called "left subtree" and "right subtree". According to different uses, it can be divided into: 1, complete binary tree; 2, full binary tree; 3, balanced binary tree.
Binary trees are often used to implement binary search trees and binary heaps.
In computer science, a binary tree is a tree structure with at most two subtrees per node. Subtrees are usually called "left subtrees" and "right subtrees".
According to different uses, it can be divided into:
1. Complete binary tree-if the height of the binary tree is h, the number of nodes in all layers (1~h-1) reaches the maximum except the h layer. There are leaf nodes in the h layer, and the leaf nodes are arranged from left to right. This is the complete binary tree.
2. Full binary tree-A binary tree in which every node except the leaf node has left and right cotyledons and the leaf node is at the bottom.
3. Balanced binary tree-balanced binary tree is also known as AVL tree (different from AVL algorithm). It is a binary sorting tree with the following properties: it is an empty tree or the absolute value of the height difference between its left and right subtrees is not more than 1, and the left and right subtrees are both balanced binary trees.
Extended data
The binary tree with depth h has at most one node (h > = 1) and at least h nodes. For any binary tree, if the number of leaf nodes is N0 and the total number of nodes with degree 2 is N2, then N0=N2+1.
If each node of a complete binary tree with N nodes is stored sequentially, then the relationship between the nodes is as follows: if I is the node number, if I > 1, then the parent node number is I _ (_) _ (2). If 2*IN, there is no left child. If 2*I+1
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.