(9 pts) In this problem you will practice insertion and deletion in binary heaps.
Do insert and deleteMin of a binary heap have the same big-O time complexity? (1 pts)
Show the final result of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13 and 2 into an initially empty binary heap. (4 pts)
Show the results of two consecutive deleteMin of the heap above. (4 pts)
(8 pts) Show the following regarding the maximum item in a min-heap with N distinct items:
It must be at one of the leaves, and every leaf must be examined to find it. (3 pts)
There are exactly N/2 (if N even) or (1+N)/2 (if N odd) leaves. (5 pts)
(8 pts) Exercise 9.1. (Fig. 9.79, same for the C++ book) Find the topological ordering of the given graph (ignoring the given weights on the edges) using the topological sort algorithm. NOTE: if there is a tie, the alphabetic order of a node serves as its priority.
(8 pts) Exercise 9.5a. (Same for the C++ book) Use Dijkstra's algorithm to find the shortest path to each of the nodes, starting from node A in the graph of Figure 9.80.
(10 pts) The same graph (Fig 9.79, ignoring the given weights on the edges) as Exercise 9.1, starting from the node s, give the ordering of nodes that will be visited by:
DFS. (5 pts)
BFS. (5 pts)
NOTE: if a node has several successive nodes to visit, the alphabetic order of a successive node serves as its priority.