This paper studied how two parties collaboratively built a decision tree on the union of their dataset without revealing privacy when dataset is vertically and horizontally distributed. We gave an algorithm of privacy preserving C4.5 which is applicable to vertically and horizontally partitioned dataset, and also gave the detailed computation method of the information gain ratio in the case of without revealing privacy. The secure scalar product protocol, the xln(x) protocol and the secure sum protocol are used in collaborative computing, which can protect privacy effectively.