红眼睛蓝眼睛

A group of people with assorted eye colors live on an island. They are all perfect logicians -- if a conclusion can be logically deduced, they will do it instantly. No one knows the color of their eyes. Every night at midnight, a ferry stops at the island. Any islanders who have figured out the color of their own eyes then leave the island, and the rest stay. Everyone can see everyone else at all times and keeps a count of the number of people they see with each eye color (excluding themselves), but they cannot otherwise communicate. Everyone on the island knows all the rules in this paragraph. blue eyes

阅读全文〉

每天一个算法-Union Find

并查集算法

简单实现了Quick-Union的并查集(增加了path compression)。还有Quick-Find, Weighted Quick-union, Weighted Quick-union With Path Compression. 参考https://blog.csdn.net/dm_vincent/article/details/7655764

阅读全文〉