In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you what are the characteristics of the binary search tree, the code is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The characteristic of the binary search tree is that for each node X in the tree, all the key values in the left subtree are less than the key values of X, while all the key values in the right subtree are greater than the key values of X. according to this property, traverse a binary tree in the middle order, if it is monotonously increasing, it can be proved that the tree is a binary search tree.
Characteristics of binary search tree
The characteristics of the binary search tree: for each node X in the tree, all the key values in its left subtree are less than the key values of X, while all the key values in its right subtree are greater than the key values of X.
According to this property, a binary tree is traversed in the middle order. if it is monotonously increasing, it can be shown that the tree is a binary search tree.
Search of binary search tree
Procedure: first compare with the root node and return if it is equal to the root node. If it is less than the root node, look in the left subtree of the root node. If it is larger than the root node, look in the right subtree of the root node.
/ * find whether the tree with t as the root node contains x * / Position Find (ElementType x, SearchTree t) {if (t = = NULL) {return NULL;} else if (x)
< t->Element) {return Find (x, t-> left);} else if (x > t-> element) {return Find (x, t-> right);} else {return t;}} what are the characteristics of the binary search tree? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.