/// Find all leaf Node%s in this Tree. LIST<const Node*> Tree::leaves() const { LIST<const Node*> leaves; vector<Node>::const_iterator n; for (n = nodes.begin(); n != nodes.end(); n++) { if (n->is_leaf()) leaves.insert(leaves.end(), &(*n)); } return leaves; }
int get_max(LIST &list) { int max = 0; LIST::iterator it; for(it = list.begin(); it != list.end(); it++) { if(max<*it) { max = *it; } } return max; }
LIST my_unique(const LIST& list) { LIST new_list; for (auto it = list.begin() ; it != list.end() ; ++it) { auto exists = std::find(new_list.begin(), new_list.end(), *it); if (exists == new_list.end()) new_list.push_back(*it); } return new_list; }