added weight calculation in kruskal and programs given in the exam with inputs