void orderCities(LList<int>& ord, graph<int>& g, LList<City>& all, int cityId, int p){ // OK LList<int> cities; findCities(g, cities, cityId, p); LList<int> ordered; while (!cities.empty()){ int max = getMaxCity(cities, all); deleteCity(cities, max); ordered.toEnd(max); } ord = ordered; }
void addTops(graph<int>& g, LList<int> l) { if (l.empty()) return; l.IterStart(); elem<int>* e = l.Iter(); while (e) { g.addTop(e->inf); e = e->link; } }
LList<int> citiesToInt(LList<City> c) { if (c.empty()) return LList<int>(); LList<int> temp; elem<City>* e; c.IterStart(); e = c.Iter(); while (e) { City a = e->inf; temp.ToEnd(a.ID); e = e->link; } return temp; }
//Подточка б) bool contains(LList<int> l,LList<int> c) { if (l.empty()) return false; l.IterStart(); elem<int>* e = l.Iter(); while (e) { c.IterStart(); elem<int>* p = c.Iter(); while (p) { if (e->inf == p->inf) return true; p = p->link; } e = e->link; } return false; }