Input: micro-clusters and
  Output: macro-cluster
1 foreach sensor do
2    if then
3 ;
4           add to ;
5     remove the records of from and ;
6    end
7     add the rest records of , to
8   end
9   foreach time window do
10     if then
11 ;
12         add to ;
13       remove the records of from and ;
14    end
15    add the rest records of , to
16  end
17  generate ;
18  return ;
Algorithm 2: Merge Micro-Clusters.