In-network processing is an efficient way to reduce the transmission cost in wireless sensor networks (WSNs). The in-network processing of many domain-specific computation tasks in WSNs usually requires to losslessly distribute the computation of the tasks into the sensor nodes, which is however usually not easy. In this paper we are concerned with such kind of tasks whose computation can only be partitioned into recursive computation mode. To distribute the recursive computations into WSNs, it is required to design an appropriate single in-network processing path, along which the intermediate data is forwarded and updated in the WSNs. We address the recursive computation with constant size of computation result, e.g., distributed least square estimation (D-LSE). Finding the optimal in-network processing path to minimize the total transmission cost in WSNs, is a new problem and seldom studied before. To solve it, we propose a novel routing algorithm called as S-TSP, and compare it with some other greedy algorithms. Extensive simulations are conducted, and the results show the good performance of the proposed S-TSP algorithm.