Description
(Exercise 16.12)
Use the algorithm from section 16.5 to implement the PriorityQueue class so that it uses a heap as its underlying representation. To eliminate some of the complexity, feel free to use a vector instead of a dynamic array.
Requirments & Hints:
You need to finish all TODO parts in P1PriorityQueue.h.
Problem 2
Part1: (Exercise 18.03)
Eliminate the recursion from the implementation of depthFirstsearch by using a stack to store the unexplored nodes. At the beginning of the algorithm, you simply push the starting node on the stack. Then, until the stack is empty, you repeat the following operations: 1. Pop the topmost node from the stack; 2. Visit that node; 3. Push its neighbors on the stack.
Part2: (Exercise 18.04)
Take your solution from the preceding exercise and replace the stack with a queue. Describe the traversal order implemented by the resulting code.
Requirments & Hints:
The implementation of simplegraph is provided. You need to finish all TODO parts in P2Traverse.cpp.
Requirements for Assignment
I’ve provided a project named Assignment6.pro. You need to write all TODO parts in the codes. The AirlineGraph.txt is located under src folder. Finally, please pack your whole project folder into a single .zip file, name it using your student ID (e.g. if your student ID is 123456, hereby the file should be named as 123456.zip ), and then submit the .zip file via BB system.
Reviews
There are no reviews yet.