Add missing include <algorithm>
Change variable and type names for clarification

This change is to emphasize the feature tree
PrevClass -> ParentFeature
prev_class -> parent_feature
addListener -> addChildFeature
removeLIstener -> removeChildFeature