
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.
The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.
This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.
Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.
The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.
A quadtree is a tree data in which each internal node has exactly four children:
topLeft
,topRight
,bottomLeft
andbottomRight
. Quad trees are often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.We want to store True/False information in our quad tree. The quad tree is used to represent a
N * N
boolean grid. For each node, it will be subdivided into four children nodes until the values in the region it represents are all the same. Each node has another two boolean attributes :isLeaf
andval
.isLeaf
is true if and only if the node is a leaf node. Theval
attribute for a leaf node contains the value of the region it represents.For example, below are two quad trees A and B:
Your task is to implement a function that will take two quadtrees and return a quadtree that represents the logical OR (or union) of the two trees.
Note:
A
andB
represent grids of sizeN * N
.N
is guaranteed to be a power of 2.A is true
, or ifB is true
, or ifboth A and B are true
.这道题又是一道四叉树的题,说是给了我们两个四叉树,然后让我们将二棵树相交形成了一棵四叉树,相交的机制采用的是或,即每个自区域相‘或’,题目中给的例子很好的说明了一些相‘或’的原则,比如我们看A和B中的右上结点,我们发现A树的右上结点已经是一个值为true的叶结点,而B的右上结点还是一个子树,那么此时不论子树里有啥内容,我们相交后的树的右上结点应该跟A树的右上结点保持一致,假如A树的右上结点值是false的话,相‘或’起不到任何作用,那么相交后的树的右上结点应该跟B树的右上结点保持一致。那么我们可以归纳出,只有某一个结点是叶结点了,我们看其值,如果是true,则相交后的结点和此结点保持一致,否则跟另一个结点保持一致。比较麻烦的情况是当两个结点都不是叶结点的情况,此时我们需要对相对应的四个子结点分别调用递归函数,调用之后还需要进行进一步处理,因为一旦四个子结点的值相同,且都是叶结点的话,那么此时应该合并为一个大的叶结点,参见代码如下:
类似题目:
Construct Quad Tree
参考资料:
https://leetcode.com/problems/quad-tree-intersection/
https://leetcode.com/problems/quad-tree-intersection/discuss/152730/C%2B%2B-10-line-beat-100
https://leetcode.com/problems/quad-tree-intersection/discuss/157532/Java-concise-code-beat-100
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: