我可以使用什么样的算法从相互数据库表中提取父节点和子节点? [英] What proper algorithm can I use to extract parent node and child node from a mutual database table?

查看:70
本文介绍了我可以使用什么样的算法从相互数据库表中提取父节点和子节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器获得了一个数据库表。例如,名为DepartmentInformation.There的表中保存了一些部门名称和子部门名称以及子子部门名称(如下所示)。举个例子, 00代表最高级别的部门名称,01,02......(像那样)是00的子部门,继续,0101是子部门名称01 ,010101是0101的子项...(子项的长度比其父项的节点名长,但子项的标题子字符串与父项的相同)。他们被保存在一个共同的桌子里。



I got a database table from a server.For example,the table named DepartmentInformation.There saved some department name and sub-department name and sub-sub-sub-department name(like this) in it.Taking an example,"00" stands for the highest class department name,and "01" , "02" ... (like that) are the sub-department of "00", continuing, "0101" is the sub-department name of "01" ,"010101" is the sub-item of "0101" ... (the sub-item's length is longer than its parent's node name,but the header sub-string of sub-item is the same as the parent's) ... they were saved in a mutual table.

But I am afraid that it slow down the speed because of the much amount of data(around 80 thousands).





那么我可以试试哪种合适的算法?谢谢你的回答!



我尝试了什么:



我用从数据库中保存表数据的地图数据结构。我准备采用递归的方式来提取父项和子项。首先,我将使用以下方法在地图中找到根项。递归算法。然后找到根项的子项,如下所示...



So what kind of proper algorithm can I take a try? Thanks for answering!

What I have tried:

I use the map data structure to save the table data from the database.I am ready to take the recursion way to extract the parent-item and child-item.First of all,I am going to find the root item in the map by using the recursion algorithm.And then find the sub-item of the root item,like this ...

推荐答案

我已在前一个问题中解释了这个问题:如何根据使用MFC树的某些关系表来表示树控制 [ ^ ]。如果你想同时处理80,000条记录,那么你的申请将会很慢。
I already explained the issue in your previous question: How to represent a tree according to some relational tables which uses the MFC tree control[^]. If you want to process 80,000 records all at the same time then your application will be very slow.


这篇关于我可以使用什么样的算法从相互数据库表中提取父节点和子节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆