- Example:
the distance
between cities
"Atlanta" "New York" "San Francisco"
"Atlanta" 0 863 2482 // Row 0
"New York" 863 0 2906 // Row 1
"San Francisco" 2482 2906 0 // Row 2
|
- How we can use
a
2-dim-array to
store
distance information between
cities:
double[][] distances = {
{0, 863, 2482}, // Row 0
{863, 0, 2906}, // Row 1
{2482, 2906, 0} // Row 2
};
|
|