Changed explanation,code and visualization for question 2