CN109710542B - Full N-way tree construction method and device - Google Patents

Full N-way tree construction method and device Download PDF

Info

Publication number
CN109710542B
CN109710542B CN201811631948.1A CN201811631948A CN109710542B CN 109710542 B CN109710542 B CN 109710542B CN 201811631948 A CN201811631948 A CN 201811631948A CN 109710542 B CN109710542 B CN 109710542B
Authority
CN
China
Prior art keywords
memory space
node
index value
full
space address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811631948.1A
Other languages
Chinese (zh)
Other versions
CN109710542A (en
Inventor
罗树权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201811631948.1A priority Critical patent/CN109710542B/en
Publication of CN109710542A publication Critical patent/CN109710542A/en
Application granted granted Critical
Publication of CN109710542B publication Critical patent/CN109710542B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention relates to the technical field of data processing, in particular to a full N-ary tree construction method and a full N-ary tree construction device.

Description

Full N-way tree construction method and device
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a full N-ary tree construction method and device.
Background
The Cache memory is a high-speed memory added in the middle for relieving the processing speed of the processor and the access speed of the memory, the access speed of the Cache memory is higher than that of the memory, whether data to be used exists is searched in the Cache memory during calculation, if the data exists, the data in the Cache memory is used for calculation, otherwise, the data are dispatched into the Cache memory from the memory firstly and then used, if the data do not exist, the phenomenon is called Cache Missing, once the phenomenon occurs, the processor stops the current work and waits for the data to be dispatched and then executed, and therefore the high-speed operation of the processor is not facilitated. However, most of the existing Cache memories have the phenomenon of Cache Missing.
Disclosure of Invention
In view of this, the invention provides a full N-ary tree construction method and device, which can avoid the occurrence of a Cache Missing phenomenon.
The embodiment of the invention provides a full N-ary tree construction method, which comprises the following steps:
setting a corresponding index value for each node in the full N-ary tree;
calculating the number of nodes of a full N-ary tree, calculating the sum of required storage spaces of the full N-ary tree according to the number, acquiring a memory space according to the sum of the required storage spaces, and distributing the memory space to each node based on a plurality of set index values; the memory space allocated by each node is provided with a memory space address;
creating a pointer, and enabling the pointer to point to the memory space address of the root node in the full N-ary tree;
judging whether the memory space address pointed by the pointer is the same as the set memory space address, if not, searching index values of all child nodes of the root node, aiming at each searched index value, obtaining the memory space address of the child node corresponding to the index value, storing the memory space address of the child node corresponding to the index value in the memory space of the root node, and storing the memory space address of the root node in the memory space of the child node corresponding to the index value.
Optionally, the method further comprises:
enabling the pointer to point to a next memory space address, wherein an index value of a node corresponding to the next memory space address is one greater than an index value of the root node;
judging whether the next memory space address is the same as the set memory space address or not;
if not, searching index values of all child nodes of the node corresponding to the next memory space address; aiming at each searched index value, acquiring the memory space address of the child node corresponding to the index value, storing the memory space address value of the parent node of the child node corresponding to the index value in the memory space of the child node corresponding to the index value, and storing the next memory space address in the memory space of the parent node of the child node corresponding to the index value;
and if the N-branch tree is the same, judging that the full N-branch tree is constructed completely.
Optionally, the step of setting a corresponding index value for each node in the full N-ary tree includes:
acquiring the depth value of each node;
and setting index values for each node in turn according to the sequence of the depth values from small to large, and setting the index values for a plurality of nodes with the same depth values in turn according to the set sequence.
Optionally, the step of sequentially setting the index values according to a set order for a plurality of nodes with the same depth value includes:
and for a plurality of nodes with the same depth value, sequentially setting index values from left to right.
Optionally, the step of allocating the memory space to each node based on a plurality of set index values includes:
and evenly distributing the memory space to each node according to the sequence of the index values from small to large.
The embodiment of the invention also provides a full N-ary tree construction device, which comprises:
the index value setting module is used for setting a corresponding index value for each node in the full N-ary tree;
the memory space allocation module is used for calculating the number of nodes of a full N-ary tree, calculating the sum of required storage spaces of the full N-ary tree according to the number, acquiring a memory space according to the sum of the required storage spaces, and allocating the memory space to each node based on a plurality of set index values; the memory space allocated by each node is provided with a memory space address;
a pointer creating module, configured to create a pointer so that the pointer points to a memory space address of a root node in the full N-ary tree;
the judging module is used for judging whether the memory space address pointed by the pointer is the same as the set memory space address or not, if not, searching index values of all child nodes of the root node, aiming at each searched index value, obtaining the memory space address of the child node corresponding to the index value, storing the memory space address of the child node corresponding to the index value in the memory space of the root node, and storing the memory space address of the root node in the memory space of the child node corresponding to the index value.
Optionally, the apparatus further comprises:
an adjusting module, configured to enable the pointer to point to a next memory space address, where an index value of a node corresponding to the next memory space address is greater than an index value of the root node by one;
the judging module is further used for judging whether the next memory space address is the same as the set memory space address;
if not, searching index values of all child nodes of the node corresponding to the next memory space address; aiming at each searched index value, acquiring the memory space address of the child node corresponding to the index value, storing the memory space address value of the parent node of the child node corresponding to the index value in the memory space of the child node corresponding to the index value, and storing the next memory space address in the memory space of the parent node of the child node corresponding to the index value;
and if the N-branch tree is the same, judging that the full N-branch tree is constructed completely.
Optionally, the index value setting module sets a corresponding index value for each node in the full N-ary tree by:
acquiring the depth value of each node;
and setting index values for each node in turn according to the sequence of the depth values from small to large, and setting the index values for a plurality of nodes with the same depth values in turn according to the set sequence.
Optionally, the index value setting module sequentially sets the index values according to a set order for a plurality of nodes with the same depth value by:
and for a plurality of nodes with the same depth value, sequentially setting index values from left to right.
Optionally, the memory space allocation module allocates the memory space to each node based on a plurality of set index values in the following manner:
and evenly distributing the memory space to each node according to the sequence of the index values from small to large.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the above full N-ary tree construction method.
The embodiment of the invention also provides a computer-readable storage medium, which comprises a computer program, and the computer program controls the electronic equipment where the computer-readable storage medium is located to execute the full N-ary tree construction method when running.
Advantageous effects
The method and the device for constructing the full N-ary tree can calculate the sum of the required storage space of the full N-ary tree based on the number of nodes of the full N-ary tree, obtain the memory space according to the sum of the required storage space, and distribute the memory space to each node in the full N-ary tree based on a plurality of set index values, so that the memory space can be distributed at one time, the problem of excessive distribution of the memory space is solved, the memory space addresses of the root node and the child node are mutually stored based on whether the memory space address pointed by the pointer is the same as the set memory space address, the problem of over-dispersed data can be avoided, and the occurrence of Cache Missing phenomenon is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a block diagram of an electronic device 10 according to an embodiment of the present invention.
Fig. 2 is a flowchart of a full N-ary tree construction method according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of a full N-ary tree according to an embodiment of the present invention.
Fig. 4 is a block diagram of a full N-ary tree building apparatus 20 according to an embodiment of the present invention.
Icon:
10-an electronic device; 11-a memory; 12-a processor; 13-a network module;
20-full N-way tree construction means; 21-index value setting module; 22-memory space allocation module; 23-a pointer creation module; 24-a judgment module; 25-adjusting module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The tree is an important data structure in computer science, for example, a balanced N-ary tree can be used for realizing a search algorithm and improving the search efficiency, and the tree is used for dividing and managing a limited area according to a certain rule in the graphics, so that the calculation efficiency is improved.
The inventor has found through investigation that the existing full N-ary tree construction technology mostly recursively constructs its child nodes in a constructor of an N-ary tree node, and continues to construct its child nodes in its child nodes, and the child nodes of each node are constructed by itself. In the existing scheme, a memory needs to be allocated to each node separately during operation, and allocating the memory is a relatively slow operation and generates an excessive overhead. In addition, nodes are scattered in the memory, and the phenomenon of Missing of a large amount of caches due to excessive data distribution is not favorable for high-speed operation of the processor.
The above prior art solutions have shortcomings which are the results of practical and careful study of the inventor, and therefore, the discovery process of the above problems and the solutions proposed by the following embodiments of the present invention to the above problems should be the contribution of the inventor to the present invention in the course of the present invention.
Based on the research, the embodiment of the invention provides a full N-way tree construction method and device, which can effectively reduce the occurrence of Cache Missing phenomenon.
Fig. 1 shows a block diagram of an electronic device 10 according to an embodiment of the present invention. The electronic device 10 in the embodiment of the present invention has functions of data storage, transmission, and processing, and as shown in fig. 1, the electronic device 10 includes: memory 11, processor 12, network module 13 and a full N-ary tree building apparatus 20.
The memory 11, the processor 12 and the network module 13 are electrically connected directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The memory 11 stores a full N-ary tree building device 20, the full N-ary tree building device 20 includes at least one software functional module which can be stored in the memory 11 in a form of software or firmware (firmware), and the processor 12 executes various functional applications and data processing by running a software program and a module stored in the memory 11, for example, the full N-ary tree building device 20 in the embodiment of the present invention, so as to implement a full N-ary tree building method in the embodiment of the present invention.
The Memory 11 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 11 is used for storing a program, and the processor 12 executes the program after receiving an execution instruction.
The processor 12 may be an integrated circuit chip having data processing capabilities. The Processor 12 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network module 13 is used for establishing communication connection between the electronic device 10 and other communication terminal devices through a network, and implementing transceiving operation of network signals and data. The network signal may include a wireless signal or a wired signal.
It will be appreciated that the configuration shown in FIG. 1 is merely illustrative and that electronic device 10 may include more or fewer components than shown in FIG. 1 or may have a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
An embodiment of the present invention also provides a computer-readable storage medium, which includes a computer program. The computer program controls the electronic device 10 on which the readable storage medium is located to execute the following full N-ary tree construction method when running.
Fig. 2 shows a flowchart of a full N-ary tree building method according to an embodiment of the present invention. The method steps defined by the method-related flow, as applied to the electronic device 10, may be implemented by the processor 12. The specific process shown in FIG. 2 will be described in detail below:
in this embodiment, a full binary tree is taken as an example for description, and a full binary tree with a depth value of 2 is further taken as a description.
In step S21, a corresponding index value is set for each node in the full N-ary tree.
Referring to fig. 3, first, the depth value of each node is obtained according to the depthSetting index values from small to large and from left to right for the same depth value, wherein the obtained index values are as follows: i is0、I1、I2、I3、I4、I5And I6
Step S22, calculating the number of nodes of the full N-ary tree, calculating the total required storage space of the full N-ary tree according to the number, obtaining the memory space according to the total required storage space, and allocating the memory space to each node based on the set plurality of index values.
For example, if the memory space required by each node is 1MB, the total required storage space of the full N-ary tree is 7MB, and thus the acquired memory space is 7 MB.
Further, 7MB is evenly distributed to each node according to the sequence of the index values from small to large, wherein the memory space distributed by each node is provided with a memory space address.
After the memory space is classified for each node, the memory space of each node is reset to be empty.
The node index values and the corresponding memory space addresses are shown in table 1:
TABLE 1
Node point Memory space address
I0 501-510
I1 511-520
I2 521-530
I3 531-540
I4 541-550
I5 551-560
I6 561-570
It can be understood that the memory space allocation method can realize one-time allocation of the memory space, avoid excessive cost and time waiting caused by excessive memory allocation times, ensure high-speed operation of the processor, be embodied in a game layer and enable a game to be smoother and smoother.
In step S23, a pointer is created to point to the memory space address of the root node in the full N-ary tree.
In this embodiment, two pointers are created: a start pointer and an end pointer.
Wherein the start pointer points to node I0I.e. 501, end pointer points to the first leaf node (I)3) I.e. 531.
In step S24, it is determined whether the memory space address pointed by the pointer is the same as the set memory space address.
Specifically, it is determined whether the memory space address pointed by the start pointer and the memory space address pointed by the end pointer are the same, if so, it indicates that the binary tree construction is completed, and if not, the process goes to step S25.
Step S25, finding out the index values of all the child nodes of the root node, obtaining the memory space address of the child node corresponding to the index value for each found index value, storing the memory space address of the child node corresponding to the index value in the memory space of the root node, and storing the memory space address of the root node in the memory space of the child node corresponding to the index value.
For example, the memory space address 501 pointed to by the start pointer is not equal to the memory space address 531 pointed to by the end pointer, and at this time, the root node I is found0Index values of all child nodes of (1): i is1And I2In respect of I1Store memory space address 511 in root node I0The memory space address 501 is stored in the node I1For I2A similar operation is performed.
It can be understood that the index value of the first child node of the node with the index value x is N x +1, and the root node I in this embodiment is used0For example, the index value of the first leaf node is 0 x 2+1 ═ 1, i.e., I1
In step S26, the pointer is pointed to the next memory space address.
For example, the start pointer is pointed to the memory space address 511, which may also be understood as the start pointer sequentially moving backward by one position according to the order of the index values from small to large, and in the initial state, the start pointer points to the root node I0After step S25 is completed, the start pointer points to node I1Memory space address 511.
Step S27, determine whether the next memory space address is the same as the set memory space address, and perform a corresponding operation according to the determination result.
It will be appreciated that this step operates similarly to step S25.
For example, a start pointer points to node I1The memory space address 511 is different from the memory space address 531 pointed by the end pointer, and the node I is found out1Child node I of3And I4For node I3Store memory space address 531 at node I1Memory space of, node I1Is stored in node I at memory space address 5113Until the start pointer moves to the nodePoint I3Thus, the construction of the full binary tree is completed.
By the construction method, the data can be prevented from being excessively dispersed, so that the data of the whole full binary tree are arranged in a section of continuous memory space, and the distribution is Cache-friendly.
On the basis of the above, as shown in fig. 4, an embodiment of the present invention provides a full N-ary tree building apparatus 20, where the full N-ary tree building apparatus 20 includes: an index value setting module 21, a memory space allocation module 22, a pointer creating module 23, a judging module 24 and an adjusting module 25.
And an index value setting module 21, configured to set a corresponding index value for each node in the full N-ary tree.
Since the implementation principle of the index value setting module 21 is similar to that of step S21 in fig. 2, no further description is provided here.
The memory space allocation module 22 is configured to calculate the number of nodes of a full N-ary tree, calculate a total required storage space of the full N-ary tree according to the number, obtain a memory space according to the total required storage space, and allocate the memory space to each node based on a plurality of set index values; and the memory space allocated by each node is provided with a memory space address.
Since the memory space allocation module 22 is similar to the implementation principle of step S22 in fig. 2, it will not be further described here.
And a pointer creating module 23, configured to create a pointer so that the pointer points to a memory space address of a root node in the full N-ary tree.
Since the pointer creating module 23 is similar to the implementation principle of step S23 in fig. 2, it will not be further described here.
The determining module 24 is configured to determine whether the memory space address pointed by the pointer is the same as the set memory space address, if not, find out the index values of all the child nodes of the root node, obtain, for each found index value, the memory space address of the child node corresponding to the index value, store the memory space address of the child node corresponding to the index value in the memory space of the root node, and store the memory space address of the root node in the memory space of the child node corresponding to the index value.
Since the determination module 24 is similar to the implementation principle of step S24, step S25 and step S27 in fig. 2, it will not be further described here.
An adjusting module 25, configured to enable the pointer to point to a next memory space address, where an index value of a node corresponding to the next memory space address is greater than an index value of the root node by one.
Since the implementation principle of the adjusting module 25 is similar to that of step S26 in fig. 2, no further description is provided here.
In summary, the method and the device for constructing the full N-ary tree provided by the embodiments of the present invention improve the problem of excessive times for allocating the memory space by allocating the memory space continuously at one time, and can avoid the problem of excessive data dispersion, thereby reducing the occurrence of the Cache Missing phenomenon.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof, which essentially contributes to the prior art, can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, an electronic device 10, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A full N-ary tree construction method, the method comprising:
setting a corresponding index value for each node in the full N-ary tree;
calculating the number of nodes of a full N-ary tree, calculating the sum of required storage spaces of the full N-ary tree according to the number, acquiring a memory space according to the sum of the required storage spaces, and distributing the memory space to each node based on a plurality of set index values; the memory space allocated by each node is provided with a memory space address;
creating a pointer, and enabling the pointer to point to the memory space address of the root node in the full N-ary tree;
judging whether the memory space address pointed by the pointer is the same as a set memory space address or not, if not, searching index values of all child nodes of the root node, aiming at each searched index value, obtaining the memory space address of the child node corresponding to the index value, storing the memory space address of the child node corresponding to the index value in the memory space of the root node, and storing the memory space address of the root node in the memory space of the child node corresponding to the index value;
the method further comprises the following steps:
enabling the pointer to point to a next memory space address, wherein an index value of a node corresponding to the next memory space address is one greater than an index value of the root node;
judging whether the next memory space address is the same as the set memory space address or not;
if not, searching index values of all child nodes of the node corresponding to the next memory space address; aiming at each searched index value, acquiring the memory space address of the child node corresponding to the index value, storing the memory space address value of the parent node of the child node corresponding to the index value in the memory space of the child node corresponding to the index value, and storing the next memory space address in the memory space of the parent node of the child node corresponding to the index value;
and if the N-branch tree is the same, judging that the full N-branch tree is constructed completely.
2. The full N-ary tree building method according to claim 1, wherein the step of setting a corresponding index value for each node in the full N-ary tree comprises:
acquiring the depth value of each node;
and setting index values for each node in turn according to the sequence of the depth values from small to large, and setting the index values for a plurality of nodes with the same depth values in turn according to the set sequence.
3. The full N-ary tree construction method according to claim 1, wherein the step of sequentially setting index values in a set order for a plurality of nodes having the same depth value comprises:
and for a plurality of nodes with the same depth value, sequentially setting index values from left to right.
4. The method of claim 1, wherein the step of allocating the memory space to each node based on the set index values comprises:
and evenly distributing the memory space to each node according to the sequence of the index values from small to large.
5. An apparatus for full N-ary tree construction, the apparatus comprising:
the index value setting module is used for setting a corresponding index value for each node in the full N-ary tree;
the memory space allocation module is used for calculating the number of nodes of a full N-ary tree, calculating the sum of required storage spaces of the full N-ary tree according to the number, acquiring a memory space according to the sum of the required storage spaces, and allocating the memory space to each node based on a plurality of set index values; the memory space allocated by each node is provided with a memory space address;
a pointer creating module, configured to create a pointer so that the pointer points to a memory space address of a root node in the full N-ary tree;
a judging module, configured to judge whether a memory space address pointed by the pointer is the same as a set memory space address, if not, find out index values of all child nodes of the root node, obtain, for each found index value, a memory space address of the child node corresponding to the index value, store the memory space address of the child node corresponding to the index value in the memory space of the root node, and store the memory space address of the root node in the memory space of the child node corresponding to the index value;
the device further comprises:
an adjusting module, configured to enable the pointer to point to a next memory space address, where an index value of a node corresponding to the next memory space address is greater than an index value of the root node by one;
the judging module is further used for judging whether the next memory space address is the same as the set memory space address;
if not, searching index values of all child nodes of the node corresponding to the next memory space address; aiming at each searched index value, acquiring the memory space address of the child node corresponding to the index value, storing the memory space address value of the parent node of the child node corresponding to the index value in the memory space of the child node corresponding to the index value, and storing the next memory space address in the memory space of the parent node of the child node corresponding to the index value;
and if the N-branch tree is the same, judging that the full N-branch tree is constructed completely.
6. The full N-ary tree building apparatus according to claim 5, wherein the index value setting module sets the corresponding index value for each node in the full N-ary tree by:
acquiring the depth value of each node;
and setting index values for each node in turn according to the sequence of the depth values from small to large, and setting the index values for a plurality of nodes with the same depth values in turn according to the set sequence.
7. The full N-ary tree building device according to claim 6, wherein the index value setting module sequentially sets the index values for a plurality of nodes having the same depth value in a set order by:
and for a plurality of nodes with the same depth value, sequentially setting index values from left to right.
8. The full N-ary tree building apparatus according to claim 5, wherein the memory space allocating module allocates the memory space to each of the nodes based on the set index values by:
and evenly distributing the memory space to each node according to the sequence of the index values from small to large.
CN201811631948.1A 2018-12-28 2018-12-28 Full N-way tree construction method and device Active CN109710542B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811631948.1A CN109710542B (en) 2018-12-28 2018-12-28 Full N-way tree construction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811631948.1A CN109710542B (en) 2018-12-28 2018-12-28 Full N-way tree construction method and device

Publications (2)

Publication Number Publication Date
CN109710542A CN109710542A (en) 2019-05-03
CN109710542B true CN109710542B (en) 2021-03-16

Family

ID=66259384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811631948.1A Active CN109710542B (en) 2018-12-28 2018-12-28 Full N-way tree construction method and device

Country Status (1)

Country Link
CN (1) CN109710542B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10990323B2 (en) * 2019-05-28 2021-04-27 Silicon Motion, Inc. Flash memory controller, memory device and method for accessing flash memory module
CN111932009B (en) * 2020-08-10 2024-05-21 南宁市永恒影像有限公司 Rectangular optimized layout method and device
CN111932011B (en) * 2020-08-10 2024-05-24 南宁市永恒影像有限公司 Rectangular optimization layout method and device based on binary block tree
CN115834062B (en) * 2023-02-20 2023-04-25 浙江奥鑫云科技有限公司 Enterprise data transmission encryption method for data hosting service

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012870A (en) * 2010-11-18 2011-04-13 清华大学 Memory allocation method
CN102880507A (en) * 2012-09-12 2013-01-16 科立讯通信股份有限公司 Method for applying and distributing chain structure message
CN103559323A (en) * 2013-11-22 2014-02-05 盛杰 Database implementation method
CN106547603A (en) * 2015-09-23 2017-03-29 北京奇虎科技有限公司 The method and apparatus for reducing the golang language system garbage reclamation times
CN107229429A (en) * 2017-06-27 2017-10-03 郑州云海信息技术有限公司 A kind of memory space management and device
CN108628753A (en) * 2017-03-24 2018-10-09 华为技术有限公司 Memory headroom management method and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7139765B1 (en) * 2000-04-03 2006-11-21 Alan Balkany Hierarchical method for storing data with improved compression
CN100468402C (en) * 2005-10-26 2009-03-11 腾讯科技(深圳)有限公司 Sort data storage and split catalog inquiry method based on catalog tree
CN102521334B (en) * 2011-12-07 2014-03-12 广东工业大学 Data storage and query method based on classification characteristics and balanced binary tree
US10416890B2 (en) * 2015-09-09 2019-09-17 Intel Corporation Application execution enclave memory page cache management method and apparatus
CN105512229B (en) * 2015-11-30 2019-02-22 北京奇艺世纪科技有限公司 A kind of storage, querying method and the device of the regional information of IP address
CN107797941B (en) * 2016-09-06 2020-07-07 华为技术有限公司 Cache coloring memory allocation method and device for search tree
CN107180092B (en) * 2017-05-15 2020-10-23 中国科学院上海微***与信息技术研究所 File system control method and device and terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012870A (en) * 2010-11-18 2011-04-13 清华大学 Memory allocation method
CN102880507A (en) * 2012-09-12 2013-01-16 科立讯通信股份有限公司 Method for applying and distributing chain structure message
CN103559323A (en) * 2013-11-22 2014-02-05 盛杰 Database implementation method
CN106547603A (en) * 2015-09-23 2017-03-29 北京奇虎科技有限公司 The method and apparatus for reducing the golang language system garbage reclamation times
CN108628753A (en) * 2017-03-24 2018-10-09 华为技术有限公司 Memory headroom management method and device
CN107229429A (en) * 2017-06-27 2017-10-03 郑州云海信息技术有限公司 A kind of memory space management and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
BitTorrent对等网文件共享***关键技术研究;俞嘉地;《中国优秀硕士学位论文全文数据库 信息科技辑》;20070415;I138-15 *

Also Published As

Publication number Publication date
CN109710542A (en) 2019-05-03

Similar Documents

Publication Publication Date Title
CN109710542B (en) Full N-way tree construction method and device
US9805140B2 (en) Striping of directed graphs and nodes with improved functionality
CN110351375B (en) Data processing method and device, computer device and readable storage medium
KR20100013257A (en) Method and apparatus for partitioning and sorting a data set on a multi-processor system
JP6247620B2 (en) System and method for improving parallel search on bipartite graphs using dynamic vertex-processor mapping
CN111984400A (en) Memory allocation method and device of neural network
AU2017268599B2 (en) Method, device, server and storage medium of searching a group based on social network
CN112074818A (en) Method and node for enabling access to past transactions in a blockchain network
CN108804383B (en) Support point parallel enumeration method and device based on measurement space
CN110297810B (en) Stream data processing method and device and electronic equipment
CN104281664A (en) Data segmenting method and system of distributed graph calculating system
CN105677755A (en) Method and device for processing graph data
CN110555014B (en) Data migration method and system, electronic device and storage medium
CN106383826A (en) Database checking method and apparatus
CN110532528B (en) Book similarity calculation method based on random walk and electronic equipment
CN104050189B (en) The page shares processing method and processing device
US20180217992A1 (en) Domain based influence scoring
CN111049750B (en) Message forwarding method, system and equipment
CN116521816A (en) Data processing method, retrieval method, device, equipment and storage medium
CN112069175A (en) Data query method and device and electronic equipment
CN104537016B (en) A kind of method and device of determining file place subregion
CN110928902A (en) Query method and system for acquiring cloud platform terminal data aiming at paging
CN110659425A (en) Resource allocation method and device, electronic equipment and readable storage medium
CN108073583B (en) Picture splitting method and device
CN112181829B (en) User distribution method, device, terminal and medium for AB experiment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant