{"id":292,"date":"2011-08-17T22:37:13","date_gmt":"2011-08-17T14:37:13","guid":{"rendered":"http:\/\/guoh.ai\/lifelog\/?p=292"},"modified":"2026-02-08T09:42:41","modified_gmt":"2026-02-08T09:42:41","slug":"interview-test-mutiple-thread-cal-sum-of-int-array-java","status":"publish","type":"post","link":"https:\/\/guoh.ai\/lifelog\/2011\/08\/interview-test-mutiple-thread-cal-sum-of-int-array-java\/","title":{"rendered":"\u9762\u8bd5\u9898\u4e4b\u591a\u7ebf\u7a0b\u6570\u7ec4\u6c42\u548c"},"content":{"rendered":"<p>\u60f3\u6362\u5de5\u4f5c\u7684\uff0c\u5e73\u65f6\u8fd8\u662f\u8981\u505a\u4e9b\u9762\u8bd5\u9898\uff0c\u56e0\u4e3a\u51b7\u4e0d\u4e01\u7684\u88ab\u9762\u4e00\u4e0b\uff0c\u4f1a\u611f\u89c9\u7a81\u7136\uff0c\u5f53\u7136\u7ed3\u679c\u4e5f\u662f\u5f88\u7cdf\u7cd5\u3002<br \/>\n\u8fd9\u662f\u4e00\u9053\u8001\u9898\u76ee \u201c\u4e00\u4e2a\u975e\u5e38\u975e\u5e38\u5927\u7684 int \u7c7b\u578b\u6570\u7ec4\uff0c\u7528\u591a\u7ebf\u7a0b\u8ba1\u7b97\u548c\u3002\u5047\u8bbe\u6570\u7ec4\u957f\u5ea6 M \u7ebf\u7a0b\u6570\u91cf N\u201d\u3002<br \/>\n\u601d\u60f3\u662f\u5206\u800c\u6cbb\u4e4b\uff0c\u8ddf <a href=\"http:\/\/en.wikipedia.org\/wiki\/Quicksort\" target=\"_blank\">\u5feb\u901f\u6392\u5e8f<\/a>\uff0c<a href=\"http:\/\/en.wikipedia.org\/wiki\/MapReduce\" target=\"_blank\">MapReduce<\/a> \u601d\u60f3\u6709\u4e9b\u7c7b\u4f3c\u3002<\/p>\n<p>\u8fd9\u91cc\u662f\u4e00\u4e2a\u5b9e\u73b0\u7684\u4e00\u4e2a\u7b80\u5355\u7248\u672c\uff0c\u6839\u636e\u6709\u591a\u5c11\u7ebf\u7a0b\uff0c\u7136\u540e\u628a\u6570\u7ec4\u5206\u4e3a\u591a\u5c11\u6bb5\uff0c\u56e0\u4e3a\u6c42\u548c\u7684\u8fc7\u7a0b\u90fd\u662f\u8bfb\u53d6\u6570\u7ec4\u5143\u7d20\uff0c\u6d89\u53ca\u4e0d\u5230\u9501\u7b49\u7b49\u3002<br \/>\n\u6240\u4ee5\u53ea\u8981\u6bb5\u5212\u5206\u6b63\u786e\uff0c\u8ba1\u7b97\u5c31\u662f\u7b80\u5355\u7684\u4e8b\u60c5\u4e86\u3002<br \/>\n<script src=\"https:\/\/gist.github.com\/1151626.js?file=MultipleThreadCalSum.java\"><\/script><br \/>\n\u6709\u7a7a\u518d\u6765\u7528 <a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/java\/util\/concurrent\/Future.html\" target=\"_blank\">Future<\/a> \u5b9e\u73b0\u4e00\u4e2a\u7248\u672c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u6362\u5de5\u4f5c\u7684\uff0c\u5e73\u65f6\u8fd8\u662f\u8981\u505a\u4e9b\u9762\u8bd5\u9898\uff0c\u56e0\u4e3a\u51b7\u4e0d\u4e01\u7684\u88ab\u9762\u4e00\u4e0b\uff0c\u4f1a\u611f\u89c9\u7a81\u7136\uff0c\u5f53\u7136\u7ed3\u679c\u4e5f\u662f\u5f88\u7cdf\u7cd5\u3002 \u8fd9\u662f\u4e00\u9053\u8001\u9898\u76ee \u201c\u4e00\u4e2a\u975e\u5e38\u975e\u5e38\u5927\u7684 int \u7c7b\u578b\u6570\u7ec4\uff0c\u7528\u591a\u7ebf\u7a0b\u8ba1\u7b97\u548c\u3002\u5047\u8bbe\u6570\u7ec4\u957f\u5ea6 M \u7ebf\u7a0b\u6570\u91cf N\u201d\u3002 \u601d\u60f3\u662f\u5206\u800c\u6cbb\u4e4b\uff0c\u8ddf \u5feb\u901f\u6392\u5e8f\uff0cMapReduce \u601d\u60f3\u6709\u4e9b\u7c7b\u4f3c\u3002 \u8fd9\u91cc\u662f\u4e00\u4e2a\u5b9e\u73b0\u7684\u4e00\u4e2a\u7b80\u5355\u7248\u672c\uff0c\u6839\u636e\u6709\u591a\u5c11\u7ebf\u7a0b\uff0c\u7136\u540e\u628a\u6570\u7ec4\u5206\u4e3a\u591a\u5c11\u6bb5\uff0c\u56e0\u4e3a\u6c42\u548c\u7684\u8fc7\u7a0b\u90fd\u662f\u8bfb\u53d6\u6570\u7ec4\u5143\u7d20\uff0c\u6d89\u53ca\u4e0d\u5230\u9501\u7b49\u7b49\u3002 \u6240\u4ee5\u53ea\u8981\u6bb5\u5212\u5206\u6b63\u786e\uff0c\u8ba1\u7b97\u5c31\u662f\u7b80\u5355\u7684\u4e8b\u60c5\u4e86\u3002 \u6709\u7a7a\u518d\u6765\u7528 Future \u5b9e\u73b0\u4e00\u4e2a\u7248\u672c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_gfmr_meta_descriptions":[],"_gfmr_multilingual_taxonomy_terms":[],"footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-cs","category-java"],"_links":{"self":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":2,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":1056,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/292\/revisions\/1056"}],"wp:attachment":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}