Algorithm 1: Optimal mobile sink selection algorithm.

Input: mobile sinks details, sensor node location
Begin
Listen t
SINK_ID=SINK_1; maxConnection=0 ;
for every SINK SINKi do
if(CETSINKi>maxConnection)then
maxConnection=CETSINKi;
SINK_ID=SINKi ;
else if(CETSINKi=maxConnection)then
if(MembersNo SINKi<Κ)then
SINK_ID=SINKi;
return SINK_ID;
End
Output: ID of the selected optimal mobile sink