This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object UnionFind { | |
def undirectedEdge(tuple: (String, String)) = tuple :: tuple.swap :: Nil | |
def findRepresentative(it: Iterator[(String, String)]) = { | |
val (existingRepr, newReprCandidate) = it.next() | |
val newRepr = if(existingRepr.compareTo(newReprCandidate) <= 0) existingRepr else newReprCandidate | |
val updated = it.nonEmpty && (existingRepr != newRepr) | |
val items = (Iterator(existingRepr, newReprCandidate) ++ it.map(_._2)).filter(_ != newRepr) | |
items.map(k => (newRepr, k, updated)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git's data model | |
## Snapshot | |
collection of files & folders within a top-level dir as a series of snapshots. | |
- file is a "blob", bunch of bytes | |
- directory is a "tree" which maps names to blobs or trees | |
- snapshot is a top-level tree that is being tracked | |
## History | |
- DAG | |
- each snapshot refers to a "set of parents"; |