C is exactly the number of ways to choose m − 4 and m − 5 points, respectively, from the points in the four outer areas. Again, the number of points in the four outer areas is calculable in O (1) using A . Since all cells are defined by two, three, or four points, there are no additional types of cells. Let us denote the number of sample points in the four outer areas of a cell C by OUT . Further denote by C ( OUT ) the group of all cells which have exactly OUT points in the outer areas. For the sake of brevity, lets consider only cells of type 2. Similarly to equation (3.5) for the ADP statistic, the contribution to the score S DDP m × m of internal cells of type 2 can be written as The algorithm proceeds as follows. First in a preprocessing phase we perform two computations: 1)go over all cells and calculate t$_{C}$ and OUT for each cell and update T ( OUT ) = T ( OUT ) + t$_{C}$ . This stage takes O ( N $^{4}$); 2) for all u,v ∈ { 0 ,...,N } we calculate and store all ( u v ) in O ( N $^{2}$) steps using Pascal’s triangle method. Now for each m , since n ( OUT,m ) = ( OUT m − 3 $^{)}$, given T ( OUT ), clearly equation (E.1) can be calculated in O ( N ) for a fixed m and in O ( N $^{2}$) for all m s. Therefore the total 63 N − 2 ∑ OUT =2 n ( OUT,m ) ∑ C ∈ C ( OUT ) t$_{C}$ = N − 2 ∑ OUT =2 n ( OUT,m ) T ( OUT ) . (E.1) Figure 7: Inner cell example C (orange), and the sample points that define a partition where C is a cell (green). If any of the sample points ranked on a boundary column or row of C is not on the corner of C , then C can never be a DDP cell (offending point in purple, middle panel). An inner cell can be defined either by two data points (left), by three data points (middle), or by four data points (right). 𝐶$_{ }$ 𝑦$_{ℎ}$$_{ }$ 𝑦$_{𝑙}$$_{ }$ 𝑥$_{𝑙}$$_{ }$ 𝑥$_{ℎ}$$_{ }$ 𝐶$_{ }$ offending  compliant  𝑦$_{ℎ}$$_{ }$ 𝑦$_{𝑙}$$_{ }$ 𝑥$_{𝑙}$$_{ }$ 𝑥$_{ℎ}$$_{ }$ 𝐶$_{ }$ 𝑦$_{ℎ}$$_{ }$ 𝑦$_{𝑙}$$_{ }$ 𝑥$_{𝑙}$$_{ }$ 𝑥$_{ℎ}$$_{ }$