"Data Structure" a brief talk on the comparison between binary method and two-fork sort tree BST Lookup

Source: Internet
Author: User
binary search:"on the basis of an ordered array through the binary method to narrow the scope of the search until the hit or query failed." "Storage requirements for dichotomy: order storage is required to facilitate random access to the time efficiency of the binary method according to subscript: O (Log (n)) the spatial efficiency of the dichotomy: in situ query O (1) The binary method corresponding to the search tree is determined. Two fork Sort Tree lookup:search with a binary sort tree, but because the tree itself is not necessarily axially symmetric, each comparison does not ensure that half the range is reduced. "Binary Tree Storage requirements: the need for tree structure, compared to sequential storage needs to occupy more space, but also has a flexible link-type data structure can be expanded somewhat. The time complexity of binary sorting tree lookups: On average, O (Log (n)), but in the case of a single tree it becomes a sequential traversal of the search, and the complexity is degraded to O (n). The spatial complexity of the binary tree: Because of the need to establish a sort binary tree, so the spatial complexity of O (n) insertion node of the average time complexity of O (Logn), but here we mainly talk about finding, so the rest of the conversation. In order to reduce the complexity of the time, a two-fork balance tree was created to optimize the binary tree lookup. Here is a frequently mentioned concept-find length, divided into failure to find the length, the success of finding the length, that is, in order to find the results need to be done by the number of elements compared to the corresponding search tree and tree height to analyze.

"Data Structure" a brief talk on the comparison between binary method and two-fork sort tree BST Lookup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.