(1) For each node sensed data Do
(2) If then
(3)  sends data to the sink directly
(4) End if
(5) Else if then
(6)  While Do
(7)   transmits data to :
(8)  Let
(9)  End while
(10)  While Do
(11)   transmits data to : and
(12)  Let
(13)  End while
(14)  End else
(15)  Else if then
(16)  While Do
(17)    transmits data to :
(18)   Data stops at for for data fusion
(19)   Let
(20)  End while
(21)  While Do
(22)     transmits data to : and
(23)   Data stops at for for data fusion
(24)   Let
(25)  End while
(26) End else
(27) End for
Algorithm 2: Data routing under DSDR scheme.