Added iterative (stack) implementation and tests for it.