algo3: hw4: finished