iterative solution added. the time differnece between them are printed.