The most important criterion for achieving the maximum performance in wirless sensor and ad-hoc networks is to clustering the nodes. Many clustering schemes have been proposed for different ad-hoc networks. In sensor networks the energy stored in the network nodes is limited and usually infeasible to recharge. The clustering schemes for these networks therefore aim at maximizing the energy efficiency. In mobile ad hoc networks the moment of the network nodes may quickly change the topology resulting in the increase of the overhead message in topology maintenance, the clustering schemes for mobile ad hoc networks therefore aim at handling topology maintenance, managing node movement or reducing overhead. In this paper we proposed an algorithm which gives connected dominating set of a tree.