Inserting method based on tree-shaped data structure node and storing device
A data structure and storage device technology, applied in the storage field, can solve the problems of slow node insertion speed and increased node insertion time, and achieve the effect of reducing the insertion time and increasing the insertion speed
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0052] Embodiment one, such as image 3 As shown, the embodiment of the present invention provides a method for inserting nodes based on a tree data structure, including the following steps:
[0053] Step 301: Find the nearest main tree node in the main tree according to the key code value of the node to be inserted, the key code value of the above-mentioned nearest main tree node is smaller than and closest to the key code value of the node to be inserted; the root node of the above-mentioned main tree is initialized has the minimum key code value; wherein, the above-mentioned main tree includes a parent node, a left child node of the above-mentioned parent node and a right child node of the above-mentioned parent node, and the above-mentioned left child node is larger than the above-mentioned parent node, and the above-mentioned parent node is larger than the above-mentioned right child node node
[0054] In a tree, the key code value of the inserted node will take a value ...
Embodiment 2
[0085] Embodiment two, such as Figure 5 As shown, the embodiment of the present invention also provides a search method based on tree data structure nodes, which may include the following steps:
[0086] Step 501: Find the node to be searched in the main tree according to the key code value of the node to be searched; if the above-mentioned node to be searched does not exist in the main tree, then search for the nearest main tree node; the key code value of the above-mentioned nearest main tree node is less than and the closest The key code value close to the node to be inserted;
[0087] If there is a node in the main tree that has the same key code value as the node to be searched, then the node to be searched has been found, and the search process can end;
[0088] Step 502: take the slave tree pointed to by the external pointer of the nearest master tree node as the current slave tree;
[0089] Step 503: Find the node to be found in the current slave tree.
[0090] In ...
Embodiment 3
[0101] Embodiment three, such as Figure 7 As shown, the embodiment of the present invention also provides a method for deleting nodes based on a tree data structure, which may include the following steps:
[0102] Step 701: Search for the node to be deleted in the main tree according to the key code value of the node to be deleted. If the above-mentioned node to be deleted does not exist in the main tree, search for the nearest main tree node; the key code value of the above-mentioned nearest main tree node is less than and the closest Close to the key code value of the node to be deleted;
[0103] If there is a node in the main tree with the same key code value as the node to be deleted, the node to be deleted has been found at this moment, and step 704 can be directly entered;
[0104] Step 702: take the slave tree pointed to by the external pointer of the nearest master tree node as the current slave tree;
[0105] Step 703: Find the above-mentioned node to be deleted in...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com