Research Article

An Energy-Aware Routing Protocol for Query-Based Applications in Wireless Sensor Networks

Algorithm 1

The decision maker (DM) algorithm.
Input: , ,
Input: , ,
Output: next-hop node
(1)foreach  packet to be forwarded do
(2)  If ( == )
(3)    send the packet to the selected neighbor;
(4)  // If IDs do not match then run tie-breaking rules;
(5)  else  if ( > ) && ( < ) then
(6)     choose as the next-hop;
(7)  else  if ( < ) && ( > ) then
(8)    choose as the next-hop;
(9)  else choose the one with the highest energy;