# Combined Sweeping and Jumping Method to Enhance Node Insertion Algorithm for Wi-Fi Sensor Networks
## 2 Combined Sweeping and Jumping Method
This process of updating \(D_{j}\)'s can be simplified by the preceding equation. Initially, all \(D_{j}\)'s are set to 0. After the insertion of sensor 1, for all the unselected sensor \(j\)'s that do not have the connectivity with sensor 1, \(D_{j}\)'s are switched to 1; therefore, \(D_{4}=D_{5}=\ldots=D_{10}=1\). After the second insertion of sensor 3, for all the unselected sensor \(j\)'s that do not have the connectivity with sensor 3, \(D_{j}\)'s are switched to 2; therefore, \(D_{6}=D_{7}=\ldots=D_{12}=2\). Sequentially updating \(D\)'s using the preceding equation, the result of \(D_{j}\)'s matches with \(D_{j}\)'s that are directly obtained from the equation that defines \(D_{j}\)'s. In the proposed sweeping method, an arbitrary sensor is initially inserted into the sequence, and after that, \(D_{j}\) is scanned for sensor \(j\) from \(j=1\) to \(j=l\), and all the unselected sensor \(j\)'s such that \(D_{j}=m=0\) are sequentially inserted into the sequence. Every time when a new sensor is inserted into the sequence, \(D_{j}\) should be updated according to the preceding equation before the insertion of a new sensor into the sequence. After the completion of scanning \(D_{j}\) with \(m=0\), \(D_{j}\) is scanned for sensor \(j\) from \(j=1\) to \(j=l\), and all the unselected sensor \(j\)'s such that \(D_{j}=m=1\) are sequentially inserted into the sequence. Continuously increasing \(m\) by 1, \(D_{j}\) is scanned for sensor \(j\) from \(j=1\) to \(j=l\), and all the unselected sensor \(j\)'s such that \(D_{j}=m\) are sequentially inserted into the sequence. Every time when a new sensor is inserted into the sequence, \(D_{j}\) should be updated according to the preceding equation. This process of inserting the sensors into the sequence continues until all the sensors are covered by the constructed sequence. In the proposed sweeping method, \(m\) cannot exceed \(l\); therefore, the proposed sweeping method has the computational complexity of \(O(l^{2})\), which is far lower than the computational complexity of the original node insertion algorithm. Let us apply the proposed sweeping method to the wireless sensor network in Figure 1. After inserting the first sensor of sensor 5, \(D=[1,\ 1,\ 0,\ 0,\ -1,\ 0,\ 0,\ 1,\ 1,\ 1,\ 1,\ 1]\). Scanning \(D\) with \(m=0\) from \(j=1\), sensor 3 is inserted as the second sensor in the sequence, and \(D=[1,\ 1,-1,\ 0,\ -1,\ 2,\ 2,\ 2,\ 2,\ 2,\ 2,\ 2]\). Scanning \(D\) with \(m=0\) from \(j=4\), sensor 4 is inserted as the third sensor in the sequence, and \(D=[3,\ 1,-1,-1,-1,\ 2,\ 3,\ 3,\ 3,\ 3,\ 3,\ 3]\). Scanning \(D\) with \(m=1\) from \(j=1\), sensor 2 is inserted as the fourth sensor in the sequence, and \(D=[3,-1,-1,-1,-1,\ 4,\ 4,\ 4,\ 4,\ 4,\ 4,\ 4,\ 3]\). Scanning \(D\) with \(m=2\), no sensor \(j\) is found such that \(D_{j}=m=2\). Scanning \(D\) with \(m=3\), sensor 1 is inserted as the fifth sensor in the sequence, and \(D=[-1,-1,-1,-1,-1,\ 5,\ 5,\ 5,\ 5,\ 5,\ 4,\ 3]\). Continuing the proposed sweeping method for the wireless sensor network in Figure 1, [sensors 5, 3, 4, 2, 1, 12, 11, 10, 9, 8, 7, 6] is the final constructed serially connected single multipolling sequence, by which all 12 sensors can be multipolled by the AP. Now, the proposed jumping method is explained. After each scanning process of the proposed sweeping method for \(D_{j}\) from \(j=1\) to \(j=l\), the minimal value of \(D_{j}\)'s for unselected sensor \(j\) can be obtained. Since \(D_{j}\) does not decrease, it is advantageous to scan \(D_{j}\) with the \(m\) set to this minimal value instead of increasing \(m\) by just 1, for the next scanning process for \(D_{j}\) from \(j=1\). This method of scanning \(D\) with the \(m\) set to the minimal value of the previous scanned values of \(D_{j}\)'s for unselected sensor \(j\) is called the jumping method. The proposed jumping method accelerates the search speed of the sweeping method by scanning \(D\) with \(m\) increased by more than 1.