A parent node calculation method and device based on a nested interval tree structure
By using a nested interval tree structure to calculate the parent node, and leveraging the binary shift principle and the nested interval theorem, the left and right values of the parent node are directly calculated. This solves the problem of increasing computational time complexity with the index in existing technologies, and achieves efficient parent node calculation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA NUCLEAR POWER ENGINEERING COMPANY LTD
- Filing Date
- 2023-02-02
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, when calculating parent nodes in nuclear power design file trees, the time consumption increases significantly as the index of child file nodes increases, affecting algorithm performance.
A parent node calculation method based on a nested interval tree structure is adopted. By utilizing the binary shift principle and the nested interval theorem, the left and right values of the parent file node are directly calculated by obtaining the information and index of the child file node, thus avoiding loop search.
This significantly reduces the computation time complexity of the parent node, making it independent of the node index size, with a time complexity of O(1), thus greatly improving computational performance.
Smart Images

Figure CN116244260B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of document processing, and more specifically, to a method and apparatus for calculating parent nodes based on a nested interval tree structure. Background Technology
[0002] A tree structure refers to a data structure where data elements have a one-to-many hierarchical relationship; it is a special type of directed acyclic graph (DAG). It can express complex data types, including nested, duplicate, and missing values, and is an important type of non-linear data. As a fundamental data structure, tree structures have important applications in many fields. They can be used to express departmental relationships, product classifications, employee reporting hierarchies, file trees, etc. Generally, there are two tree structure models to handle this infinitely hierarchical non-linear relationship: the hierarchical recursive model and the tree coding model. The tree coding model encodes and indexes tree nodes using algorithms, making the time complexity of node queries nearly O(1), and has been widely used in business scenarios requiring deposits.
[0003] In the nuclear power design cloud storage system, a nested interval model is used to construct the nuclear power design file tree. The most critical technical aspect of this nested interval model-based nuclear power design file tree structure is obtaining the nested interval code of the parent file node through the nested interval code of the child file node. This technique is the fundamental method for all tree-based operations.
[0004] The current approach uses a nested interval model to construct a nuclear power plant design file tree. In a sub-file tree rooted at a certain node, the index of the rightmost sub-file node is defined as 1, and the indices of nodes from right to left increase by 1. Nested interval encoding of file nodes is achieved using a pair of rational numbers. The core idea of the algorithm is to start from a sub-file node and find the parent file node by continuously moving horizontally towards the depth-first aggregation point of its preceding sibling node using a loop. The time complexity of the entire algorithm is O(n). When the index of a sub-file node is very large, the time consumption of the entire parent node solution process will increase significantly, severely impacting the performance of this basic algorithm. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a method and apparatus for calculating parent nodes based on a nested interval tree structure, in order to address the deficiencies of the prior art.
[0006] The technical solution adopted by this invention to solve its technical problem is: to construct a parent node calculation method based on a nested interval tree structure, including the following steps:
[0007] Get the node information of the sub-file nodes;
[0008] The index of the sub-file node is determined based on the node information of the sub-file node;
[0009] Based on the index of the sub-file node and the principle of binary shift, calculate the node left value of the parent file node;
[0010] Calculate the right value of the parent file node based on its left value.
[0011] In the parent node calculation method based on nested interval tree structure described in this invention, the node information of the sub-file node includes: the node left value of the sub-file node;
[0012] Determining the index of the sub-file node based on its node information includes:
[0013] Based on the node left value of the sub-file node, obtain the numerator of the node left value of the sub-file node;
[0014] Perform a binary conversion on the numerator of the node left value of the sub-file node to obtain the binary expression of the numerator of the node left value of the sub-file node;
[0015] Calculate the number of trailing zeros in the binary expression of the numerator of the node left value of the sub-file node; the number of trailing zeros is the index of the sub-file node.
[0016] In the parent node calculation method based on a nested interval tree structure described in this invention, the step of calculating the left value of the parent file node according to the index of the child file node and the binary shift principle includes:
[0017] Based on the index of the child file node and the principle of binary shift, calculate the left denominator of the node left value of the parent file node;
[0018] Based on the binary shift principle, calculate the numerator of the left value of the parent file node;
[0019] The node left value of the parent file node is obtained based on the left value numerator and the left value denominator.
[0020] In the parent node calculation method based on nested interval tree structure described in this invention, the binary shift principle is: the binary shift principle of multiplication and division;
[0021] The step of calculating the left-value denominator of the parent file node's left-value based on the index of the child file node and the principle of binary shifting includes:
[0022] The left-value denominator of the left-value of the parent file node is obtained by calculating based on the index of the sub-file node, the binary shift principle of multiplication and division, and the second nested interval theorem between the sub-file node and the parent file node.
[0023] In the parent node calculation method based on nested interval tree structure described in this invention, the binary shift principle is: the binary shift principle of multiplication and division;
[0024] The step of calculating the left numerator of the parent file node's left value based on the binary shift principle includes:
[0025] Based on the binary shift principle of multiplication and division, and combined with the second nested interval theorem between child file nodes and parent file nodes, the left-value numerator of the node left value of the parent file node is obtained.
[0026] In the parent node calculation method based on nested interval tree structure described in this invention, the step of calculating the right value of the parent file node based on the left value of the parent file node includes:
[0027] Based on the first nested interval theorem between child file nodes and parent file nodes, the node rvalue of the parent file node is obtained by combining the lvalue numerator and the lvalue denominator.
[0028] In the parent node calculation method based on nested interval tree structure described in this invention, the method further includes:
[0029] By using mathematical induction, we obtained the first nested interval theorem and the second nested interval theorem.
[0030] The present invention also provides a parent node calculation device based on a nested interval tree structure, comprising:
[0031] The acquisition unit is used to acquire node information of sub-file nodes;
[0032] An index determination unit is used to determine the index of the sub-file node based on the node information of the sub-file node;
[0033] The first calculation unit is used to calculate the node left value of the parent file node based on the index of the sub-file node and the binary shift principle.
[0034] The second calculation unit is used to calculate the right value of the parent file node based on the left value of the parent file node.
[0035] In the parent node computing device based on nested interval tree structure described in this invention, the node information of the child file node includes: the node left value of the child file node;
[0036] The index determination unit includes:
[0037] The molecule determination module is used to obtain the molecule of the node left value of the sub-file node based on the node left value of the sub-file node;
[0038] The conversion module is used to perform binary conversion on the numerator of the node left value of the sub-file node to obtain the binary expression of the numerator of the node left value of the sub-file node;
[0039] The index calculation module is used to calculate the number of trailing zeros in the binary expression of the numerator of the node left value of the sub-file node; the number of trailing zeros is the index of the sub-file node.
[0040] In the parent node computing device based on a nested interval tree structure described in this invention, the first computing unit includes:
[0041] The left-value denominator calculation module is used to calculate the left-value denominator of the node left value of the parent file node based on the index of the child file node and the binary shift principle.
[0042] The lvalue numerator calculation module is used to calculate the lvalue numerator of the node lvalue of the parent file node according to the binary shift principle.
[0043] The node lvalue calculation module is used to obtain the node lvalue of the parent file node based on the lvalue numerator and the lvalue denominator.
[0044] In the parent node computing device based on nested interval tree structure described in this invention, the binary shift principle is: the binary shift principle of multiplication and division;
[0045] The left-value denominator calculation module is specifically used for:
[0046] The left-value denominator of the left-value of the parent file node is obtained by calculating based on the index of the sub-file node, the binary shift principle of multiplication and division, and the second nested interval theorem between the sub-file node and the parent file node.
[0047] In the parent node computing device based on nested interval tree structure described in this invention, the binary shift principle is: the binary shift principle of multiplication and division;
[0048] The l-value numerator calculation module is specifically used for:
[0049] Based on the binary shift principle of multiplication and division, and combined with the second nested interval theorem between child file nodes and parent file nodes, the left-value numerator of the node left value of the parent file node is obtained.
[0050] In the parent node computing device based on a nested interval tree structure described in this invention, the second computing unit is specifically used for:
[0051] Based on the first nested interval theorem between child file nodes and parent file nodes, the node rvalue of the parent file node is obtained by combining the lvalue numerator and the lvalue denominator.
[0052] In the parent node computing device based on the nested interval tree structure described in this invention, mathematical induction is used for analysis to obtain the first nested interval theorem and the second nested interval theorem.
[0053] The present invention also provides a storage medium storing a computer program adapted for loading by a processor to execute the steps of the parent node calculation method based on a nested interval tree structure as described above.
[0054] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the parent node calculation method based on a nested interval tree structure as described above by calling the computer program stored in the memory.
[0055] The parent node calculation method and apparatus based on a nested interval tree structure of the present invention have the following beneficial effects: It includes the following steps: obtaining the node information of the child file node; determining the index of the child file node based on the node information; calculating the left-hand value of the parent file node based on the index of the child file node and the binary shift principle; and calculating the right-hand value of the parent file node based on the left-hand value of the parent file node. The present invention can directly determine the index of the child file node based on the node information of the child file node, and then calculate the left-hand and right-hand values of the parent file node based on the index of the child file node. The entire calculation process of the parent file node is independent of the node index size, does not require iterative forward searching, has very low time complexity, and significantly reduces the solution time for the parent file node. Attached Figure Description
[0056] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:
[0057] Figure 1 This is a flowchart illustrating the parent node calculation method based on a nested interval tree structure provided in this embodiment of the invention.
[0058] Figure 2 This is a schematic diagram of solving the parent file node according to an embodiment of the present invention;
[0059] Figure 3 This is a schematic diagram comparing the effects of the present invention with the original nested interval parent node solution method;
[0060] Figure 4 This is a schematic diagram of the parent node computing device based on a nested interval tree structure provided in an embodiment of the present invention. Detailed Implementation
[0061] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0062] refer to Figure 1 This invention provides a preferred embodiment of a parent node calculation method based on a nested interval tree structure. This method utilizes the binary principles of scalar multiplication and division to propose a binary shift-based parent node calculation method. This method can quickly calculate the index of a child file node and the left and right values of its parent file node based on the left and right values of the child file node. Here, "nested interval tree structure" refers to a tree structure based on nested interval encoding. In this embodiment, the nested interval encoding is a pair of rational numbers [(lft_num) / (lft_den), (rgt_num) / (rgt_den)]. (lft_num) / (lft_den) is called the node's left value, (rgt_num) / (rgt_den) is called the node's right value, and [(lft_num) / (lft_den), (rgt_num) / (rgt_den)] is called the node's nested interval encoding.
[0063] Specifically, such as Figure 1 As shown, the parent node calculation method based on a nested interval tree structure includes the following steps:
[0064] Step S101: Obtain the node information of the sub-file node.
[0065] Optionally, in this embodiment of the invention, the node information of the sub-file node includes: the node left value of the sub-file node. The node left value of the sub-file node is a known value and can be directly obtained using existing methods, such as directly retrieving it from a database or obtaining it directly from a relevant storage system. The node left value of the sub-file node includes: the numerator (num) and the denominator (den) of the node left value.
[0066] Step S102: Determine the index of the sub-file node based on the node information of the sub-file node.
[0067] Optionally, in this embodiment of the invention, determining the index of a sub-file node based on its node information includes: obtaining the numerator of the sub-file node's left-hand value based on the left-hand value of the sub-file node; performing a binary conversion on the numerator of the sub-file node's left-hand value to obtain a binary expression of the numerator of the sub-file node's left-hand value; and calculating the number of trailing zeros in the binary expression of the numerator of the sub-file node's left-hand value. The number of trailing zeros represents the index of the sub-file node.
[0068] Specifically, first, after obtaining the left-hand value of the sub-file node, the numerator of the left-hand value is converted to binary to obtain the binary expression of the numerator (num) of the left-hand value of the sub-file node. Then, the number of trailing zeros in the binary expression is calculated to obtain the index of the sub-file node. The index of this sub-file node can be set to n0.
[0069] Step S103: Calculate the left value of the parent file node based on the index of the child file node and the principle of binary shift.
[0070] Optionally, in this embodiment of the invention, calculating the node left value of the parent file node based on the index of the child file node and the principle of binary shift includes: calculating the left value denominator of the node left value of the parent file node based on the index of the child file node and the principle of binary shift; calculating the left value numerator of the node left value of the parent file node based on the principle of binary shift; and obtaining the node left value of the parent file node based on the left value numerator and the left value denominator.
[0071] The binary shift principle referred to in the embodiments of the present invention is the binary shift principle of multiplication and division.
[0072] In some embodiments, the calculation of the left-value denominator of the left-value of the parent file node, based on the index of the child file node and the principle of binary shift, includes: calculating the left-value denominator of the left-value of the parent file node based on the index of the child file node, the principle of binary shift of multiplication and division, and in conjunction with the second nested interval theorem between the child file node and the parent file node.
[0073] Optionally, in this embodiment of the invention, the second nested interval theorem between the child file node and the parent file node satisfies:
[0074] If the left value of the child file node is: (2 i ×b+1) / (2 i ×a), where i represents the index of the child file node in its sibling nodes, with the index of the first sibling node on the right being 1, and so on, i = 1, 2, 3, 4... ), then the left value of its parent file node is b.
[0075] a
[0076] Specifically, based on the binary shift principle of multiplication and division and the second nested interval theorem, the denominator of the left-hand side of the parent file node can be obtained as: Furthermore, by using the principle of binary division, we can obtain:
[0077] a = den >> n0.
[0078] In some embodiments, the calculation of the left-value numerator of the node left value of the parent file node according to the binary shift principle includes: calculating the left-value numerator of the node left value of the parent file node based on the binary shift principle of multiplication and division, combined with the second nested interval theorem between the child file node and the parent file node.
[0079] Specifically, based on the binary shift principle of multiplication and division and the second nested interval theorem, the left-value numerator of the parent file node's left-value is: Furthermore, by using the principle of binary division, we can obtain:
[0080] b = (num-1) >> n0.
[0081] Step S104: Calculate the right value of the parent file node based on the left value of the parent file node.
[0082] Optionally, in this embodiment of the invention, calculating the node r-value of the parent file node based on the node l-value of the parent file node includes: calculating the node r-value of the parent file node by combining the l-value numerator and l-value denominator according to the first nested interval theorem between the child file node and the parent file node.
[0083] Specifically, based on the first nested interval theorem, and combining the numerator and denominator of the parent file node's left-value obtained in step S103, the right-value of the parent file node can be calculated. The right-value of the parent file node is:
[0084] The first nested interval theorem satisfies:
[0085] If the left value of the node is Then its right value must be Where a and b are both positive integers, a is even, b is odd, and a = 2. n n = 1, 2, 3...
[0086] In this embodiment of the invention, it can be understood as performing a left shift operation of b by i bits. Since b is an odd number, the value of i can be obtained by directly determining how many zeros are at the end of the binary representation of the left-shifted number. Then, by applying the first and second nested interval theorems, combined with the rules of left shift operations, the left and right values of the parent file node can be calculated. For example, as... Figure 2 As shown, given the left-hand value of subfile node 1.4, the left-hand and right-hand values of parent file node 1 can be directly obtained using the second nested interval theorem and the first nested interval theorem, without needing to search forward step by step. The time complexity of the entire calculation is O(1). It should be noted that a time complexity of O(1) indicates that the time complexity of this algorithm is constant, meaning that the algorithm is very fast. Figure 2 In this context, Root refers to the root file node, which is the root node of the file tree.
[0087] Furthermore, in this embodiment of the invention, the first nested interval theorem and the second nested interval theorem can be obtained by using mathematical induction.
[0088] Specifically, according to the nested interval model, the left value of a node in the node encoding must be less than its right value. Since a, b, and d are all positive integers, they can all be represented as after finding a common denominator. Based on this, and using mathematical induction, we can derive the first nested interval theorem and the second nested interval theorem. The specific analysis process is as follows:
[0089] Let the parent file node be encoded as The encoding of the nth sub-file node is
[0090] 1) When n=1, according to the nested interval algorithm, it is the same as the depth-first aggregation point. The midpoint between two points, i.e. This is clearly true.
[0091] 2) When n=2, according to the nested interval algorithm, the breadth-first search points of the previous child file node and the parent file node are... The midpoint, i.e. This is clearly true.
[0092] 3) Assume this holds true when n = k, that is, the encoding of the kth sub-file node is: When n = k + 1, the encoding of the sub-file node is the previous sibling node. Breadth-first search of the parent file node The midpoint, i.e. Established.
[0093] Therefore, for n∈N (n≥1), n and N are both positive integers. If the parent node is encoded as... The encoding of the nth sub-file node is: Furthermore, as can be seen from the above, the numerators of the parent file node codes differ by d after common denominator division, and the numerators of the child file node codes also differ by d. In particular, when d = 1, we can obtain the first nested interval theorem and the second nested interval theorem.
[0094] like Figure 3 As shown, a comparative experiment was conducted on the performance of the Binary-shifted Parent Calculation Algorithm (BSPC) method (i.e., this invention) and the original nested interval parent file node solution method on a full N-way design file tree. The experiment tested the time consumption and technical effectiveness of the BSPC method and the original solution method when performing parent file node lookup operations in file tree structures with different numbers of branches and different levels. Figure 3 As shown.
[0095] Depend on Figure 3 It can be seen that the BSPC method of this invention maintains a constant time consumption as the file node index increases. Starting from file node index 6, the original algorithm requires calculating more projection points to gradually approach the parent file node as the index depth increases, and the time consumption increases approximately linearly. The BSPC method, however, can complete the calculation in near O(1) time complexity using mathematical formulas combined with the binary shift principle, while maintaining a basically constant time consumption. Its computational performance is far superior to existing solutions, making it a high-performance method for finding the parent file node. Figure 3 In the diagram, the horizontal axis represents either the depth of the tree or the index of a node. The tree depth indicates the number of children a node has, and the node index indicates its position within its sibling nodes.
[0096] refer to Figure 4 The present invention provides a parent node calculation device based on a nested interval tree structure, which can be used to implement the parent node calculation method based on a nested interval tree structure disclosed in the embodiments of the present invention.
[0097] Specifically, such as Figure 4 As shown, the parent node computing device based on a nested interval tree structure includes:
[0098] The acquisition unit 401 is used to acquire the node information of the sub-file nodes.
[0099] Optionally, in this embodiment of the invention, the node information of the sub-file node includes: the node left value of the sub-file node. The node left value of the sub-file node is a known value and can be obtained directly using existing methods, such as calling it directly from a database or obtaining it directly from a relevant storage system.
[0100] The index determination unit 402 is used to determine the index of the sub-file node based on the node information of the sub-file node.
[0101] Optionally, in this embodiment of the invention, the index determination unit includes: a numerator determination module, used to obtain the numerator of the left value of the sub-file node based on the left value of the sub-file node; a conversion module, used to perform binary conversion on the numerator of the left value of the sub-file node to obtain the binary expression of the numerator of the left value of the sub-file node; and an index calculation module, used to calculate the number of trailing zeros in the binary expression of the numerator of the left value of the sub-file node; the number of trailing zeros is the index of the sub-file node.
[0102] Specifically, first, after obtaining the left-hand value of the sub-file node, the numerator of the left-hand value is converted to binary to obtain the binary expression of the numerator (num) of the left-hand value of the sub-file node. Then, the number of trailing zeros in the binary expression is calculated to obtain the index of the sub-file node. The index of this sub-file node can be set to n0.
[0103] The first calculation unit 403 is used to calculate the node left value of the parent file node based on the index of the child file node and the principle of binary shift.
[0104] Optionally, in this embodiment of the invention, the first calculation unit 403 includes: an lvalue denominator calculation module, used to calculate the lvalue denominator of the node lvalue of the parent file node according to the index of the child file node and the binary shift principle; an lvalue numerator calculation module, used to calculate the lvalue numerator of the node lvalue of the parent file node according to the binary shift principle; and a node lvalue calculation module, used to obtain the node lvalue of the parent file node according to the lvalue numerator and the lvalue denominator.
[0105] The binary shift principle referred to in the embodiments of the present invention is the binary shift principle of multiplication and division.
[0106] In some embodiments, the left-value denominator calculation module is specifically used to: calculate the left-value denominator of the parent file node's node left value based on the index of the child file node, the binary shift principle of multiplication and division, and in conjunction with the second nested interval theorem between the child file node and the parent file node.
[0107] Optionally, in this embodiment of the invention, the second nested interval theorem between the child file node and the parent file node satisfies:
[0108] If the left value of the child file node is: (2 i ×b+1) / (2 i ×a), where i represents the index of the child file node within its sibling nodes, with the index of the first sibling node to the right being 1, and so on, i = 1, 2, 3, 4... ), then the left value of its parent file node is...
[0109] Specifically, based on the binary shift principle of multiplication and division and the second nested interval theorem, the denominator of the left-hand side of the parent file node can be obtained as: Furthermore, by using the principle of binary division, we can obtain:
[0110] a = den >> n0.
[0111] In some embodiments, the lvalue numerator calculation module is specifically used to: calculate the lvalue numerator of the node lvalue of the parent file node based on the binary shift principle of multiplication and division, and in conjunction with the second nested interval theorem between the child file node and the parent file node.
[0112] Specifically, based on the binary shift principle of multiplication and division and the second nested interval theorem, the left-value numerator of the parent file node's left-value is: Furthermore, by using the principle of binary division, we can obtain:
[0113] b = (num-1) >> n0.
[0114] The second calculation unit 404 is used to calculate the right value of the parent file node based on the left value of the parent file node.
[0115] In some embodiments, the second calculation unit 404 is specifically used to: calculate the node rvalue of the parent file node by combining the lvalue numerator and lvalue denominator according to the first nested interval theorem between the child file node and the parent file node.
[0116] Specifically, based on the first nested interval theorem, and combining the previously calculated numerator and denominator of the parent file node's left-hand value, the right-hand value of the parent file node can be obtained. The right-hand value of the parent file node is:
[0117] The first nested interval theorem satisfies:
[0118] If the left value of a node is b, then its right value must be b. Where a and b are both positive integers, a is even, b is odd, and a = 2. n n = 1, 2, 3...
[0119] In this embodiment of the invention, 2 i At the computer's underlying level, ×b can be understood as shifting b left by i bits. Since b is an odd number, the value of i can be obtained by directly determining how many zeros are at the end of the binary representation of the shifted number. Then, by applying the first and second nested interval theorems, combined with the rules of left shift operations, the left and right values of the parent file node can be calculated.
[0120] It should be noted that the specific cooperative operation process between the units in the parent node computing device based on the nested interval tree structure can be referred to the parent node computing method based on the nested interval tree structure mentioned above, and will not be repeated here.
[0121] Furthermore, an electronic device according to the present invention includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to implement the parent node calculation method based on a nested interval tree structure as described above. Specifically, according to embodiments of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method shown in the flowchart. In such embodiments, when the computer program is downloaded, installed, and executed by an electronic device, it performs the functions defined in the method of the embodiments of the present invention. The electronic device in the present invention can be a terminal such as a laptop, desktop computer, tablet computer, or smartphone, or it can be a server.
[0122] Furthermore, one type of storage medium of the present invention stores a computer program thereon, which, when executed by a processor, implements the parent node calculation method based on a nested interval tree structure as described above. Specifically, it should be noted that the storage medium described above in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0123] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0124] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0125] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0126] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0127] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They do not limit the scope of protection of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should fall within the scope of the claims of the present invention.
Claims
1. A method for calculating parent nodes based on a nested interval tree structure, characterized in that, Includes the following steps: Get the node information of the sub-file nodes; The node information of the sub-file node includes: the node left value of the sub-file node; The index of the sub-file node is determined based on the node information of the sub-file node; The left-hand value of the parent file node is calculated based on the index of the child file node and the principle of binary shifting. This calculation includes: using the index of the child file node, the principle of binary shifting for multiplication and division, and combining this with the second nested interval theorem between the child and parent file nodes to obtain the left-hand denominator of the parent file node's left-hand value; and using the principle of binary shifting for multiplication and division, and combining this with the second nested interval theorem between the child and parent file nodes to obtain the left-hand numerator of the parent file node's left-hand value. The second nested interval theorem between the child file node and the parent file node satisfies: If the left value of the child file node is: (2) i ×b+1) / ( 2 i × a In the expression, i represents the index of a child file node within its sibling nodes, with the index of the first sibling node to the right being 1, and so on, i = 1, 2, 3, 4... Then the leftmost value of its parent file node is... ; Calculate the right value of the parent file node based on its left value.
2. The parent node calculation method based on nested interval tree structure according to claim 1, characterized in that, Determining the index of the sub-file node based on its node information includes: Based on the node left value of the sub-file node, obtain the numerator of the node left value of the sub-file node; Perform a binary conversion on the numerator of the node left value of the sub-file node to obtain the binary expression of the numerator of the node left value of the sub-file node; Calculate the number of trailing zeros in the binary expression of the numerator of the node left value of the sub-file node; the number of trailing zeros is the index of the sub-file node.
3. The parent node calculation method based on nested interval tree structure according to claim 1, characterized in that, The step of calculating the right value of the parent file node based on the left value of the parent file node includes: Based on the first nested interval theorem between child file nodes and parent file nodes, the node rvalue of the parent file node is obtained by combining the lvalue numerator and the lvalue denominator. The first nested interval theorem satisfies: If the left value of the node is Then its right value is Where a and b are both positive integers, a is even, b is odd, and a = 2. n , n = 1, 2, 3...
4. The parent node calculation method based on nested interval tree structure according to claim 3, characterized in that, The method further includes: By using mathematical induction, the first nested interval theorem and the second nested interval theorem are obtained.
5. A parent node computing device based on a nested interval tree structure, characterized in that, include: The acquisition unit is used to acquire node information of sub-file nodes; The node information of the sub-file node includes: the node left value of the sub-file node; An index determination unit is used to determine the index of the sub-file node based on the node information of the sub-file node; The first calculation unit is used to calculate the node left value of the parent file node based on the index of the child file node and the binary shift principle. The calculation of the node left value of the parent file node based on the index of the child file node and the binary shift principle includes: calculating the denominator of the node left value of the parent file node based on the index of the child file node, the binary shift principle of multiplication and division, and the second nested interval theorem between the child file node and the parent file node; and calculating the numerator of the node left value of the parent file node based on the binary shift principle of multiplication and division and the second nested interval theorem between the child file node and the parent file node. The second nested interval theorem between the child file node and the parent file node satisfies: If the left value of the child file node is: (2) i ×b+1) / ( 2 i × a In the expression, i represents the index of a child file node within its sibling nodes, with the index of the first sibling node to the right being 1, and so on, i = 1, 2, 3, 4... Then the leftmost value of its parent file node is... ; The second calculation unit is used to calculate the right value of the parent file node based on the left value of the parent file node.
6. The parent node computing device based on a nested interval tree structure according to claim 5, characterized in that, The index determination unit includes: The molecule determination module is used to obtain the molecule of the node left value of the sub-file node based on the node left value of the sub-file node; The conversion module is used to perform binary conversion on the numerator of the node left value of the sub-file node to obtain the binary expression of the numerator of the node left value of the sub-file node; The index calculation module is used to calculate the number of trailing zeros in the binary expression of the numerator of the node left value of the sub-file node; the number of trailing zeros is the index of the sub-file node.
7. The parent node computing device based on a nested interval tree structure according to claim 5, characterized in that, The second computing unit is specifically used for: Based on the first nested interval theorem between child file nodes and parent file nodes, the node rvalue of the parent file node is obtained by combining the lvalue numerator and the lvalue denominator. The first nested interval theorem satisfies: If the left value of the node is Then its right value is Where a and b are both positive integers, a is even, b is odd, and a = 2. n , n = 1, 2, 3...
8. The parent node computing device based on a nested interval tree structure according to claim 7, characterized in that, By using mathematical induction, the first nested interval theorem and the second nested interval theorem are obtained.
9. A storage medium, characterized in that, The storage medium stores a computer program adapted for loading by a processor to perform the steps of the parent node calculation method based on a nested interval tree structure as described in any one of claims 1 to 4.
10. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the parent node calculation method based on a nested interval tree structure as described in any one of claims 1 to 4 by calling the computer program stored in the memory.