Define the set as the set of IDS nodes,
and the set as the set of all nodes
  
step 1. Node , which has maximum remaining
    battery ( ) in the set , monitors its
    neighbor node set
    .
  
step 2. Remove the set from the set , and
    remove the node k from the set
  
step 3. If the set is empty, then stop.
    Otherwise, go to the step 1.
if     then  STOP  else  Goto  step  1
Algorithm 1: The assignment algorithm.