The Algorithm in Psychical and Pedagogical Processes and Its Theoretical Reflection