A dualized Kaczmarz algorithm in Hilbert and Banach space