AlgoHW4_dev: Added final code for Algo hw 4