In-network processing is touted as a key technology to eliminate data redundancy and minimize data transmission, which are crucial to saving energy in wireless sensor networks (WSNs). Specifically, operators participating in in-network processing are mapped to nodes in a sensor network. They receive data from downstream operators, process them and route the output to either the upstream operator or the sink node. The objective of operator tree placement is to minimize the total energy consumed in performing in-network processing. Two types of placement algorithms, centralized and distributed, have been proposed. A problem with the centralized algorithm is that it does not scale to large WSN’s, because each sensor node is required to know the complete topology of the network. A problem with the distributed algorithm is their high message complexity. In this paper, we propose a heuristic algorithm to place a tree-structured operator graph, and present a distributed implementation to optimize in-network processing cost and reduce the communication overhead. We prove a tight upper bound on the minimum in-network processing cost, and show that the heuristic algorithm has better performance than a canonical greedy algorithm. Simulation-based evaluations demonstrate the superior performance of our heuristic algorithm. We also give an improved distributed implementation of our algorithm that has a message overhead much lower than other approaches.