ECE608 Homework #5 Solution
(1) CLR 6.1-6
No, h23, 17, 14, 6, 13, 10, 1, 5, 7, 12i is not a heap because the heap property does not
hold between the 4th element and its second child, the 9th element (
Spring 2016
ECE608, Homework #10 Solution
(1) CLR 22.1-6
We are looking for a universal sink i.e., a vertex with in degree of |V | 1 and out
degree of zero. In the adjacency matrix the elements in row
ECE608, Homework #2 Solution
(1) CLR 3.1-2
To show that (n + a)b = (nb ), we want to find constants c1 , c2 , and n0 > 0 such
that 0 c1 nb (n + a)b c2 nb for all n n0 . Note that n + a n + |a| 2n, whe
ECE608, Homework #11 Solution
(1) CLR 22.3-7
DFS-STACK(G)
1. for each vertex u V [G]
2.
do color[u] WHITE
3.
[u] NIL
4. time 0
5. for each vertex u V [G]
6.
do if color[u] = WHITE
7.
then DFS-VISIT-ST
ECE608 Homework #7 Solution
(1) CLR 11.1-1
To find the maximum element of the set S, it requires searching the entire table T
in the worst case. Note that NIL is returned if there are no elements in t
EE608, Homework #1 Solution
(1) CLR 1.2-2
INSERTION-SORT beats MERGE-SORT when 8n2 < 64n lg n, n < 8 lg n,
n
< lg n, 2n/8 < n, which is true when 2 n 43.
8
(You can solve for n by trial and error usi