I'm trying to build a data tree like the one shown below, and I need an efficient matching algorithm that can do the following.
You can think of this tree as a list of prerequisites for taking courses. For example, course1 has prerequisite 3 and 4, and course 3 has prerequisites 7 and 8. If one wants to take course1, he/she must take both 3 and 4, or all prerequisites for course3 or course4 (so if he/she took 7,8,4, it's equivalent to having taken 3 and 4).
Now a kid comes and says he wants to take course2, providing that he took course 8,9 and 6 in advance. How can I quickly check if he is eligible?
The only way I can think of right now is to construct a look-up table that contains all combinations of prerequisites, and checks through it to find the match. However, as the tree grows bigger(I'm trying to build one with potentially >10,000 nodes), this method is going to blow up my computer.
Does anyone have any advice for this? Or better yet, is there a well-defined searching algorithm that can handle this type of task already? Thanks in advance. Jim

Fig: Some arbitrary data tree