The table is filled up in a bottom-up fashion, starting at the leaves of the quadtree. A square at a leaf contains at most one single node. Given a multiset of portals and a valid order, we can solve the subproblem optimally in O(2r) time because the single node can be traversed along one of the O(2r) paths in the square. A square at a non-leaf node has four internal edges (one from each of its four subsquares). The number of ways to choose a multiset of portals on the four internal edges is at most (m+3)4r and the number of ways to traverse the selected portals is at most (2r)4r(4r)! (where the term (2r)4r comes from the fact that each portal can be traversed along one of the O(2r) paths in the square). Altogether there are no more than (m+3)4r(2r)4r(4r)! possibilities. We can compute the cost of each possibility and compute the optimal solution from the optimal solutions of the four subsquares. the time complexity of constructing the table is O(nlog n (m+4)8r(2r)4r((4r)!)2), which is O(n(log n)O(c)) for m=O(clog n) and r=O(c). |
The table is filled up in a bottom-up fashion, starting at the leaves of the quadtree. A square at a leaf contains at most one single node. Given a multiset of portals and a valid order, we can solve the subproblem optimally in O(2r) time because the single node can be traversed along one of the O(2r) paths in the square. A square at a non-leaf node has four internal edges (one from each of its four subsquares). The number of ways to choose a multiset of portals on the four internal edges is at most (m+3)4r and the number of ways to traverse the selected portals is at most (2r)4r(4r)! (where the term (2r)4r comes from the fact that each portal can be traversed along one of the O(2r) paths in the square). Altogether there are no more than (m+3)4r(2r)4r(4r)! possibilities. We can compute the cost of each possibility and obtain the optimal solution from the optimal solutions of the four subsquares. The time complexity of constructing the table is O(nlog n (m+4)8r(2r)4r((4r)!)2), which is O(n(log n)O(c)) for m=O(clog n) and r=O(c). |