Flooding and random walk (RW) are the two typical search algorithms in unstructured peer-to-peer networks. The flooding algorithm searches the network aggressively. It covers the most nodes but generates a large number of query messages. Hence it is considered to be not scalable. This cost issue is especially serious when the queried resource locates far from the query source. On the contrary, RW searches the network conservatively. It only generates a fixed amount of query messages at each hop, but it may take particularly longer search time to find the queries resource. We propose the dynamic search algorithm (DS) which is a generalization of flooding, modified breadth first search (MBFS), and RW. This search algorithm takes advantage of different contexts under which each previous search algorithm performs well. The operation of DS resembles flooding or MBFS for the short-term search, and RW for the long-term search. We analyze the performance of DS based on the power-law random gra...