2016-07-12 4 views
1

私は技術的なインタビューで、「配列の中に重複を見つける」という質問があり、問題なくハッシュテーブルを使ってO(n)時間を解決した後、フォローアップの質問をしました。アレイエクステンションの質問で重複を見つけるにはどうすればいいですか?

Orig: Determine if an array contains duplicate entries. 

    F1: Now what if the array is very large, and had to be distributed across multiple machines. 

    F2: What if the network connection between these machines are prone to failure? 

    F3: What if the hardware themselves are not 100% reliable and may occasionally give off wrong answers? 

    F4: Design a system so that multiple simultaneous users may need to update this array, while you need to maintain uniqueness of its entries. 

私はF1について考え、その後、巨大なハッシュテーブルを使用するのが賢明ではないでしょうし、我々はO(1)メモリを補うためにO(n²)にランタイムをトレードすることができると言いましたが、わかりませんでした残り。どんな助け?

答えて

2

F2:異なるマシンでデータを複製する必要があります。すべてのデータまたはデータの一部を選択できます。

F3:マシン間でデータを転送するときにチェックサム値を使用します。

F4:セマフォのような何らかの同期を使用して、更新が同時に行われていないことを確認します。

関連する問題