CN1955958A - Sort data storage and split catalog inquiry method based on catalog tree - Google Patents

Sort data storage and split catalog inquiry method based on catalog tree Download PDF

Info

Publication number
CN1955958A
CN1955958A CN 200510116663 CN200510116663A CN1955958A CN 1955958 A CN1955958 A CN 1955958A CN 200510116663 CN200510116663 CN 200510116663 CN 200510116663 A CN200510116663 A CN 200510116663A CN 1955958 A CN1955958 A CN 1955958A
Authority
CN
China
Prior art keywords
node
pointer
split catalog
catalog
split
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.)
Granted
Application number
CN 200510116663
Other languages
Chinese (zh)
Other versions
CN100468402C (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 Jingdong Shangke Information Technology Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CNB2005101166630A priority Critical patent/CN100468402C/en
Publication of CN1955958A publication Critical patent/CN1955958A/en
Application granted granted Critical
Publication of CN100468402C publication Critical patent/CN100468402C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

A method for storing classified data based on catalogue tree includes setting up root node of catalogue tree, making brother node pointer of root node be idle and making data pointer be idle then setting up a new node to let sun node pointer of root node point to set up new node being used to correspond to one grade classification catalogue of classified data, utilizing recursive algorithm to separately set up mapping node to correspond to each grade classification catalogue of classified data. The catalogue querying method based on said catalogue tree is also disclosed.

Description

A kind of grouped data storage and split catalog querying method based on directory tree
Technical field
The present invention relates to the administrative skill of grouped data, specially refer to a kind of grouped data storage and split catalog querying method based on directory tree.
Background technology
Along with the explosive increase of present data message and the continuous expansion of computer application field, computing machine has become indispensable data management instrument in people's life, no matter be that data acquisition, processing, storage and retrieval or the like operation all be unable to do without computing machine, therefore, how to store data and how to retrieve needed data apace and become current data and manage subject matter to be solved effectively and quickly.
Usually can adopt tree structure to store for grouped data at present, the tree structure of storing these split catalogs is called directory tree again.Use the method for directory tree storage grouped data to comprise: at first to set up a root node, this root node comprises at least one one-level child node, the quantity of described one-level child node is decided according to the number of the one-level split catalog that described grouped data obtains later on through a subseries, make the corresponding one-level split catalog of each child node, write down information such as the title of this one-level split catalog or sign.Wherein, each one-level child node can also further comprise at least one secondary child node, correspondingly, each secondary child node will corresponding to its father node the secondary classification catalogue that obtains after through classification of the data that comprised of corresponding one-level split catalog, write down the information such as title of this secondary classification catalogue.So circulation is gone down, obtain several n level child nodes (described n is a natural number) here, the pairing n fraction of these n level child nodes class catalogue can not further have been classified again, at this moment, these n level child nodes can be called leaf node, these leaf nodes except to write down the title or sign of corresponding n fraction class catalogue, also need further storage the grouped data that comprised of corresponding n fraction class catalogue.
Fig. 1 has shown a kind of goods catalogue of using above-mentioned directory tree storage.As can be seen from Figure 1, the extensive stock data obtain some one-level split catalogs after through a subseries, and computer, bullion and mobile phone or the like catalogue for example will be corresponding to each one-level child node of directory tree shown in Figure 1; And each one-level commodity that split catalog comprises can also further carry out some secondary classification catalogues that secondary classification obtains, for example, the computer catalogue can also further be divided into notebook, desktop computer and office equipment or the like catalogue, and these secondary classification catalogues will be corresponding to each secondary child node of directory tree shown in Figure 1.For the split catalog that can't classify again, catalogue such as IBM or DELL for example, will be corresponding to the leaf node of directory tree shown in Figure 1, except the title or sign of the corresponding split catalog of storage on the above-mentioned leaf node, the extensive stock information that also will further store its corresponding split catalog and be comprised, for example each merchandise news of each merchandise news of IBM notebook computer or DELL notebook computer.
Can clearly indicate classification relation between the split catalogs at different levels by above-mentioned tree structure, realize effective management grouped data.Yet, because in fact above-mentioned directory tree has adopted the data structure of multiway tree, in this multiway tree the number of child node that each node comprises will corresponding to this node the corresponding catalogue sub-directory number of dividing, therefore, the number of child node that each node comprises is uncertain, in other words conj.or perhaps unpredictable, this will cause the size of the required storage space of each node on the directory tree can not determine, thereby cause in the data storage procedure batch operation to storage space too complicated.Particularly when above-mentioned storage means is applied to the management of mass data, the for example management of the goods catalogue in the ecommerce and library's information management or the like, because the quantity of information that mass data comprised is very huge, make that the child node number that each node comprised is too much, this will cause each node institute canned data too huge, not only further increase the memory allocation operation complexity, also will cause the waste of storage space resource.
In addition, when the classification relation of above-mentioned grouped data by the tree storage of multiway tree structure category changes, for example when increasing, moving or deleting certain split catalog, also need to consider problems such as the distribution of this split catalog father node storage space and recovery, make that increase, deletion and the move operation of split catalog are very complicated.
Summary of the invention
In order to solve the problem that prior art exists, the invention provides a kind of grouped data storage means based on directory tree, can save memory headroom effectively, simplify the moving of the storage of grouped data and split catalog, increase and deletion action simultaneously.
The present invention also provides a kind of split catalog querying method based on directory tree, can retrieve the split catalog that needs inquiry fast, obtains the grouped data that this split catalog comprises.
In the grouped data storage means based on directory tree of the present invention, each node on the described directory tree comprises child nodes pointer, brotgher of node pointer and data pointer at least;
The storage means of described grouped data comprises:
A, set up the root node of described directory tree, the brotgher of node pointer that makes this root node is for empty, and data pointer is empty, and sets up a new node, the new node that makes the child nodes pointed of described root node be set up is with the one-level split catalog of described new node corresponding to grouped data;
B, utilize recursive algorithm to set up respectively and all split catalogs at different levels of described grouped data node of mapping one by one, corresponding each node, if the pairing split catalog of this node comprises the split catalog of next stage, one of the child nodes pointed that then makes this node corresponding to this node the node of corresponding split catalog next stage split catalog, and make this node data pointer for empty, otherwise, make this node child nodes pointer for empty, and make this node data pointed be used to preserve the memory headroom of the grouped data that the pairing split catalog of this node comprised; If comprised all nodes in the described directory tree corresponding to corresponding split catalog peer of this node institute split catalog, the brotgher of node pointer that then makes this node is for empty, otherwise, one of the brotgher of node pointed that makes this node corresponding to this node corresponding split catalog catalogue at the same level and be not included in node in the described directory tree.
Step B is described utilize recursive algorithm in described directory tree, set up with all split catalogs of described grouped data one by one all nodes of mapping comprise step:
C, make that newly-established node is a present node, and judge whether the pairing split catalog of present node has the next stage split catalog, if have, the data pointer that present node then is set is for empty, set up a new node again, the new node that the child nodes pointed that makes present node is set up in this step, and be provided with described new node corresponding to present node a next stage split catalog of corresponding split catalog, return this step C then; Otherwise the child nodes pointer that present node is set is for empty, and the data pointer of present node is pointed to the memory headroom that is used to preserve the grouped data that the corresponding split catalog of present node comprised, execution in step D then;
D: judge whether the pairing split catalog of present node has the split catalog at the same level that does not join in this directory tree, if have, then set up a new node, the new node that makes this step of brotgher of node pointed of present node be set up, and be provided with described new node corresponding to present node a split catalog at the same level that does not join in this directory tree of corresponding split catalog, return step C then; Otherwise, turn back to present node the node of corresponding split catalog upper level split catalog correspondence, and judge whether this node is root node, if, then finish, otherwise, make that this node is a present node, and return this step D.
The method of the invention further comprises adds grouped data to certain split catalog, is specially:
A1: in described directory tree, find node that should split catalog according to the split catalog that will add to;
A2: first pointer element that this node data pointer array of pointers pointed is set is current pointer element;
A3: judge whether current pointer element memory headroom pointed is empty, if, then in internal memory, ask the memory headroom of a fixed size, and make this pointer element point to the memory headroom of new application, carry out A4 then; Otherwise, judge whether current pointer element memory headroom pointed is full, if it is the next pointer element of array of pointers that the current pointer element then is set, and returns this step then; Otherwise, execution in step A4;
A4: in the memory headroom of current pointer element directed, add the assortment data information that to add.
Based on the grouped data storage means based on directory tree of the present invention, the present invention gives a kind of split catalog querying method based on directory tree, and each node on the described directory tree comprises child nodes pointer, brotgher of node pointer and data pointer at least;
The querying method of described split catalog comprises:
A, find the pairing node of this split catalog described catalogue seeds according to the split catalog that will inquire about;
B, judge that whether the child nodes pointer of this node is empty, if then this node is joined in the container, then execution in step d; Otherwise, execution in step c;
C, read the whole left branch of this node by recursive algorithm and comprise all leaf nodes, and all leaf nodes that will read join in the container successively, then execution in step c;
D, read leaf node successively from described container, the memory headroom according to reading leaf node data pointer points to obtains all grouped datas of storing in the described memory headroom, returns to the user.
Each node on the directory tree of the present invention further comprise be used to identify this node the node identification of corresponding split catalog, when setting up each node, make the class indication of the node identification of each node by the corresponding split catalog of this node;
Described method further comprises: in internal memory, generate the node identification and the mapping table that points to this node place physical memory space pointer of a split catalog corresponding node in advance, and the mapping relations between the pointer of the node identification of when setting up each node, in the mapping table that generates in advance, preserving this node and this node place memory headroom of sensing;
Step a is described to find the node at described this split catalog place to comprise according to the split catalog that will inquire about, browse:
A1, in described mapping table, find the pointer of the node place memory headroom that points to the described split catalog correspondence that will inquire about;
A2, directly navigate to the pairing node of the described split catalog that will inquire about, browse by described this pointer.
This shows, use the y-bend directory tree to replace existing many fork directory tree storage classified informations can obtain following beneficial effect:
At first, owing to each size of node of y-bend directory tree is fixed, and occupation space is very little, therefore, use y-bend directory tree storage classified information save memory resource greatly, make internal memory can store more grouped data, the storage efficiency of the internal memory of raising.
In addition, because the moving of the generation of binary tree and node, increase, the deletion action algorithm is simple, expense is little, and in the process that certain node is moved, increases or deletes, do not need to consider problems such as the distribution of his father's node storage space and recovery, make and use the y-bend directory tree grouped data to be managed simple.
Description of drawings
Fig. 1 is for adopting the goods catalogue synoptic diagram of existing multiway tree structure category tree storage;
Fig. 2 adopts the structural representation of each node in the directory tree for the preferred embodiment of the present invention;
Fig. 3 is the described grouped data storage means process flow diagram based on directory tree of the preferred embodiment of the present invention;
Fig. 4 is for adopting the goods catalogue synoptic diagram of the described directory tree storage of the preferred embodiment of the present invention;
Fig. 5 for inquiry in the described y-bend directory tree of the preferred embodiment of the present invention, browse the method flow diagram of the grouped data that certain split catalog comprises;
Fig. 6 is the method flow diagram that adds grouped data in certain split catalog of the described y-bend directory tree of the preferred embodiment of the present invention.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further detail.
Consider that binary tree is a kind of data structure that is widely used in data search, its generation and node searching scheduling algorithm comparative maturity, and fast convergence rate, therefore core concept of the present invention is to utilize binary tree structure storage grouped data.
A preferred embodiment of the present invention has provided the structure of each node of binary tree structure directory tree (being called for short the y-bend directory tree) that is used for storing grouped data, as shown in Figure 2, each node comprise be used to identify this node the node identification (ID) of corresponding split catalog, a child nodes pointer that points to this node next stage child node, brotgher of node pointer that points to another node in this node brother of node and sensing are used to preserve the data pointer of grouped data memory headroom.
The method of the above-mentioned y-bend directory tree storage of the described use of a preferred embodiment of the invention grouped data mainly may further comprise the steps as shown in Figure 3:
A: set up root node, promptly in internal memory, open up a block space and store the node ID of this root node, its child nodes pointer, brotgher of node pointer and data pointer, the node ID that this root node is set is 0, makes its brotgher of node pointer be empty (NULL), and data pointer also is NULL.
B: set up a new node, the new node that makes this step of child nodes pointed of described root node be set up, and to make the node ID of described new node be the class indication of an one-level split catalog.
Described here class indication is a sign predetermined, can each split catalog of unique identification grouped data, for example, in the present embodiment, the class indication of one-level split catalog computer is 1 in the goods catalogue that the front was described, the class indication of bullion is 2, and the class indication of mobile phone is 3; The class indication of secondary classification catalogue notebook is 11, and the class indication of desktop computer is 12; The class indication of reclassify catalogue IBM is 111, and the class indication of DELL is 112 or the like.Like this, the class indication by the ID of present node is set to certain split catalog just can be mapped present node and a split catalog.Need to prove that the sign of each split catalog can adopt any form in the present invention,, and be not limited to the form that above preferred embodiment provides as long as can each split catalog of unique identification.In this step, the node ID that described new node is set is that the class indication of an one-level split catalog comes down to described new node and an one-level split catalog are mapped.
This step is described, and to set up the described method of setting up root node of new node and steps A identical, promptly opens up a block space and store the node ID of this node, child nodes pointer, brotgher of node pointer and data pointer in internal memory.
In follow-up step, will create the y-bend directory tree that is used to store described grouped data by recursive algorithm, specifically comprise:
C: make that described new node is a present node, judge whether the pairing split catalog of present node has the next stage split catalog, if having, execution in step D then; Otherwise, execution in step E.
D: the data pointer that present node is set is NULL, set up a new node again, make the new node of the child nodes pointed of present node in the foundation of this step, and the class indication of the node ID of described new node by a split catalog in the next stage split catalog of the corresponding split catalog of present node be set, be about to described new node corresponding to present node a next stage split catalog of corresponding split catalog, return step C then.
In this step, if described present node is corresponding to a n fraction class catalogue, the class indication of the node ID of the described new node n+1 fraction class catalogue that will be comprised for this n fraction class catalogue then, the corresponding secondary classification catalogue of present node notebook for example, then the node ID of described new node just can be the class indication 111 of reclassify catalogue IBM or the class indication 112 of reclassify catalogue DELL.
E: the child nodes pointer that present node is set is NULL, and the data pointer of present node is pointed to the memory headroom that is used to preserve the grouped data that the corresponding split catalog of present node comprised, execution in step F then.
The memory headroom that this step is described to be used to preserve the grouped data that the corresponding split catalog of present node comprised can be size arbitrarily and memory headroom that can dynamic expansion.
In another preferred embodiment of the present invention, carry out the memory source management for convenience, in this step, an array of pointers can be set further, and the data pointer of present node pointed to this array of pointers, wherein, each pointer element of this pointer data will be pointed to the memory headroom of fixed size respectively, and the memory headroom of described fixed size will be used to write down the grouped data that the pairing split catalog of each leaf node is comprised.How many number n of pointer element that described array of pointers comprises can according to the preestablishing of grouped data, and such as being set at 10, each leaf node just can have the memory headroom of 10 fixed sizes like this.But be not when each leaf node is created, to be this leaf node application n piece memory headroom with regard to unification, but demand assigned, when a memory headroom is filled with, just can apply for next memory headroom, and each application only distributes a memory headroom.Above-mentioned employing fixed size memory headroom and demand assigned method mainly are in order to improve Memory Allocation efficient, needed dynamic expansion operation to memory headroom when avoiding adopting size memory headroom storage arbitrarily grouped data effectively.
F: judge present node whether have in all catalogues at the same level of corresponding split catalog and do not join in this y-bend directory tree, if having, execution in step G then; Otherwise, execution in step H.
G: set up a new node, the new node that makes this step of brotgher of node pointed of present node be set up, and the class indication that do not add at the same level catalogue in this y-bend directory tree of the node ID of described new node by the corresponding split catalog of present node be set, be about to described new node corresponding to present node a split catalog at the same level of corresponding split catalog, return step C then.
In this step, if described present node is corresponding to a n fraction class catalogue, then the node ID of described new node will be the class indication of another n fraction class catalogue of not adding described y-bend directory tree, the corresponding secondary classification catalogue of present node notebook for example, then the node ID of described new node just can be the class indication 12 of the secondary classification catalogue desktop computer that do not add this y-bend directory tree or the class indication 13 of secondary classification catalogue office equipment.
H: turn back to present node the node of corresponding split catalog upper level split catalog correspondence, and judge whether this node is root node, if then finish; Otherwise, execution in step I.
I: make that this node is a present node, and return step F.
By carrying out above-mentioned steps A~I, the y-bend directory tree that is used to store grouped data has been set up and has been finished, and all nodes of described y-bend directory tree will with all split catalogs mapping one by one of described grouped data.Fig. 4 has shown the goods catalogue synoptic diagram that adopts above-mentioned y-bend directory tree storage.As shown in Figure 4, the child nodes pointer of root node will point to the extensive stock data and obtain an one-level split catalog after through a subseries, for example the one-level child node of computer catalogue correspondence.The child nodes pointer of this one-level child node will point to for example secondary child node of notebook catalogue correspondence of a secondary classification catalogue that this one-level split catalog obtains through secondary classification; And its brotgher of node pointer will point to another one-level split catalog, and for example the one-level child node of bullion catalogue correspondence is so analogized.Leaf node in the above-mentioned y-bend directory tree, the data pointer of the node of branch class catalogues such as for example corresponding IBM or DELL will point to an array of pointers, the pointer element of described array of pointers will be pointed to the memory headroom of storage merchandise news that each split catalog comprises, i.e. physical memory piece.
Be described in detail in the method for inquiring about the grouped data that certain split catalog comprised in the above-mentioned y-bend directory tree below in conjunction with Fig. 5, as shown in Figure 5, this method mainly may further comprise the steps:
A1, in the y-bend directory tree, find the pairing node of described this split catalog according to the class indication of the split catalog that will inquire about or browse;
Since the node ID of each node be exactly this node the class indication of corresponding split catalog, the described method of searching corresponding node of this step can be that the ID with this split catalog travels through described y-bend directory tree as index, finds the node of described split catalog correspondence;
A2, judge whether the child nodes pointer of this node is NULL, if then carry out a3; Otherwise execution in step a4;
A3, this node is joined in the container, then execution in step a5;
The described container of this step is an interim memory headroom that is used for temporarily depositing leaf node;
A4, read the whole left branch of this node by recursive algorithm and comprise all leaf nodes, and all leaf nodes that will read join in the container successively, then execution in step a5;
A5, read leaf node successively from described container, the memory headroom according to reading leaf node data pointer points to obtains all grouped datas of storing in the described memory headroom, returns to the user.
If what the data pointer of the leaf node of above-mentioned y-bend directory tree pointed to is an array of pointers, also need further to find the memory headroom of storage grouped data at step a5 by this array of pointers.
Next the method for adding grouped data in the above-mentioned y-bend directory tree, the method for for example adding certain merchandise news to one split catalog will be described in detail in.
If the data pointer of the leaf node of above-mentioned y-bend directory tree points to be size arbitrarily and memory headroom that can dynamic expansion, then at first find the node at described this split catalog place according to the class indication of the split catalog that will add to; The grouped data that needs are added is added in this node data pointer memory headroom pointed then.If this memory headroom is full, also need at first by internal memory dynamic expansion operation this node data pointer of expansion memory headroom pointed.
If what the data pointer of the leaf node of above-mentioned y-bend directory tree pointed to is an array of pointers, then need to carry out following steps, as shown in Figure 6:
B1: the node that in the y-bend directory tree, finds described this split catalog place according to the class indication of the split catalog that grouped data will be added to;
The method that this step adopted is identical with the described method of step a1;
B2: first pointer element that this node data pointer array of pointers pointed is set is current pointer element;
B3: judge whether current pointer element memory headroom pointed is NULL, if, execution in step b4 then; Otherwise, execution in step b6;
B4:, and make this pointer element point to the memory headroom of new application, execution in step b5 then to the memory headroom of a fixed size of internal memory application;
B5: in current pointer element memory headroom pointed, add the assortment data information that to add, then end;
B6: judge whether current pointer element memory headroom pointed is full, if, execution in step b7 then; Otherwise, execution in step b5;
B7: it is the next pointer element of array of pointers that the current pointer element is set, and returns step b3 then.
In this step, if the current pointer element is last pointer element of array of pointers, and the memory headroom of its sensing is full, then can't add the respective classified data in current directory tree, should return error message and give the user.
From above preferred embodiment as can be seen, because each size of node of y-bend directory tree is fixed, and occupation space is very little, therefore, use the y-bend directory tree to replace many fork directory tree storage classified informations save memory resource greatly, thereby can store more grouped data, and obtain higher storage efficiency.In addition; because the moving of the generation of binary tree and node, increase, the deletion action algorithm is simple, expense is little; and in the process that certain node is moved, increases or deletes; only need to revise the pointed of its father node; and do not need to consider problems such as the distribution of his father's node storage space and recovery; it is simple to make that use y-bend directory tree manages grouped data, can point to the alter operation of split catalog under the environment of the normal operation of system, and not need to shut down.
Through test, in the application of reality, if 1,000 ten thousand commodity are arranged, have the split catalog of 2000 minimums, use the method for above-mentioned y-bend directory tree, the node that system may exist, comprise that leaf node and non-leaf node are 3000 altogether, each node occupation space is about 16 bytes (node ID wherein, the child nodes pointer, each needs 4 bytes brotgher of node pointer and data pointer), and every commodity only need 4 bytes of memory spaces under the situation that only storing commodity identifies, the needed total memory headroom of so all nodes and commodity is about 3000 * 16+10,000,000 * 4=40.048 megabyte.Can all leave in the calculator memory space fully, thereby can greatly improve the recall precision of data.
Inquiry in above-mentioned y-bend directory tree, browse the method for the grouped data that certain split catalog comprises and in the y-bend directory tree, add in the method for grouped data, all need at first to find the node at described this split catalog place according to the class indication of split catalog by the method for traversal y-bend directory tree, this traversing operation will expend the more time.
Search each split catalog for convenience, another preferred embodiment of the present invention generates the node ID and the mapping table that points to this node place physical memory block pointer of a split catalog corresponding node in advance in internal memory, and generate in the process of described y-bend directory tree carrying out above-mentioned steps A~I, further carry out following operation at step C: the mapping relations between the node ID of in the mapping table that generates in advance, preserving the described present node of step C and the pointer of sensing present node place memory headroom.
Like this, since the node ID of each node be exactly this node the class indication of corresponding split catalog, therefore, in above-mentioned y-bend directory tree, inquire about, browse the method for the grouped data that certain split catalog comprises and in the y-bend directory tree, add in the method for grouped data can be at first directly according to the class indication of the split catalog that grouped data will be added to, in the node ID of described split catalog corresponding node and the mapping table that points to this node place physical memory block pointer, find the pointer that points to the corresponding node place memory headroom of this split catalog, directly navigate to the node of described split catalog correspondence then by described pointer, and need not to carry out y-bend catalogue traversal of tree.For example, 1,000 ten thousand commodity are arranged now, be distributed in below 1000 leaves, like this, 10,000 commodity are arranged under each leaf node on average.If the user need browse certain split catalog, 200,000 commodity have been comprised under this split catalog, can directly navigate to the corresponding node of this split catalog by the mapping relations between node ID of preserving in advance and the pointer that points to this node place memory headroom, therefore, the commodity sum that system need retrieve has only 20W, and do not need from whole 1,000 ten thousand commodity, to filter, and, the split catalog of next stage is searched in the every selection of user, the commodity sum of required retrieval all can reduce fast, thereby improved the search efficiency of node widely, further improved the efficiency of management of grouped data.

Claims (8)

1, a kind of grouped data storage means based on directory tree is characterized in that, each node on the described directory tree comprises child nodes pointer, brotgher of node pointer and data pointer at least;
The storage means of described grouped data comprises:
A, set up the root node of described directory tree, the brotgher of node pointer that makes this root node is for empty, and data pointer is empty, and sets up a new node, the new node that makes the child nodes pointed of described root node be set up is with the one-level split catalog of described new node corresponding to grouped data;
B, utilize recursive algorithm to set up respectively and all split catalogs at different levels of described grouped data node of mapping one by one, for each node, if the pairing split catalog of this node comprises the split catalog of next stage, one of the child nodes pointed that then makes this node corresponding to this node the node of corresponding split catalog next stage split catalog, and make this node data pointer for empty, otherwise, make this node child nodes pointer for empty, and make this node data pointed be used to preserve the memory headroom of the grouped data that the pairing split catalog of this node comprised; If comprised all nodes in the described directory tree corresponding to corresponding split catalog peer of this node institute split catalog, the brotgher of node pointer that then makes this node is for empty, otherwise, one of the brotgher of node pointed that makes this node corresponding to this node corresponding split catalog catalogue at the same level and be not included in node in the described directory tree.
2, the method for claim 1 is characterized in that, step B is described utilize recursive algorithm in described directory tree, set up with all split catalogs of described grouped data one by one all nodes of mapping comprise step:
C, make that newly-established node is a present node, and judge whether the pairing split catalog of present node has the next stage split catalog, if have, the data pointer that present node then is set is for empty, set up a new node again, the new node that the child nodes pointed that makes present node is set up in this step, and with described new node corresponding to present node a next stage split catalog of corresponding split catalog, return this step C then; Otherwise the child nodes pointer that makes present node is for empty, and the data pointer of present node is pointed to the memory headroom that is used to preserve the grouped data that the corresponding split catalog of present node comprised, execution in step D then;
D: judge whether the pairing split catalog of present node has the split catalog at the same level that does not join in this directory tree, if have, then set up a new node, the new node that makes this step of brotgher of node pointed of present node be set up, and with described new node corresponding to present node a split catalog at the same level that does not join in this directory tree of corresponding split catalog, return step C then; Otherwise, turn back to present node the pairing node of upper level split catalog of corresponding split catalog, and judge whether this node is root node, if then finish; Otherwise, make that this node is a present node, and return this step D.
3, method as claimed in claim 1 or 2, it is characterized in that, the described data pointer that makes node points to the memory headroom that is used to preserve the grouped data that the corresponding split catalog of this node comprised: make the data pointer of node point to an array of pointers, each pointer element of described pointer data will be pointed to the memory headroom of fixed size respectively, and the memory headroom of described fixed size will be used for the grouped data that the pairing split catalog of minute book node is comprised.
4, method as claimed in claim 3 is characterized in that, described method further comprises adds grouped data to certain split catalog, is specially:
A1: in described directory tree, find node that should split catalog according to the split catalog that will add to;
A2: first pointer element that this node data pointer array of pointers pointed is set is current pointer element;
A3: judge that whether current pointer element memory headroom pointed is empty, if, then to the memory headroom of a fixed size of internal memory application, and make this pointer element point to the memory headroom of new application, carry out A4 then; Otherwise, judge whether current pointer element memory headroom pointed is full, if it is the next pointer element of array of pointers that the current pointer element then is set, and returns this step then; Otherwise, execution in step A4;
A4: in the memory headroom of current pointer element directed, add the assortment data information that to add.
5, method as claimed in claim 4, it is characterized in that, each node on the described directory tree further comprise be used to identify this node the node identification of corresponding split catalog, when setting up each node, make the class indication of the node identification of each node by the corresponding split catalog of this node;
Described method further comprises: in internal memory, generate the node identification and the mapping table that points to this node place physical memory space pointer of a split catalog corresponding node in advance, and the mapping relations between the pointer of the node identification of when setting up each node, in the mapping table that generates in advance, preserving this node and this node place memory headroom of sensing;
Steps A 1 is described to find the node at described this split catalog place to comprise according to the split catalog that will add to:
In described mapping table, find the pointer of the node place memory headroom that points to the described split catalog correspondence that will add to;
Directly navigate to the node of the described split catalog correspondence that will add to by described this pointer.
6, a kind of split catalog querying method based on directory tree is characterized in that, each node on the described directory tree comprises child nodes pointer, brotgher of node pointer and data pointer at least;
The querying method of described split catalog comprises:
A, find the pairing node of this split catalog described catalogue seeds according to the split catalog that will inquire about;
B, judge that whether the child nodes pointer of this node is empty, if then this node is joined in the container, then execution in step d; Otherwise, execution in step c;
C, read the whole left branch of this node by recursive algorithm and comprise all leaf nodes, and all leaf nodes that will read join in the container successively, then execution in step c;
D, read leaf node successively from described container, the memory headroom according to reading leaf node data pointer points to obtains all grouped datas of storing in the described memory headroom, returns to the user.
7, method as claimed in claim 6, it is characterized in that, each node on the described directory tree further comprise be used to identify this node the node identification of corresponding split catalog, when setting up each node, make the class indication of the node identification of each node by the corresponding split catalog of this node;
Described method further comprises: in internal memory, generate the node identification and the mapping table that points to this node place physical memory space pointer of a split catalog corresponding node in advance, and the mapping relations between the pointer of the node identification of when setting up each node, in the mapping table that generates in advance, preserving this node and this node place memory headroom of sensing;
Step a is described to find the node at described this split catalog place to comprise according to the split catalog that will inquire about, browse:
A1, in described mapping table, find the pointer of the node place memory headroom that points to the described split catalog correspondence that will inquire about;
A2, directly navigate to the pairing node of the described split catalog that will inquire about, browse by described this pointer.
8, method as claimed in claim 6 is characterized in that, described container is the interim memory headroom that is used for temporarily depositing leaf node.
CNB2005101166630A 2005-10-26 2005-10-26 Sort data storage and split catalog inquiry method based on catalog tree Active CN100468402C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101166630A CN100468402C (en) 2005-10-26 2005-10-26 Sort data storage and split catalog inquiry method based on catalog tree

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101166630A CN100468402C (en) 2005-10-26 2005-10-26 Sort data storage and split catalog inquiry method based on catalog tree

Publications (2)

Publication Number Publication Date
CN1955958A true CN1955958A (en) 2007-05-02
CN100468402C CN100468402C (en) 2009-03-11

Family

ID=38063287

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101166630A Active CN100468402C (en) 2005-10-26 2005-10-26 Sort data storage and split catalog inquiry method based on catalog tree

Country Status (1)

Country Link
CN (1) CN100468402C (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010048856A1 (en) * 2008-10-30 2010-05-06 华为技术有限公司 Storage method and apparatus
CN102024019A (en) * 2010-11-04 2011-04-20 曙光信息产业(北京)有限公司 Suffix tree based catalog organizing method in distributed file system
CN102439598A (en) * 2011-09-15 2012-05-02 华为技术有限公司 Document template management method and system
CN101726312B (en) * 2008-10-15 2012-09-19 高德信息技术有限公司 Method and device for retrieving interest points
CN102768669A (en) * 2012-04-27 2012-11-07 新奥特(北京)视频技术有限公司 Method for realizing video file classification
CN102902734A (en) * 2012-09-12 2013-01-30 北京伸得纬科技有限公司 Method and system for catalogue storage and mapping
CN103020206A (en) * 2012-12-05 2013-04-03 北京海量融通软件技术有限公司 Knowledge-network-based search result focusing system and focusing method
CN103299297A (en) * 2011-12-28 2013-09-11 华为技术有限公司 File directory storage method, retrieval method and device
WO2015027932A1 (en) * 2013-08-28 2015-03-05 Tencent Technology (Shenzhen) Company Limited Multi-dimensional decomposition computing method and system
CN104572746A (en) * 2013-10-24 2015-04-29 世纪禾光科技发展(北京)有限公司 Matrix type information publish and access method and matrix type information publish and access system
CN105528461A (en) * 2016-01-12 2016-04-27 北京中交兴路车联网科技有限公司 Membership function based data system and method
CN105808770A (en) * 2016-03-22 2016-07-27 北京北方微电子基地设备工艺研究中心有限责任公司 File management method and device
CN106559278A (en) * 2015-09-25 2017-04-05 中兴通讯股份有限公司 data processing state monitoring method and device
CN106934033A (en) * 2017-03-14 2017-07-07 广东工业大学 A kind of bent plate robot data indexing means and device
CN107402977A (en) * 2017-07-03 2017-11-28 天脉聚源(北京)传媒科技有限公司 The method and apparatus for establishing video resource classification tree
CN108549676A (en) * 2018-03-30 2018-09-18 广州供电局有限公司 Display methods, device, computer equipment and the storage medium of electric power data
WO2018232871A1 (en) * 2017-06-23 2018-12-27 深圳市盛路物联通讯技术有限公司 Method and device for node information management
CN109710542A (en) * 2018-12-28 2019-05-03 北京像素软件科技股份有限公司 A kind of completely N-ary tree construction method and device
CN110019223A (en) * 2017-12-21 2019-07-16 天津数观科技有限公司 A method of the generation data family tree based on Data Storage Models
CN111339042A (en) * 2020-03-26 2020-06-26 佛山中科芯蔚科技有限公司 Data operation processing method and system and scheduling server
CN114328797A (en) * 2021-11-09 2022-04-12 腾讯科技(深圳)有限公司 Content search method, content search device, electronic device, storage medium, and program product

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101726312B (en) * 2008-10-15 2012-09-19 高德信息技术有限公司 Method and device for retrieving interest points
WO2010048856A1 (en) * 2008-10-30 2010-05-06 华为技术有限公司 Storage method and apparatus
US8341187B2 (en) 2008-10-30 2012-12-25 Huawei Technologies Co., Ltd. Method and device for storage
CN102024019B (en) * 2010-11-04 2013-03-13 曙光信息产业(北京)有限公司 Suffix tree based catalog organizing method in distributed file system
CN102024019A (en) * 2010-11-04 2011-04-20 曙光信息产业(北京)有限公司 Suffix tree based catalog organizing method in distributed file system
CN102439598A (en) * 2011-09-15 2012-05-02 华为技术有限公司 Document template management method and system
WO2012083735A1 (en) * 2011-09-15 2012-06-28 华为技术有限公司 Document template management method and system
CN103299297A (en) * 2011-12-28 2013-09-11 华为技术有限公司 File directory storage method, retrieval method and device
CN102768669A (en) * 2012-04-27 2012-11-07 新奥特(北京)视频技术有限公司 Method for realizing video file classification
CN102902734A (en) * 2012-09-12 2013-01-30 北京伸得纬科技有限公司 Method and system for catalogue storage and mapping
CN103020206A (en) * 2012-12-05 2013-04-03 北京海量融通软件技术有限公司 Knowledge-network-based search result focusing system and focusing method
WO2015027932A1 (en) * 2013-08-28 2015-03-05 Tencent Technology (Shenzhen) Company Limited Multi-dimensional decomposition computing method and system
US10282366B2 (en) 2013-08-28 2019-05-07 Tencent Technology (Shenzhen) Company Limited Multi-dimensional decomposition computing method and system
CN104572746A (en) * 2013-10-24 2015-04-29 世纪禾光科技发展(北京)有限公司 Matrix type information publish and access method and matrix type information publish and access system
CN104572746B (en) * 2013-10-24 2018-03-20 世纪禾光科技发展(北京)有限公司 A kind of matrix form information issue and access method and system
CN106559278A (en) * 2015-09-25 2017-04-05 中兴通讯股份有限公司 data processing state monitoring method and device
CN106559278B (en) * 2015-09-25 2020-09-15 中兴通讯股份有限公司 Data processing state monitoring method and device
CN105528461A (en) * 2016-01-12 2016-04-27 北京中交兴路车联网科技有限公司 Membership function based data system and method
CN105808770A (en) * 2016-03-22 2016-07-27 北京北方微电子基地设备工艺研究中心有限责任公司 File management method and device
CN106934033A (en) * 2017-03-14 2017-07-07 广东工业大学 A kind of bent plate robot data indexing means and device
WO2018232871A1 (en) * 2017-06-23 2018-12-27 深圳市盛路物联通讯技术有限公司 Method and device for node information management
CN107402977A (en) * 2017-07-03 2017-11-28 天脉聚源(北京)传媒科技有限公司 The method and apparatus for establishing video resource classification tree
CN110019223A (en) * 2017-12-21 2019-07-16 天津数观科技有限公司 A method of the generation data family tree based on Data Storage Models
CN108549676A (en) * 2018-03-30 2018-09-18 广州供电局有限公司 Display methods, device, computer equipment and the storage medium of electric power data
CN108549676B (en) * 2018-03-30 2020-02-18 广州供电局有限公司 Display method and device of power data, computer equipment and storage medium
CN109710542A (en) * 2018-12-28 2019-05-03 北京像素软件科技股份有限公司 A kind of completely N-ary tree construction method and device
CN111339042A (en) * 2020-03-26 2020-06-26 佛山中科芯蔚科技有限公司 Data operation processing method and system and scheduling server
CN111339042B (en) * 2020-03-26 2024-03-01 北京快映互娱传媒有限公司 Data operation processing method, system and scheduling server
CN114328797A (en) * 2021-11-09 2022-04-12 腾讯科技(深圳)有限公司 Content search method, content search device, electronic device, storage medium, and program product
CN114328797B (en) * 2021-11-09 2024-03-19 腾讯科技(深圳)有限公司 Content search method, device, electronic apparatus, storage medium, and program product

Also Published As

Publication number Publication date
CN100468402C (en) 2009-03-11

Similar Documents

Publication Publication Date Title
CN1955958A (en) Sort data storage and split catalog inquiry method based on catalog tree
CN1299223C (en) Providing a consistent hierarchical abstraction of relational data
CN104199827B (en) The high dimensional indexing method of large scale multimedia data based on local sensitivity Hash
CN104021161B (en) A kind of clustering storage method and device
CN1203433C (en) Data storing and query combination method in a flush type system
JP2014099163A (en) Method, system, and computer program product for hybrid table implementation using buffer pool as permanent in-memory storage for memory-resident data
US7822776B2 (en) Multidimensional dynamic clustering (MDDC)
CN101039278A (en) Data management method and system
CN1838124A (en) Method for rapidly positioning grid + T tree index in mass data memory database
US20150356137A1 (en) Systems and Methods for Optimizing Data Analysis
CN106294374A (en) The method of small documents merging and data query system
CN102243660A (en) Data access method and device
CN1492362A (en) Data back up and recovering method of embedded data bank
CN1845093A (en) Attribute extensible object file system
CN101051309A (en) Researching system and method used in digital labrary
CN1545048A (en) Method for implementing tree storage and access by two-dimensional table
CN100338607C (en) Method for organizing and accessing distributive catalogue of document system
US20240126762A1 (en) Creating compressed data slabs that each include compressed data and compression information for storage in a database system
CN1858743A (en) Information searching method and device in relation ship data bank
CN101030230A (en) Image searching method and system
CN103064841A (en) Retrieval device and retrieval method
CN1687899A (en) Method, system and module for dynamic downloading of applied programe to user identification
WO2021016050A1 (en) Multi-record index structure for key-value stores
CN1838118A (en) File management method
CN103870557A (en) Database-based electronic file storage system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING JINGDONG SHANGKE INFORMATION TECHNOLOGY CO

Free format text: FORMER OWNER: TENGXUN SCI-TECH (SHENZHEN) CO., LTD.

Effective date: 20140425

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 518044 SHENZHEN, GUANGDONG PROVINCE TO: 100080 HAIDIAN, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20140425

Address after: 100080 Beijing, Suzhou Street, No. 20, building 2, floor 2,

Patentee after: Beijing Jingdong Shangke Information Technology Co., Ltd.

Address before: Shenzhen Futian District City, Guangdong province 518044 Zhenxing Road, SEG Science Park 2 East Room 403

Patentee before: Tencent Technology (Shenzhen) Co., Ltd.