// CS1501 Demo of PQ with indirection #include #include "pq.h" void main() { int w[8], ind; for (int i = 1; i < 8; i++) { cout << "Enter value for index " << i << ": "; cin >> w[i]; } PQ pq(8); // make a new PQ for (int i = 1; i < 8; i++) { cout << "Inserting: " << w[i] << endl; pq.insert(i, w[i]); } for (int i = 1; i <= 2; i++) // change 2 vals to see effect { cout << "Pick an index: "; cin >> ind; cout << "Enter a new value: "; cin >> w[ind]; pq.change(ind, w[ind]); } cout << endl << "Now all items will be removed " << endl << endl; for (int i = 1; i < 8; i++) { int loc = pq.remove(); int val = w[loc]; cout << "The next index is " << loc << " with weight " << val << endl; } }