55555555555 想回纽约了! (转载)# Joke - 肚皮舞运动
m*o
1 楼
1. java garbage collector
A: reference counts.
Q: circular reference. Any better solution?
A: treat each object like the nodes in the graph. and find separated
subgraph.
Q: How to determine which subgraph is "live", which is “dead”?
A: Use the objects stored in the current stack as the starting point in the
graph.
2. many many documents with unique ids, find duplicate documents.
A: Use hash table. If allowed, use multiple machines to do hashing
Q: Any other solutions?
A: Use prefix tree (word as a node) to represent each document, and use k-
merge algorithm to sort list of documents.
3. Given pairs of connected items ((A, B), (B, C), (C, D)...), find the root
node of this tree.
A: Use BFS to do traversal
Q: Other solution?
A: Use DFS to do traversal
Q: How do you know this is a graph, not a tree?
A: no cycle, every child only has one child
Q: How to determine a cycle?
A: blablabla
感觉会挂,或者至少还有第三轮。
A: reference counts.
Q: circular reference. Any better solution?
A: treat each object like the nodes in the graph. and find separated
subgraph.
Q: How to determine which subgraph is "live", which is “dead”?
A: Use the objects stored in the current stack as the starting point in the
graph.
2. many many documents with unique ids, find duplicate documents.
A: Use hash table. If allowed, use multiple machines to do hashing
Q: Any other solutions?
A: Use prefix tree (word as a node) to represent each document, and use k-
merge algorithm to sort list of documents.
3. Given pairs of connected items ((A, B), (B, C), (C, D)...), find the root
node of this tree.
A: Use BFS to do traversal
Q: Other solution?
A: Use DFS to do traversal
Q: How do you know this is a graph, not a tree?
A: no cycle, every child only has one child
Q: How to determine a cycle?
A: blablabla
感觉会挂,或者至少还有第三轮。