{"id":1345,"date":"2017-12-28T18:52:44","date_gmt":"2017-12-29T02:52:44","guid":{"rendered":"http:\/\/zxi.mytechroad.com\/blog\/?p=1345"},"modified":"2018-01-01T14:09:43","modified_gmt":"2018-01-01T22:09:43","slug":"input-size-v-s-time-complexity","status":"publish","type":"post","link":"https:\/\/zxi.mytechroad.com\/blog\/sp\/input-size-v-s-time-complexity\/","title":{"rendered":"\u82b1\u82b1\u9171 LeetCode Input Size V.S. Time Complexity SP2"},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"\u3010CC\u3011\u82b1\u82b1\u9171 Input Size V.S. Time Complexity \u8f93\u5165\u6570\u636e\u89c4\u6a21\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u5173\u7cfb - \u5237\u9898\u627e\u5de5\u4f5c SP2\" width=\"500\" height=\"375\" src=\"https:\/\/www.youtube.com\/embed\/eG99FDBeuJo?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>\u672c\u671f\u8282\u76ee\u4ecb\u7ecd\u4e86\u8f93\u5165\u6570\u636e\u89c4\u6a21\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u4e0a\u9650\u7684\u5173\u7cfb\uff0c\u53ef\u4ee5\u901a\u8fc7\u6570\u636e\u89c4\u6a21\u63a8\u7b97\u4f7f\u7528\u7b97\u6cd5\u7684\u7c7b\u578b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1349\" src=\"http:\/\/zxi.mytechroad.com\/blog\/wp-content\/uploads\/2017\/12\/sp2.png\" alt=\"\" width=\"960\" height=\"540\" srcset=\"https:\/\/zxi.mytechroad.com\/blog\/wp-content\/uploads\/2017\/12\/sp2.png 960w, https:\/\/zxi.mytechroad.com\/blog\/wp-content\/uploads\/2017\/12\/sp2-300x169.png 300w, https:\/\/zxi.mytechroad.com\/blog\/wp-content\/uploads\/2017\/12\/sp2-768x432.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/p>\n<ul>\n<li>&lt; 10: O(n!) permutation<\/li>\n<li>&lt; 15: O(2^n) combination<\/li>\n<li>&lt; 50: O(n^4) DP<\/li>\n<li>&lt; 200: O(n^3) DP, all pairs shortest path<\/li>\n<li>&lt; 1,000: O(n^2) DP, all pairs, dense graph<\/li>\n<li>&lt; 1,000,000: O(nlogn), sorting-based (greedy), heap, divide &amp; conquer<\/li>\n<li>&lt; 1,000,000: O(n), DP, graph traversal \/ topological sorting (V+E), tree traversal<\/li>\n<li>&lt; INT_MAX: O(sqrt(n)), prime, square sum<\/li>\n<li>&lt; INT_MAX: O(logn), binary search<\/li>\n<li>&lt; INT_MAX: O(1) Math<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u671f\u8282\u76ee\u4ecb\u7ecd\u4e86\u8f93\u5165\u6570\u636e\u89c4\u6a21\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u4e0a\u9650\u7684\u5173\u7cfb\uff0c\u53ef\u4ee5\u901a\u8fc7\u6570\u636e\u89c4\u6a21\u63a8\u7b97\u4f7f\u7528\u7b97\u6cd5\u7684\u7c7b\u578b\u3002 &nbsp; &lt; 10: O(n!) permutation &lt; 15: O(2^n) combination &lt; 50: O(n^4) DP &lt; 200: O(n^3) DP, all pairs shortest path &lt; 1,000: O(n^2)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[170],"tags":[193],"class_list":["post-1345","post","type-post","status-publish","format-standard","hentry","category-sp","tag-complexity","entry","simple"],"_links":{"self":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/1345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/comments?post=1345"}],"version-history":[{"count":6,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/1345\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/1345\/revisions\/1424"}],"wp:attachment":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/media?parent=1345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/categories?post=1345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/tags?post=1345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}