Method for setting up tree-shaped data structure applied to online education system

A technology of data structure and establishment method, applied in the field of data processing, can solve the problems of low query efficiency, difficult to support data expansion and infinite depth of sub-node cascade, etc., to achieve the effect of improving efficiency

Inactive Publication Date: 2014-07-23
上海德上网络科技有限公司
View PDF2 Cites 7 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

This recursive operation to complete the query efficiency of database addition, deletion, modification, and query is too low, especially in a deeply nested application sc

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for setting up tree-shaped data structure applied to online education system
  • Method for setting up tree-shaped data structure applied to online education system
  • Method for setting up tree-shaped data structure applied to online education system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0032] see figure 2 , which is a simple finite-level tree data structure.

[0033] First, starting from the root node, according to the order from top to bottom, from left to right, according to the rules of increasing sequence, define a left number value Lft and a right number value Rgt for each node in sequence; when setting the root node The initial value starts from 1, and when the increment is 1, according to the query formula: ROUND((Rgt-Lft-1) / 2), get figure 2 The left and right number values ​​of the nodes shown. Preferably, the numbering rules of the left numbered value Lft and the right numbered value Rgt are implemented by the CPU through logic operations.

[0034] According to create a tree data storage structure, establish such as image 3 The relational data table shown.

Embodiment 2

[0036] The tree data storage structure is an infinite hierarchical tree data structure.

[0037] In more application scenarios, under the new data storage structure, let's take a look at the solutions corresponding to several practical application scenarios that we usually encounter in applications. Here, we take the infinite-level tree menu data as an example to create a relational data table as follows:

[0038]

[0039] In this relational data table, we insert a small amount of sample data so that the results can be seen intuitively in subsequent query applications:

[0040]

[0041] / / Remove all leaves:

[0042] select*from menutree where rht=lft+1;

[0043] / / Get the path of a node:

[0044]

[0045] / / Get all the trees and the depth of each node:

[0046] SELECT node.name,(COUNT(parent.name)-1) AS depth

[0047] FROM menutree AS node,menutree AS parent

[0048] WHERE node.lft BETWEEN parent.lft AND parent.rgt

[0049] GROUP BY node.name

[0050] ORDER BY n...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for setting up a tree-shaped data structure applied to an online education system. The method includes the following steps of sequentially defining a left serial number numerical value Lft for recognition and a right serial number numerical value Rgt for recognition for each node from top to bottom and from left to right from the root node according to the ascending series rule; finding the number of sub-nodes of each node according to the left serial number numerical value Lft and the right serial number numerical value Rgt of the node, wherein the finding formula is ROUND((Rgt-Lft-incremental change)/2); setting up the tree-shaped data storage structure, and setting up a relation data table matched with the tree-shaped data storage structure. By means of the method, efficiency of increasing, deleting, changing and finding operations for tree-shaped data can be greatly improved; in the online video education system, infinite cascading of course column classified sub-columns and infinite cascading of the organization structure are achieved by storing the tree-shaped data structure in a relation database through the left serial number numerical values and the right serial number numerical values of the nodes.

Description

technical field [0001] The invention relates to the technical field of data processing, in particular to a method for establishing a tree data structure applied in an online education system. Background technique [0002] In the online education system, there are many tree-shaped data. For example, the course classification is a tree structure, the root node is "All Classifications", and there are first-level classification nodes under the root node, such as "Chinese Studies, EQ, Art and Taste Cultivation, Career Planning, Employment Skills, Entrepreneurship Innovation", etc. Sub-category column, and under the sub-column of Guoxue, it can be subdivided into sub-column categories such as "appreciation of famous works, wisdom of Sun Tzu's art of war, wisdom of Zhouyi, theory of five elements", etc., and so on. To give another example, the organizational structure of the school, that is, the departments under the school, the subdivided departments and classes under the departm...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F17/30
CPCG06F16/958G06F16/2246G06F16/70
Inventor 王健
Owner 上海德上网络科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products