ok, that helped a little but i still don't understand how to implement that into the function. The way the program works is the function insertinorder is called to insert one city at a time, so if there are 10 cities, it runs through the function ten times.