Distributed algorithm for minimizing delay in multi-hop wireless sensor networks