[Edit] Added mergesort iterative version