| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Any ideas to improve search performance in a tree structure
Hello everyone,
I am developing an application which contains a tree structure. The tree structure reflects the management structure of a big company -- child node represents the employees managed by direct manager (parent node), one parent node may have multiple (various) number of child nodes (employees he/she managed in his/her department). I need to find all the employees a manager managed in the tree structure, the direct child node, the child node's child node, ... and so on (for example, if he is a senior manager, there are multiple levels of child nodes). Currently, I am using brute force tree traverse approach to print all (direct and indirect) child nodes -- layer by layer. The tree is very large. I am wondering whether there are any good ideas about how to improve the search performance? thanks in advance, George |
|
#2
|
|||
|
|||
|
You mean the tree is not binary in nature and is m-ary tree. Seaching is easier for such trees but deletion and insertions are a pain.
Can use breadth first searching technique to ascertain the number of employees in a department (respresented by parent node) . The BFS runs level by level. |
|
#3
|
|||
|
|||
|
Thank you Cirus,
Quote:
Do you mean using normal BFS algorithm to traverse the tree layer by layer? It is what I am doing now. :-) I am looking for new ways to improve the performance. Insert and delete operations can be ignored -- they do not happen too often. regards, George |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Any ideas to improve search performance in a tree structure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|