I have an assignment which says I have to read from file the distances between 20 citys each. I wonder how to handle that data in the application. I thought of multidimensional array, something like Distances(0, 1, 0)=500 which means that the distance between city0 and city1 is 500 miles. Also I think this is a waste of memory because Distances(0, 1, 0) and Distances(1, 0, 0) is the same thing. My mentor told me to use triangular matrix to save the data into the app. Can you show me an example of a similar data handling or some other idea of how to handle the data? I just can’t imagine it. Thank you!
I have an assignment which says I have to read from file the distances
Share
What I think he means is something like this:
http://www.arenalogisticsinc.com/images/chart4.jpg
Basically a 2-D array – And if you want to save space, just remove the top half of the array since it will have repetitions.
Hope this helps.