In this paper we consider, in the general context of CATp0q spaces, an iterative schema which alternates between Halpern and Krasnoselskii-Mann style iterations. We prove, under suitable conditions, the strong convergence of this algorithm, benefiting from ideas from the proof mining program. We give quantitative information in the form of effective rates of asymptotic regularity and of metastability (in the sense of Tao). Motivated by these results we are also able to obtain strongly convergent versions of the forward-backward and the Douglas-Rachford algorithms. Our results generalize recent work by Bot ¸, Csetnek and Meier, and Cheval and Leuştean.