class Pair {
private:
double edge_weight;
int adjacent_vertex;
public:
Pair(int, double); // constructor
double weight() const;
int vertex() const;
};
void insert(int i, int j, double w) {
if (i < j) {
array[j].push_front(Pair(i,w));
} else {
array[i].push_front(Pair(j,w));
}
}
/** main **/
SingleList<Pair> * array;
array = new SingleList<Pair>[N];
In [ ]: