# Cluster-Based Data Aggregation in Flying Sensor Networks Enabled Internet of Things
## 4 Data Aggregation and Communication
### Data Aggregation Level 2 Algorithm  
**Theorem 5**: _Given a text, \(t\), and string \(s\), to resolve the data-matching issue with moves by calculating an \(O(log\ n\ log^{*}n)\) approximation to \(D[loc]=min\_loc\leq loc_{3}\leq n\ d(s,\ t[loc\ldots loc_{3}])\) for each loc in time \(O(n\ log\ n)\)._  
**Proof. ** Our algorithm is as follows:  
Given a dataset \(X\) of size m and dataset \(Y\) of size \(n\), we calculate \(ET(s)\) and \(ET(t)\) in time \(O(mlog^{*}n)\) as per Theorem 1. Measure \(EST(t,1,m)\). This can be performed in the \(O(n)\) worst case, as a pre-order traversal of \(ET(t)\) will be performed to determine which nodes are in \(EST(t,1,m)\). From this, we can calculate \(\hat{D}[1]||AX(t,1,m)-AX(p,1,m)||1\). We then recursively calculate \(||AX(t,loc+1,loc+m)-AX(s,1,m)||1\) from \(||AX(t,loc,loc+m-1)-AX(s,1,m)||1\) via Lemma 7 to discover which nodes we need to add to or remove from \(EST(t,loc,loc+m-1)\) and regulate the total of the difference properly. \(\square\)  
This requires \(n\) comparisons and will take \(O(logn)\) time for each. By Theorem 4 and Lemma 9, \(D[loc]\leq\hat{D}[loc]\leq O(lognlog^{*}n)D[loc]\). If \(logn\) is \(O(logm)\), as one would expect for some rational size string and text, then a tighter investigation demonstrates the running time to be \(O(nlogm)\). This is for the reason that we merely want to assume the lower \(logm\) levels of the parse trees; above, this \(EST(t,loc,loc+m-1)\) has only one node in each level. Figure 5 shows the flow of data aggregation Algorithm 2 to find the duplicated data in two datasets, \(X\) and \(Y\). ``` Procedure Data_Match_with_Moves (DMM) Input: Datasets, \(X\) and \(Y\) Output: True/False // Duplication Found or Not Found Initializations
1. i. \(X_{len}\gets X.length()\) ii. \(Y_{len}\leftarrow Y.length()\)
2. Allocate vector space \(V[0:m,0:n]\triangleright V[i,j]\) will contain the length of \(X[1:i]\) and \(Y[1:j]\). 3. \(V[0,j]\gets 0\) for all \(0\leq j\leq n\) and \(V[i,0]\gets 0\) for all \(0\leq i\leq m\). \(\triangleright\) Base Cases
4. for (\(i\gets 1\) to Xlen) then
5. for (\(j\gets 0\) to Ylen) then // matching the symbols from \(X\) with \(Y\) symbols
6. if (\(j=0\)) then // if \(Y\) is blank then eliminate all \(X\) symbols // if symbol from both dataset is matching then no operation is required
Figure 5: Data aggregation model. ## 5 Performance Evaluation and Simulation Study

The performance metrics for evaluating the proposed scheme were measured with the mean packet delivery ratio (PDR), mean energy consumption, end-to-end delay, packets drop ratio, communication overhead, and bandwidth utilization [41; 42; 43]. The PDR is the ratio of packets received by the receiver UAVs versus the packet sent by the sender UAVs. The higher ratio means that the performance of the proposed scheme is better. The energy consumption shows the mean amount of energy consumed by the UAVs for data transmission. The end-to-end delay means the time taken by the UAVs for packets' sending and receiving. It also measures the delay caused during route discovery and waiting in a queue. The packet drop ratio means that the packets may be dropped during the transmission, and it counts the ratio of the total number of packets received and packets sent. Sometimes, the same packets or the additional information communicated to the UAVs-CH reduces communication speed and consumes energy. The details of the simulation parameters are given in Table 1.

The performance of the proposed redundant data elimination aggregation approach was compared with non-redundant data elimination aggregation approaches, i.e., EE-UAV-DA, OC-mUAV, and TA-UAV-DA. The data rate was fixed in the simulation, i.e., 250 Kbps, and the number of UAVs varied from 10 to 60. Figure 6 shows the number of UAVs and the mean end-to-end delay. It is observed that with the increase in UAVs, the proposed scheme has less of a mean delay as compared to the EE-UAV-DA, OC-mUAV, and TA-UAV-DA. The FSNet-OC-DA uses HBA to form clusters and data aggregation.