In this project, we developed an adaptive multihop clustering algorithm MaxLife for sensor networks. MaxLife significantly improves sensor network lifetime by balancing energy dissipation and minimizing energy consumption at the same time. The algorithm is compared to Random and MinEnergy algorithms and shows great performance gain. Random is extended from its original design of single hop clustering in  to multihop clustering, which elects cluster heads with absolute fairness. However, the idea of rotating the role of cluster heads does not work well in a multihop environment, because relay nodes can also drain out energy quickly. MinEnergy chooses cluster heads to minimize total energy consumption, which leads to large energy disparity and hurts long-term performance. MaxLife on the other hand, uses global optimization techniques and directly maximizes network lifetime. Simulation results verified that MaxLife achieves the best tradeoff between fairness and energy efficiency, and the clustering topology computed from it has significantly longer lifetime than those from the other two algorithms.