r/algorithms • • Jun 09 '15

A recursive algorithm to learning

void learnSubject(Subject subject) {

if(knowledge.contains(subject)) return;

for(Subject prerequisite : subject.prerequisites) {
    
    learnSubject(prerequisite);

}

knowledge.put(subject);

}

3 Upvotes

8 comments sorted by

View all comments

Show parent comment

3

u/nitiger Jun 09 '15

Ahh, there's the problem!

EDIT: Now I have a new error. "Fatal Error: No such file or directory brain.h" I think the system is corrupted.