4.12.3 Appendix (Implementation of part(a) and part(b))

The graph for part(a) and part(b) is the following