Algorithm part II

- Fixed some logical error
- generated some part of Iteration 0