- Eliminate redundancies from \$M\$ as described above.
- For each non-leaf node \$x\$ in the tree:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each non-leaf node \$x\$ in post-order:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each non-leaf node \$x\$ in post-order:
- If \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- Eliminate redundancies from \$M\$ as described above.
- For each node \$x\$ in the tree:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each node \$x\$ in post-order:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each node \$x\$ in post-order:
- If \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- Eliminate redundancies from \$M\$ as described above.
- For each non-leaf node \$x\$ in the tree:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each non-leaf node \$x\$ in post-order:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each non-leaf node \$x\$ in post-order:
- If \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- 50.1k
- 3
- 130
- 210
- Eliminate redundancies from \$M\$ as described above.
- For each node \$x\$ in the tree:
- If \$x ∉ M\$ and \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each node \$x\$ in post-order:
- If \$x ∉ M\$ and \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each node \$x\$ in post-order:
- If\$x ∉ M\$ and \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- Eliminate redundancies from \$M\$ as described above.
- For each node \$x\$ in the tree:
- If \$x ∉ M\$ and \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each node \$x\$ in post-order:
- If \$x ∉ M\$ and \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each node \$x\$ in post-order:
- If\$x ∉ M\$ and \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- Eliminate redundancies from \$M\$ as described above.
- For each node \$x\$ in the tree:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Go to step 2.
- Eliminate redundancies from \$M\$.
- For each node \$x\$ in post-order:
- If \$C(x) ⊆ M\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Eliminate redundancies from \$M\$.
- Initialize a map \$K\$ from nodes to non-negative integers such that \$K(x) = |C(x) ∩ M|\$, the number of children of \$x\$ that are in the set of nodes to be compacted.
- For each node \$x\$ in post-order:
- If \$K(x) = |C(x)|\$ then:
- Update \$M\$ to \$(M \setminus C(x)) ∪ \{x\}\$
- Update \$K(P(x))\$ to \$K(P(x)) + 1\$
- \$n\$ is the number of nodes in the tree;
- \$M\$ is the set of nodes we want to compact;
- \$m = |M|\$, the initial number of nodes in \$M\$;
- \$C(x)\$ is the function that returns the set of children of the node \$x\$ in the tree.
- \$P(x)\$ is the function that returns the parent of the node \$x\$ in the tree.
Any algorithm for this problem is going to have to find nodes all of whose children node are present in the set of nodes to be compacted (that is, to find nodes \$x\$ where \$C(x) ⊆ M\$), and update the set of nodes accordingly.
- \$n\$ is the number of nodes in the tree;
- \$M\$ is the set of nodes we want to compact;
- \$m = |M|\$, the initial number of nodes in \$M\$;
- \$C(x)\$ is the function that returns the set of children of the node \$x\$ in the tree.
- \$P(x)\$ is the function that returns the parent of the node \$x\$ in the tree.
Any algorithm for this problem is going to have to find nodes all of whose children node are present in the set of nodes to be compacted (that is, to find nodes \$x\$ where \$C(x) ⊆ M\$), and update the set of nodes accordingly.
- \$n\$ is the number of nodes in the tree;
- \$M\$ is the set of nodes we want to compact;
- \$m = |M|\$, the initial number of nodes in \$M\$;
- \$C(x)\$ is the set of children of the node \$x\$ in the tree.
- \$P(x)\$ is the parent of the node \$x\$ in the tree.
Any algorithm for this problem is going to have to find nodes all of whose children are in the set of nodes to be compacted (that is, to find nodes \$x\$ where \$C(x) ⊆ M\$), and update the set of nodes accordingly.