second assigment of Algorithm1