
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.
Given two sparse matrices A and B , return the result of AB.
You may assume that A 's column number is equal to B 's row number.
Example:
这道题让我们实现稀疏矩阵相乘,稀疏矩阵的特点是矩阵中绝大多数的元素为0,而相乘的结果是还应该是稀疏矩阵,即还是大多数元素为0,那么使用传统的矩阵相乘的算法肯定会处理大量的0乘0的无用功,所以需要适当的优化算法,使其可以顺利通过 OJ,由于一个 i x k 的矩阵A乘以一个 k x j 的矩阵B会得到一个 i x j 大小的矩阵C,来看结果矩阵中的某个元素C[i][j]是怎么来的,起始是 A[i][0]*B[0][j] + A[i][1]*B[1][j] + ... + A[i][k]*B[k][j],那么为了不重复计算0乘0,首先遍历A数组,要确保 A[i][k] 不为0,才继续计算,然后遍历B矩阵的第k行,如果 B[K][J] 不为0,累加结果矩阵 res[i][j] += A[i][k] * B[k][j],这样就能高效的算出稀疏矩阵的乘法,参见代码如下:
解法一:
再来看另一种方法,这种方法其实核心思想跟上面那种方法相同,稍有不同的是用一个二维矩阵矩阵来记录每一行中,各个位置中不为0的列数和其对应的值,然后遍历这个二维矩阵,取出每行中不为零的列数和值,然后遍历B中对应行进行累加相乘,参见代码如下:
解法二:
Github 同步地址:
#311
类似题目:
Dot Product of Two Sparse Vectors
参考资料:
https://leetcode.com/problems/sparse-matrix-multiplication/
https://leetcode.com/discuss/77235/ac-soluiton-code
https://leetcode.com/discuss/71912/easiest-java-solution
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: