Function  BPA_Process(QUERY q, SENSOR_NODE  nodelist )
Input   q:  Query Information, nodelist : Information of Sensor Nodes
Output    BUCKET_LIST bkl:  Information of bucket List
(1)    SENSOR_NODE rnode = RNode_Search(q, nodelist)
(2)    HROUTE hr = HRoute_Build(rnode, nodelist)
(3)    HR_SENSOR_NODE_INFO sni = SensorInfo_Collection(hr,MBR())
(4)    QT_NODE qn = QT_Build(sni, nodelist)
(5)    IROUTE ir = QT_CNode_Itinerary(qn, nodelist)
(6)    if(QNodeIs() ∣∣ DNodeIs())
(7)    {
(8)      QNode_Query_Send(q, ir)
(9)        If(!QNode_Filtering())
(10)       {
(11)        Bucket_Build(Bucket_Update())
(12)        Compress_Value()
(13)        BUCKET_LIST bkl = QNode_Duplicate_Result_Send(ir)
(14)        return bkl;
(15)       }
(16)         If(!DNode_Filtering())
(17)       {
(18)         Bucket_Build(Bucket_Update())
(19)         Compress_Value()
(20)         BUCKET_LIST bkl = DNode_Duplicate_Result_Send(ir)
(21)         return bkl;
(22)       }
(23)       }
(24)       else
(25)       {
(26)       MissingNode_Send_Result()
(27)       }
Algorithm 1: Algorithm of BPA.