{"id":120991,"date":"2026-11-01T22:25:53","date_gmt":"2026-11-01T14:25:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/120991.html"},"modified":"2026-11-01T22:25:53","modified_gmt":"2026-11-01T14:25:53","slug":"%e4%b8%80%e6%96%87%e9%80%9a%e5%85%b3-%e6%a0%91%e5%92%8c%e4%ba%8c%e5%8f%89%e6%a0%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/120991.html","title":{"rendered":"\u4e00\u6587\u901a\u5173-----\u6811\u548c\u4e8c\u53c9\u6811"},"content":{"rendered":"<h2>1. \u6811\u7684\u6982\u5ff5<\/h2>\n<h3>1.1 \u6811\u7684\u5b9a\u4e49<\/h3>\n<p>\u6811 (Tree) \u662f n (n \u2265 0) \u4e2a\u7ed3\u70b9\u7684\u6709\u9650\u96c6\u3002\u5f53 n &#061; 0 \u65f6&#xff0c;\u79f0\u4e3a\u7a7a\u6811\u3002\u5f53 n &gt; 0 \u65f6&#xff0c;\u79f0\u4e3a\u975e\u7a7a\u6811&#xff0c;\u4efb\u610f\u4e00\u68f5\u975e\u7a7a\u6811\u5e94\u8be5\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42&#xff1a;<\/p>\n<p>a. \u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u7279\u5b9a\u7684\u79f0\u4e3a\u6839\u7684\u7ed3\u70b9\u3002<\/p>\n<p>b. \u5f53 n &gt; 1 \u65f6&#xff0c;\u5176\u4f59\u7ed3\u70b9\u53ef\u5206\u4e3a m (m&gt; 0) \u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u6709\u9650\u96c6 T1&#xff0c;T2&#xff0c;T3&#8230;&#8230;Tn&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u96c6\u5408\u672c\u8eab\u53c8\u662f\u4e00\u68f5\u6811&#xff0c;\u5e76\u4e14\u79f0\u4e3a\u6839\u7684\u5b50\u6811\u3002<\/p>\n<p>c.\u00a0\u6811\u7684\u6839\u7ed3\u70b9\u6ca1\u6709\u524d\u9a71\u7ed3\u70b9&#xff0c;\u9664\u6839\u7ed3\u70b9\u5916\u7684\u6240\u6709\u7ed3\u70b9\u6709\u4e14\u53ea\u6709\u2f00\u4e2a\u524d\u9a71\u7ed3\u70b9&#xff0c;\u6811\u4e2d\u7684\u6240\u6709\u7ed3\u70b9\u53ef\u4ee5\u6709 \u591a\u4e2a\u540e\u7ee7\u7ed3\u70b9\u3002<\/p>\n<h3>1.2 \u4e13\u4e1a\u672f\u8bed<\/h3>\n<ul>\n<li>\u7956\u5148&#xff1a;\u4ece\u6839\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u6240\u7ecf\u5206\u652f\u4e0a\u7684\u6240\u6709\u7ed3\u70b9\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u7956\u5148\u3002\u5982&#xff1a;A \u5230 G \u5206\u652f\u4e2d&#xff0c;A \u548c C \u90fd\u662f G \u7684\u7956\u5148\u3002<\/li>\n<li>\u5b50\u5b59&#xff1a;\u4ee5\u67d0\u7ed3\u70b9\u4e3a\u6839\u7684\u5b50\u6811\u4e2d\u4efb\u4e00\u7ed3\u70b9\u90fd\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u5b50\u5b59\u3002\u5982&#xff1a;\u4e0b\u9762\u7684\u6240\u6709\u7ed3\u70b9\u90fd\u662f A \u7684\u5b50\u5b59&#xff0c;C \u7684\u5b50\u5b59\u53ea\u6709 G\u3002<\/li>\n<li>\u5b69\u5b50 \/ \u53cc\u4eb2&#xff1a;\u7ed3\u70b9\u6240\u6709\u5b50\u6811\u7684\u6839\u7ed3\u70b9\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u5b69\u5b50&#xff0c;\u76f8\u5bf9\u5e94&#xff0c;\u8be5\u7ed3\u70b9\u79f0\u4e3a\u5b69\u5b50\u7684\u53cc\u4eb2\u3002\u5982&#xff1a;B \u7684\u5b69\u5b50\u662f E \u548c F&#xff0c;E \u548c F \u7684\u53cc\u4eb2\u662f B\u3002<\/li>\n<li>\u5144\u5f1f&#xff1a;\u540c\u4e00\u4e2a\u53cc\u4eb2\u7684\u5b69\u5b50\u4e4b\u95f4\u4e92\u79f0\u4e3a\u5144\u5f1f\u3002\u5982&#xff1a;H \u548c I \u662f\u5144\u5f1f\u7ed3\u70b9&#xff0c;\u8fd9\u91cc\u5144\u5f1f\u7c7b\u4f3c\u4eba\u7c7b\u4eb2\u7f18\u5173\u7cfb\u7684\u4eb2\u5144\u5f1f\u3002<\/li>\n<li>\u5802\u5144\u5f1f&#xff1a;\u53cc\u4eb2\u5728\u540c\u4e00\u5c42\u7684\u7ed3\u70b9\u4e92\u4e3a\u5802\u5144\u5f1f\u3002\u5982&#xff1a;G \u548c H \u662f\u5802\u5144\u5f1f\u5173\u7cfb\u3002<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1184\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142538-6ae74be2355b9.png\" width=\"1920\" \/><\/li>\n<\/ul>\n<h4>1.2.1 \u7ed3\u70b9\u548c\u6811\u4e4b\u95f4\u7684\u5c5e\u6027\u63cf\u8ff0<\/h4>\n<\/p>\n<ul>\n<li>\u5ea6&#xff1a;\u6811\u4e2d\u4e00\u4e2a\u7ed3\u70b9\u7684\u5b69\u5b50\u4e2a\u6570\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u5ea6&#xff0c;\u6811\u4e2d\u7ed3\u70b9\u6700\u5927\u7684\u5ea6\u6570\u79f0\u4e3a\u6811\u7684\u5ea6\u3002\u5982&#xff1a;\u4e0b\u56fe\u4e2d\u7ed3\u70b9 A \u7684\u5ea6\u662f 3&#xff0c;\u7ed3\u70b9 B \u7684\u5ea6\u662f 2&#xff0c;\u6811\u7684\u5ea6\u662f 3\u3002<\/li>\n<li>\u53f6\u5b50\u7ed3\u70b9 \/ \u7ec8\u7aef\u7ed3\u70b9&#xff1a;\u5ea6\u4e3a 0 \u7684\u7ed3\u70b9\u79f0\u4e3a\u53f6\u5b50\u7ed3\u70b9\u6216\u7ec8\u7aef\u7ed3\u70b9\u3002\u5982&#xff1a;\u4e0b\u56fe\u4e2d\u7eff\u8272\u7ed3\u70b9\u5747\u4e3a\u53f6\u5b50\u7ed3\u70b9<\/li>\n<li>\u5206\u652f\u7ed3\u70b9 \/ \u975e\u7ec8\u7aef\u7ed3\u70b9&#xff1a;\u5ea6\u4e0d\u4e3a 0 \u7684\u7ed3\u70b9\u79f0\u4e3a\u5206\u652f\u7ed3\u70b9\u6216\u975e\u7ec8\u7aef\u7ed3\u70b9\u3002<\/li>\n<li>\u7ed3\u70b9\u7684\u5c42\u6b21&#xff1a;\u7ed3\u70b9\u7684\u5c42\u6b21\u4ece\u6811\u6839\u7ed3\u70b9\u5f00\u59cb\u5b9a\u4e49&#xff0c;\u6839\u7ed3\u70b9 A \u4e3a\u7b2c\u4e00\u5c42&#xff0c;\u5206\u652f\u7ed3\u70b9 B\u3001C\u3001D \u4e3a\u7b2c\u4e8c\u5c42&#xff0c;\u4ee5\u6b64\u7c7b\u63a8\u3002<\/li>\n<li>\u6811\u7684\u9ad8\u5ea6 \/ \u6df1\u5ea6&#xff1a;\u6811\u4e2d\u7ed3\u70b9\u7684\u6700\u5927\u5c42\u6570\u79f0\u4e3a\u6811\u7684\u9ad8\u5ea6 \/ \u6df1\u5ea6\u3002\u5982&#xff1a;\u4e0b\u56fe\u4e2d\u8be5\u6811\u7684\u9ad8\u5ea6\u4e3a 4\u3002\u6709\u90e8\u5206\u4e66\u7c4d\u6216\u9898\u76ee\u4e2d\u8ba4\u4e3a\u6839\u7ed3\u70b9\u5728\u7b2c 0 \u5c42&#xff0c;\u6309\u7167\u8fd9\u4e2a\u5b9a\u4e49&#xff0c;\u4e0b\u56fe\u4e2d\u7684\u6811\u9ad8\u5ea6\u4e3a 3&#xff0c;\u5177\u4f53\u6211\u4eec\u8fd8\u662f\u8981\u770b\u6e05\u695a\u4e66\u7c4d\u6216\u9898\u76ee\u4e2d\u7684\u63cf\u8ff0\u8bf4\u660e\u3002<\/li>\n<li>\u6709\u5e8f\u6811 \/ \u65e0\u5e8f\u6811&#xff1a;\u5982\u679c\u5c06\u6811\u4e2d\u7ed3\u70b9\u7684\u5404\u5b50\u6811\u770b\u6210\u4ece\u5de6\u5411\u53f3\u662f\u6709\u6b21\u5e8f\u7684&#xff08;\u5373\u4e0d\u80fd\u4e92\u6362&#xff09;&#xff0c;\u5219\u79f0\u8be5\u6811\u4e3a\u6709\u5e8f\u6811&#xff0c;\u5426\u5219\u79f0\u4e3a\u65e0\u5e8f\u6811\u3002\u5728\u6709\u5e8f\u6811\u4e2d\u6700\u5de6\u8fb9\u7684\u5b50\u6811\u7684\u6839\u79f0\u4e3a\u7b2c\u4e00\u4e2a\u5b69\u5b50&#xff0c;\u6700\u53f3\u8fb9\u7684\u79f0\u4e3a\u6700\u540e\u4e00\u4e2a\u5b69\u5b50\u3002<\/li>\n<li>\u8def\u5f84&#xff1a;\u6811\u4e2d\u4e24\u4e2a\u7ed3\u70b9\u4e4b\u95f4\u7684\u8def\u5f84\u662f\u7531\u8fd9\u4e24\u4e2a\u7ed3\u70b9\u4e4b\u95f4\u6240\u7ecf\u8fc7\u7684\u7ed3\u70b9\u5e8f\u5217\u6784\u6210\u7684&#xff0c;\u8def\u5f84\u957f\u5ea6\u4e3a\u5e8f\u5217\u7ed3\u70b9\u4e2a\u6570\u3002\u5982&#xff1a;\u4e0b\u56fe\u4e2d A \u5230 K \u5c31\u662f\u4e00\u6761\u8def\u5f84&#xff0c;\u8def\u5f84\u957f\u5ea6\u4e3a 4<\/li>\n<li>\u8fb9&#xff1a;\u8868\u793a\u53cc\u4eb2\u548c\u5b69\u5b50\u4e4b\u95f4\u94fe\u63a5\u5173\u7cfb\u53eb\u505a\u8fb9\u3002\u6811\u4e2d\u4e00\u822c\u5f88\u5c11\u8868\u793a\u8fb9\u7684\u5173\u7cfb&#xff0c;\u4e00\u822c\u56fe\u4e2d\u66f4\u5173\u6ce8\u9876\u70b9\u4e4b\u95f4\u7684\u8fb9\u3002<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1312\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142539-6ae74be35fb7a.png\" width=\"1952\" \/><\/p>\n<h3>1.3 \u6811\u7684\u6027\u8d28<\/h3>\n<h4>1.3.1 \u6027\u8d281&#xff1a;\u6811\u4e2d\u7684\u7ed3\u70b9\u6811&#061;\u6811\u4e2d\u7684\u5ea6\u4e4b\u548c&#043;1<\/h4>\n<p>\u8fd9\u4e2a\u70b9\u5f88\u597d\u7406\u89e3&#xff0c;\u2f00\u4e2a\u7ed3\u70b9\u7684\u5ea6\u5c31\u662f\u8fd9\u4e2a\u7ed3\u70b9\u6709\u2f0f\u4e2a\u5b69\u2f26\u7ed3\u70b9&#xff0c;\u6240\u6709\u7684\u5ea6\u76f8\u52a0\u5c31\u662f\u7d2f\u8ba1\u7684\u5b69\u2f26\u7ed3\u70b9 \u6570&#xff0c;\u53ea\u6709\u6839\u7ed3\u70b9\u6ca1\u7b97\u8fdb\u53bb&#xff0c;\u6240\u4ee5\u6240\u6709\u7ed3\u70b9\u7684\u5ea6\u4e4b\u548c&#043;1\u5c31\u662f\u7ed3\u70b9\u6570\u3002\u6709\u4e9b\u5730\u2f45\u4e5f\u4f1a\u8bf4\u6811\u4e2d\u7684\u7ed3\u70b9\u6570&#061; \u6240\u6709\u8fb9\u4e4b\u548c&#043;1&#xff0c;\u56e0\u4e3a\u2f00\u4e2a\u8282\u70b9\u8fde\u63a5\u51fa\u53bb\u7684\u8fb9\u7b49\u4e8e\u8fd9\u4e2a\u7ed3\u70b9\u7684\u5ea6\u3002<\/p>\n<h4>1.3.2 \u6027\u8d282&#xff1a; m\u53c9\u6811\u4e2d\u7684\u7b2ci\u5c42\u4e0a\u81f3\u591a\u6709m^(i-1)\u4e2a\u7ed3\u70b9(i&gt;&#061;0)<\/h4>\n<ul>\n<li>m \u53c9\u6811\u662f\u6307\u6bcf\u4e2a\u7ed3\u70b9\u6700\u591a m \u4e2a\u5b69\u5b50&#xff0c;\u6700\u5c11\u53ef\u4ee5\u662f 0 \u4e2a\u5b69\u5b50&#xff0c;m \u53c9\u6811\u4e2d\u4e0d\u4e00\u5b9a\u5b58\u5728 m \u4e2a\u5b69\u5b50\u7684\u7ed3\u70b9\u3002<\/li>\n<li>\u6781\u7aef\u573a\u666f\u4e0b\u9ad8\u5ea6\u4e3a h \u7684 m \u53c9\u6811\u53f6\u5b50\u7ed3\u70b9\u90fd\u5728\u7b2c h \u5c42&#xff0c;\u6bcf\u4e2a\u5206\u652f\u7ed3\u70b9\u5747\u6709 m \u4e2a\u5b69\u5b50&#xff0c;\u6bcf\u5c42\u90fd\u662f\u6ee1\u7684&#xff0c;\u5047\u8bbe\u5c42\u6570\u662f i&#xff0c;\u5219\u6bcf\u5c42\u7ed3\u70b9\u6570\u4e3am^(i-1)&#xff0c;\u7b2c 1 \u81f3 h \u5c42\u7684\u7ed3\u70b9\u6570\u662f\u4e00\u4e2a\u4ee5 m \u4e3a\u516c\u6bd4\u7684\u7b49\u6bd4\u6570\u5217\u3002<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"960\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142540-6ae74be46dfa5.png\" width=\"2464\" \/><\/p>\n<h4>1.3.3 \u6027\u8d283:\u00a0\u2fbc\u5ea6\u4e3ah\u7684m\u53c9\u6811\u2f84\u591am^h-1\/(m-1)\u6709\u4e2a\u7ed3\u70b9<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"800\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142541-6ae74be580d72.png\" width=\"2848\" \/><\/p>\n<h4>1.3.4 \u7ec3\u4e60<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"544\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142542-6ae74be6d6a2c.png\" width=\"4352\" \/><\/p>\n<p>\u8003\u70b9\u662f\u6027\u8d281&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"544\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142543-6ae74be7a812a.png\" width=\"4096\" \/><\/p>\n<h2>2. \u4e8c\u53c9\u6811<\/h2>\n<h3>2.1 \u4e8c\u53c9\u6811\u7684\u5b9a\u4e49<\/h3>\n<\/p>\n<ul>\n<li>\u4e8c\u53c9\u6811&#xff08;Binary Tree&#xff09;\u662f\u53e6\u4e00\u79cd\u6811\u578b\u7ed3\u6784&#xff0c;\u5b83\u7684\u7279\u70b9\u662f\u6bcf\u4e2a\u7ed3\u70b9\u81f3\u591a\u53ea\u6709\u4e24\u68f5\u5b50\u6811&#xff08;\u5373\u4e8c\u53c9\u6811\u4e2d\u4e0d\u5b58\u5728\u5ea6\u5927\u4e8e 2 \u7684\u7ed3\u70b9&#xff09;&#xff0c;\u5e76\u4e14\u4e8c\u53c9\u6811\u7684\u5b50\u6811\u6709\u5de6\u53f3\u4e4b\u5206&#xff0c;\u5176\u6b21\u5e8f\u4e0d\u80fd\u4efb\u610f\u98a0\u5012&#xff08;\u4e8c\u53c9\u6811\u662f\u6709\u5e8f\u6811&#xff09;&#xff0c;\u5de6\u8fb9\u7684\u53eb\u5de6\u5b50\u6811&#xff0c;\u53f3\u8fb9\u7684\u53eb\u53f3\u5b50\u6811\u3002<\/li>\n<li>\u4e8c\u53c9\u6811\u7684\u5ea6\u5e76\u4e0d\u4e00\u5b9a\u4e3a 2&#xff0c;\u4ed6\u8981\u6c42\u6bcf\u4e2a\u7ed3\u70b9\u5ea6\u6700\u5927\u4e3a 2&#xff0c;\u7279\u6b8a\u60c5\u51b5\u4e0b&#xff0c;\u6811\u7684\u5ea6\u4e5f\u53ef\u80fd\u4e3a 0 \u6216\u8005 1\u3002<\/li>\n<li>\u4e8c\u53c9\u6811\u4e5f\u662f\u4e00\u4e2a\u9012\u5f52\u5b9a\u4e49\u7684\u6570\u636e\u7ed3\u6784&#xff0c;\u4efb\u4f55\u4e00\u68f5\u4e8c\u53c9\u6811\u53ef\u4ee5\u5206\u4e3a\u6839\u548c\u5de6\u53f3\u5b50\u6811\u3002<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1536\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142544-6ae74be86e34a.png\" width=\"1536\" \/><\/p>\n<h3>2.2 \u51e0\u79cd\u7279\u6b8a\u7684\u4e8c\u53c9\u6811<\/h3>\n<h4>2.2.1 \u6ee1\u4e8c\u53c9\u6811<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"832\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142545-6ae74be90769c.png\" width=\"2592\" \/><\/p>\n<p>\u6bcf\u4e00\u5c42\u90fd\u662f\u6ee1\u7684&#xff0c;\u6ca1\u6709\u7a7a\u51fa\u6765\u7684\u4f4d\u7f6e\u3002<\/p>\n<h4>2.2.2 \u5b8c\u5168\u4e8c\u53c9\u6811<\/h4>\n<ul>\n<li>\u4e00\u68f5\u9ad8\u5ea6\u4e3a h \u7684\u5b8c\u5168\u4e8c\u53c9\u6811&#xff0c;\u524d h-1 \u5c42\u90fd\u662f\u7ed3\u70b9\u6570\u8fbe\u5230\u6700\u5927 (\u6ee1)&#xff0c;\u7b2c h \u5c42\u4e0d\u4e00\u5b9a\u6ee1&#xff0c;\u4f46\u662f\u8981\u6c42\u4ece\u5de6\u5230\u53f3\u7ed3\u70b9\u662f\u8fde\u7eed\u7684\u3002<\/li>\n<li>\u6ee1\u4e8c\u53c9\u6811\u4e00\u5b9a\u662f\u5b8c\u5168\u4e8c\u53c9\u6811&#xff0c;\u4f46\u5b8c\u5168\u4e8c\u53c9\u6811\u4e0d\u4e00\u5b9a\u662f\u6ee1\u4e8c\u53c9\u6811\u3002<\/li>\n<li>\u9ad8\u5ea6\u4e3a h \u7684\u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u7ed3\u70b9\u6570\u91cf\u5728[2^(h-1)&#xff0c;2^h-1]\u00a0\u4e4b\u95f4\u3002<\/li>\n<li>\u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u53f6\u5b50\u4e00\u5b9a\u53ea\u51fa\u73b0\u5728\u6700\u540e\u4e24\u5c42&#xff0c;\u4e14\u5ea6\u4e3a 1 \u7684\u7ed3\u70b9\u6700\u591a\u6709 1 \u4e2a&#xff0c;\u5269\u4e0b\u7684\u7ed3\u70b9\u90fd\u662f\u5ea6\u4e3a 0 \u548c\u5ea6\u4e3a 2\u3002<\/li>\n<\/ul>\n<p>\u6ce8\u610f&#xff1a;<span style=\"color:#fe2c24\">\u4e00\u5b9a\u8981\u662f\u4ece\u5de6\u5230\u53f3\u662f\u8fde\u7eed\u7684&#xff0c;\u524dh-1\u5c42\u5fc5\u987b\u662f\u5168\u6ee1\u7684<\/span>\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1760\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142546-6ae74beaa78ac.png\" width=\"1344\" \/><\/p>\n<h4>2.2.3 \u641c\u7d22\u4e8c\u53c9\u6811<\/h4>\n<p>\u4e8c\u53c9\u641c\u7d22\u6811\u53c8\u79f0\u4e8c\u53c9\u6392\u5e8f\u6811 (\u5b83\u8d70\u4e2d\u5e8f\u904d\u5386\u662f\u6709\u5e8f\u7684)&#xff0c;\u5b83\u6216\u8005\u662f\u4e00\u68f5\u7a7a\u6811&#xff0c;\u6216\u8005\u662f\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\u7684\u4e8c\u53c9\u6811&#xff1a;<\/p>\n<ul>\n<li>\u82e5\u5b83\u7684\u5de6\u5b50\u6811\u4e0d\u4e3a\u7a7a&#xff0c;\u5219\u5de6\u5b50\u6811\u4e0a\u6240\u6709\u7ed3\u70b9\u7684\u503c\u90fd\u5c0f\u4e8e\u6839\u7ed3\u70b9\u7684\u503c&#xff08;\u5b9e\u8df5\u4e2d\u53ef\u53d8\u5f62\u5de6\u5b50\u6811\u4e0a\u6240\u6709\u7ed3\u70b9\u7684\u503c\u90fd\u5c0f\u4e8e\u7b49\u4e8e\u6839\u7ed3\u70b9\u7684\u503c&#xff09;<\/li>\n<li>\u82e5\u5b83\u7684\u53f3\u5b50\u6811\u4e0d\u4e3a\u7a7a&#xff0c;\u5219\u53f3\u5b50\u6811\u4e0a\u6240\u6709\u7ed3\u70b9\u7684\u503c\u90fd\u5927\u4e8e\u6839\u7ed3\u70b9\u7684\u503c&#xff08;\u5b9e\u8df5\u4e2d\u53ef\u53d8\u5f62\u53f3\u5b50\u6811\u4e0a\u6240\u6709\u7ed3\u70b9\u7684\u503c\u90fd\u5927\u4e8e\u7b49\u4e8e\u6839\u7ed3\u70b9\u7684\u503c&#xff09;<\/li>\n<li>\u5b83\u7684\u5de6\u53f3\u5b50\u6811\u4e5f\u5206\u522b\u4e3a\u4e8c\u53c9\u641c\u7d22\u6811\u3002<\/li>\n<\/ul>\n<p><span style=\"color:#fe2c24\">\u6ce8\u610f<\/span><span style=\"color:#fe2c24\">&#xff1a;\u641c\u7d22\u4e8c\u53c9\u6811\u7684\u7279\u6027&#xff0c;\u8d70\u4e2d\u5e8f\u904d\u5386\u662f\u6709\u5e8f\u7684&#xff0c;\u4e2d\u5e8f\u904d\u5386\u540e\u7eed\u6211\u4eec\u4f1a\u8bb2\u3002<\/span><\/p>\n<h3>2.3 \u6027\u8d28<\/h3>\n<h4>2.3.1 \u6027\u8d281&#xff1a;\u5728\u4e8c\u53c9\u6811\u7684\u7b2ci\u5c42\u4e0a\u81f3\u591a\u67092^(i-1)\u4e2a\u7ed3\u70b9(i&gt;&#061;1)<\/h4>\n<h4>2.3.2 \u6027\u8d282&#xff1a;\u5728\u9ad8\u5ea6\u4e3ah\u7684\u4e8c\u53c9\u6811\u81f3\u591a\u67092^h-1\u4e2a\u7ed3\u70b9<\/h4>\n<h4>2.3.3 \u6027\u8d283&#xff1a;\u5bf9\u4efb\u4f55\u4e00\u68f5\u4e8c\u53c9\u6811 T&#xff0c;\u5982\u679c\u5176\u5ea6\u4e3a 0 (\u53f6\u5b50) \u7ed3\u70b9\u6570\u4e3a \\\\(n_0\\\\)&#xff0c;\u5ea6\u4e3a 2 \u7684\u7ed3\u70b9\u6570\u4e3a n0&#xff0c;\u5219 n0&#061;n2&#043;1<\/h4>\n<ul>\n<li>\u524d\u9762\u6811\u6027\u8d28\u8bb2\u5230&#xff0c;\u6811\u4e2d\u7684\u7ed3\u70b9\u6570 &#061; \u6240\u6709\u7ed3\u70b9\u7684\u5ea6\u6570\u4e4b\u548c &#043; 1\u3002\u5047\u8bbe\u6811\u4e2d\u7ed3\u70b9\u603b\u6570\u4e3a m&#xff0c;\u5ea6\u4e3a 1 \u7684\u7ed3\u70b9\u6570\u4e3an1&#xff0c;\u5219m&#061;n1&#043;2n2&#043;1<\/li>\n<li>\u5047\u8bbe\u6811\u4e2d\u7ed3\u70b9\u603b\u6570\u4e3a m&#xff0c;\u5219m&#061;n0&#043;n1&#043;n2&#061;n1&#043;2n2&#043;1\u5316\u89e3\u4e00\u4e0b\u53ef\u4ee5\u63a8\u5bfc\u51fa n0&#061;n2&#043;1\u00a0\u5c31\u662f\u8fd9\u4e2a\u6027\u8d28\u7684\u7ed3\u8bba\u3002<\/li>\n<\/ul>\n<h3>2.4 \u4e8c\u53c9\u6811\u5b58\u50a8\u7ed3\u6784<\/h3>\n<h4>2.4.1 \u987a\u5e8f\u5b58\u50a8\u7ed3\u6784<\/h4>\n<ul>\n<li>\u5c06\u4e8c\u53c9\u6811\u6bcf\u5c42\u7684\u7ed3\u70b9\u7684\u5143\u7d20\u4ece\u5de6\u5230\u53f3&#xff0c;\u4ece\u4e0a\u5230\u4e0b\u4f9d\u6b21\u5b58\u5230\u6570\u7ec4\u4e2d&#xff0c;\u7a7a\u7ed3\u70b9\u4e5f\u8981\u5b58\u5230\u6570\u7ec4\u4e2d&#xff0c;\u7528\u7279\u6b8a\u5143\u7d20\u8fdb\u884c\u6807\u8bb0&#xff0c;\u8fd9\u4e2a\u7279\u6b8a\u5143\u7d20\u662f\u4e8c\u53c9\u6811\u4e2d\u4e00\u5b9a\u4e0d\u5b58\u5728\u7684\u5143\u7d20\u3002<\/li>\n<li>\u53ef\u4ee5\u770b\u5230\u5b8c\u5168\u4e8c\u53c9\u6811 \/ \u6ee1\u4e8c\u53c9\u6811\u662f\u975e\u5e38\u9002\u5408\u4f7f\u7528\u987a\u5e8f\u7ed3\u6784\u5b58\u50a8&#xff0c;\u975e\u5b8c\u5168\u4e8c\u53c9\u6811\u4f7f\u7528\u987a\u5e8f\u7ed3\u6784\u5b58\u50a8\u5c31\u5b58\u5728\u4e00\u5b9a\u7684\u7a7a\u95f4\u6d6a\u8d39\u3002\u5c24\u5176\u662f\u6bcf\u5c42\u7a7a\u7ed3\u70b9\u8d8a\u591a\u6d6a\u8d39\u8d8a\u591a&#xff0c;\u8fd9\u79cd\u7ed3\u6784\u66f4\u9002\u5408\u540e\u9762\u7684\u94fe\u5f0f\u7ed3\u6784\u5b58\u50a8\u3002<\/li>\n<\/ul>\n<ul>\n<li>\u5c06\u6bcf\u5c42\u7684\u7ed3\u70b9\u7684\u5143\u7d20\u5b58\u50a8\u5230\u6570\u7ec4\u65f6\u4e00\u822c\u4ece\u4e0b\u6807 0 \u4f4d\u7f6e\u5f00\u59cb\u5b58\u653e\u3002\u90e8\u5206\u4e66\u7c4d\u4e2d\u53ef\u4ee5\u4ece 1 \u4f4d\u7f6e\u5f00\u59cb\u5b58\u653e&#xff0c;\u820d\u5f03\u4e86\u6570\u7ec4\u4e0b\u6807 0 \u4f4d\u7f6e (\u4e25\u851a\u654f\u8001\u5e08\u7684\u4e66\u7c4d\u5c31\u662f\u8fd9\u6837\u7684)\u3002\u4ece\u5b9e\u8df5\u7684\u89d2\u5ea6\u4ece\u4e0b\u6807 1 \u4f4d\u7f6e\u5f00\u59cb\u653e\u5e76\u6ca1\u6709\u4ec0\u4e48\u4f18\u52bf&#xff0c;\u8fd8\u6d6a\u8d39\u4e86\u4e00\u4e2a\u7a7a\u95f4&#xff0c;\u6240\u4ee5\u6211\u4eec\u4e0b\u9762\u7684\u8bb2\u89e3\u5747\u4ee5\u4ece\u4e0b\u6807 0 \u4f4d\u7f6e\u5f00\u59cb\u5b58\u6570\u636e\u4e3a\u4e3b\u3002<\/li>\n<li>\u5047\u8bbe x \u7ed3\u70b9\u5b58\u50a8\u4f4d\u7f6e\u7684\u4e0b\u6807\u4e3a i&#xff0c;\u5219 x \u7ed3\u70b9\u7684\u53cc\u4eb2\u7ed3\u70b9\u5b58\u50a8\u4f4d\u7f6e\u7684\u4e0b\u6807\u4e3a (i-1)\/2<\/li>\n<li>\u5047\u8bbe x \u7ed3\u70b9\u5b58\u50a8\u4f4d\u7f6e\u7684\u4e0b\u6807\u4e3a i&#xff0c;\u5219 x \u7ed3\u70b9\u7684\u5de6\u5b69\u5b50\u7ed3\u70b9\u5b58\u50a8\u4f4d\u7f6e\u7684\u4e0b\u6807\u4e3a (2i&#043;1)&#xff0c;\u53f3\u5b69\u5b50\u7ed3\u70b9\u5b58\u50a8\u4f4d\u7f6e\u4e0b\u6807\u4e3a 2i&#043;2<\/li>\n<\/ul>\n<p><span style=\"color:#fe2c24\">\u6ce8\u610f&#xff1a;\u4e00\u5b9a\u8981\u8bb0\u4f4f\u8fd9\u4e24\u4e2a\u6c42\u53cc\u4eb2\u548c\u5b69\u5b50\u7684\u516c\u5f0f\u3002<\/span><\/p>\n<h4><span style=\"color:null\">2.4.2 \u94fe\u5f0f\u5b58\u50a8\u65b9\u5f0f<\/span><\/h4>\n<p>\u5b8c\u5168\u4e8c\u53c9\u6811\u7ed3\u6784\u975e\u5e38\u9002\u5408\u987a\u5e8f\u5b58\u50a8&#xff0c;\u4f46\u662f\u5b9e\u8df5\u573a\u666f\u66f4\u591a\u662f\u975e\u5b8c\u5168\u4e8c\u53c9\u6811&#xff0c;\u5b83\u4eec\u5c31\u66f4\u9002\u5408\u4f7f\u7528\u94fe\u5f0f\u5b58\u50a8\u3002\u94fe\u5f0f\u7ed3\u70b9\u4e2d\u81f3\u5c11\u8981\u5b58\u50a8\u5143\u7d20\u3001\u5de6\u5b69\u5b50\u6307\u9488\u3001\u53f3\u5b69\u5b50\u6307\u9488&#xff0c;\u6709\u4e9b\u573a\u666f\u4e0b\u8fd8\u4f1a\u518d\u589e\u52a0\u4e00\u4e0b\u53cc\u4eb2\u6307\u9488&#xff08;\u7ea2\u9ed1\u6811\u5c31\u9700\u8981\u53cc\u4eb2\u6307\u9488&#xff09;&#xff0c;\u8fd9\u4e24\u79cd\u7ed3\u6784\u5206\u522b\u88ab\u79f0\u4e3a\u4e8c\u53c9\u94fe\u548c\u4e09\u53c9\u94fe\u3002<\/p>\n<p>\/\/ \u4e8c\u53c9\u94fe<br \/>\ntypedef struct BinaryTreeNode {<br \/>\n    struct BinaryTreeNode* left;   \/\/ \u6307\u5411\u5de6\u5b69\u5b50\u7684\u6307\u9488<br \/>\n    struct BinaryTreeNode* right;  \/\/ \u6307\u5411\u53f3\u5b69\u5b50\u7684\u6307\u9488<br \/>\n    BTDataType data;               \/\/ \u6570\u636e\u5143\u7d20<br \/>\n}BTNode;<\/p>\n<p>\/\/ \u4e09\u53c9\u94fe<br \/>\ntypedef struct BinaryTreeNode {<br \/>\n    struct BinaryTreeNode* left;   \/\/ \u6307\u5411\u5de6\u5b69\u5b50\u7684\u6307\u9488<br \/>\n    struct BinaryTreeNode* right;  \/\/ \u6307\u5411\u53f3\u5b69\u5b50\u7684\u6307\u9488<br \/>\n    struct BinaryTreeNode* parent; \/\/ \u6307\u5411\u53cc\u4eb2\u7684\u6307\u9488<br \/>\n    BTDataType data;               \/\/ \u6570\u636e\u5143\u7d20<br \/>\n}BTNode;<\/p>\n<h3>2.5 \u4e8c\u53c9\u6811\u987a\u5e8f\u5b58\u50a8\u7ed3\u6784&#8212;\u5806<\/h3>\n<h4>2.5.1 \u5806\u7684\u5b9a\u4e49<\/h4>\n<p>\u5806\u5728\u5b58\u50a8\u7ed3\u6784\u662f\u987a\u5e8f\u5b58\u50a8(\u6570\u7ec4)&#xff0c;\u903b\u8f91\u4e0a\u662f\u2f00\u68f5\u5b8c\u5168\u2f06\u53c9\u6811\u3002\u2f29\u5806\u5c31\u662f\u6811\u4e2d\u4efb\u610f \u53cc\u4eb2&#061;\u5b69\u2f26\u3002<\/p>\n<p>\u2f29\u5806\u7684\u6839\u662f\u5f53\u524d\u6811\u7684\u6700\u2f29\u503c&#xff0c;\u4efb\u610f\u2f26\u6811\u7684\u6839\u4e5f\u662f\u5f53\u524d\u6811\u6700\u2f29\u7684\u3002\u2f24\u5806\u7684\u6839\u662f\u5f53\u524d\u2f26\u6811\u7684\u6700\u2f24\u503c&#xff0c;\u4efb \u610f\u2f26\u6811\u7684\u6839\u4e5f\u662f\u5f53\u524d\u2f26\u6811\u6700\u2f24\u503c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1856\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142547-6ae74bebeac84.png\" width=\"1280\" \/><\/p>\n<h4>2.5.2 \u5806\u7684\u57fa\u672c\u64cd\u4f5c<\/h4>\n<p>\u5806\u662f\u628a\u5b8c\u5168\u2f06\u53c9\u6811\u5b58\u50a8\u5728\u987a\u5e8f\u5b58\u50a8\u7ed3\u6784\u4e2d&#xff0c;\u6240\u4ee5\u4ed6\u7684\u7ed3\u6784\u8bbe\u8ba1\u8ddf\u987a\u5e8f\u8868\u7c7b\u4f3c\u3002<\/p>\n<p>\u5806\u7684\u64cd\u4f5c\u4e3b\u8981\u662f\u63d2\u2f0a\u6570\u636e&#xff0c;\u5220\u9664\u5806\u9876\u6570\u636e&#xff0c;\u53d6\u5806\u9876\u6570\u636e\u7b49\u2f0f\u4e2a\u6838\u2f3c\u63a5\u2f1d&#xff0c;\u63d2\u2f0a\u548c\u5220\u9664\u59cb\u7ec8\u4fdd\u6301\u4ed6\u662f \u5806\u7ed3\u6784\u3002<\/p>\n<p>#pragma once<br \/>\n#define _CRT_SECURE_NO_WARNINGS 1<br \/>\n#include&lt;stdio.h&gt;<br \/>\n#include&lt;stdlib.h&gt;<br \/>\n#include&lt;assert.h&gt;<br \/>\n#include&lt;string.h&gt;<\/p>\n<p>typedef int HeapDataType;<br \/>\ntypedef struct {<br \/>\nHeapDataType* a;<br \/>\nint size;      \/\/\u5143\u7d20\u4e2a\u6570<br \/>\nint capacity;   \/\/\u5806\u7684\u5bb9\u91cf<br \/>\n}Heap;<\/p>\n<p>\/\/\u4ea4\u6362\u51fd\u6570<br \/>\nvoid Swap(int* x, int* y);<\/p>\n<p>\/\/\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5<br \/>\nvoid AdjustUp(HeapDataType* a, int child);<\/p>\n<p>\/\/\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5<br \/>\nvoid AdjustDown(HeapDataType* a, int n, int parent);<\/p>\n<p>\/\/\u9ed8\u8ba4\u521d\u59cb\u5316\u5806<br \/>\nvoid HeapInit(Heap* hp);<\/p>\n<p>\/\/\u5229\u7528\u7ed9\u5b9a\u6570\u7ec4\u521d\u59cb\u5316\u5efa\u5806<br \/>\nvoid HeapInitArray(Heap* hp, HeapDataType* a, int n);<\/p>\n<p>\/\/\u5806\u7684\u9500\u6bc1<br \/>\nvoid HeapDestroy(Heap* hp);<\/p>\n<p>\/\/\u5806\u7684\u63d2\u5165<br \/>\nvoid HeapPush(Heap* hp, HeapDataType x);<\/p>\n<p>\/\/ \u5806\u7684\u5220\u9664&#xff0c;\u5220\u9664\u5806\u9876\u6570\u636e<br \/>\nvoid HeapPop(Heap* hp);<\/p>\n<p>\/\/ \u83b7\u53d6\u5806\u9876\u6570\u636e<br \/>\nHeapDataType HeapTop(Heap* hp);<\/p>\n<p>\/\/ \u5224\u7a7a<br \/>\nint HeapEmpty(Heap* hp);<\/p>\n<p>\/\/\u83b7\u53d6\u5806\u7684\u6570\u636e\u4e2a\u6570<br \/>\nint HeapSize(Heap* hp);<\/p>\n<h4 style=\"background-color:transparent\">2.5.3 \u5806\u7684\u63d2\u5165<\/h4>\n<p>\u5806\u4e2d\u63d2\u2f0a\u6570\u636e\u5728\u5b58\u50a8\u7ed3\u6784\u4e0a\u662f\u63d2\u2f0a\u5728\u6570\u7ec4\u5c3e\u90e8&#xff0c;\u903b\u8f91\u7ed3\u6784\u4e0a\u662f\u63d2\u2f0a\u5728\u5b8c\u5168\u2f06\u53c9\u6811\u6700\u540e\u2f00\u5c42\u6700\u540e\u2f00\u4e2a \u53f6\u2f26\u7ed3\u70b9\u7684\u65c1\u8fb9&#xff0c;\u4fdd\u6301\u5b8c\u5168\u2f06\u53c9\u6811\u7ed3\u6784\u3002<\/p>\n<p>\/\/\u5806\u7684\u63d2\u5165<br \/>\nvoid HeapPush(Heap* hp, HeapDataType x)<br \/>\n{<br \/>\nassert(hp);<br \/>\nif (hp-&gt;capacity &#061;&#061; hp-&gt;size)   \/\/\u5806\u4e3a\u7a7a<br \/>\n{<br \/>\n\/\/\u5f00\u8f9f\u7a7a\u95f4<br \/>\nint newCapacity &#061; hp-&gt;capacity &#061;&#061; 0 ? 4 : hp-&gt;capacity * 2;<br \/>\nHeapDataType* tmp &#061; (HeapDataType*)realloc(hp-&gt;a, sizeof(HeapDataType) * newCapacity);<br \/>\nif (tmp &#061;&#061; NULL)<br \/>\n{<br \/>\nperror(&#034;HeapPush::realloc()&#034;);<br \/>\nreturn;<br \/>\n}<br \/>\nhp-&gt;a &#061; tmp;<br \/>\nhp-&gt;capacity &#061; newCapacity;<br \/>\n}<br \/>\nhp-&gt;a[hp-&gt;size] &#061; x;<br \/>\nhp-&gt;size&#043;&#043;;<\/p>\n<p>    \/\/\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5<br \/>\nAdjustUp(hp-&gt;a, hp-&gt;size &#8211; 1);<br \/>\n} <\/p>\n<p>\u5c3e\u90e8\u63d2\u5165\u6570\u636e\u4e4b\u540e\u5c31\u53c8\u53ef\u80fd\u4f1a\u7834\u73af\u4e8c\u53c9\u6811\u7684\u7ed3\u6784&#xff0c;\u6240\u4ee5\u6211\u4eec\u4f7f\u7528\u4e86\u4e00\u4e2a\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5&#xff0c;\u4ece\u63d2\u2f0a\u6570\u636e\u8fd9\u4e2a\u4f4d\u7f6e\u5f00\u59cb \u6cbf\u7740\u7956\u5148\u8def\u5f84\u5411\u4e0a\u8c03\u6574&#xff0c;\u6700\u574f\u60c5\u51b5\u4e0b\u8981\u8c03\u6574\u5230\u6839\u3002\u5f53\u7136\u5982\u679c\u8c03\u6574\u5230\u7956\u5148\u8def\u5f84\u7684\u4e2d\u95f4\u4f4d\u7f6e\u5c31\u6ee1\u2f9c\u5806\u4e5f \u53ef\u4ee5\u505c\u2f4c&#xff0c;\u751a\u2f84\u63d2\u2f0a\u540e&#xff0c;\u76f4\u63a5\u5c31\u6ee1\u2f9c\u5806&#xff0c;\u5c31\u4e0d\u9700\u8981\u8c03\u6574\u3002<\/p>\n<h5 style=\"background-color:transparent\">2.5.3.1 \u5411\u4e0a\u8c03\u6574\u7b97\u6cd5<\/h5>\n<p>\u6211\u4eec\u8c03\u6574\u4e4b\u524d\u8981\u5148\u786e\u5b9a\u662f\u5927\u5806\u8fd8\u662f\u5c0f\u5806&#xff0c;\u6211\u4eec<span style=\"color:#fe2c24\">\u4ee5\u5c0f\u5806\u4e3a\u4f8b<\/span>\u3002<\/p>\n<p>\u6211\u4eec\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5\u5c31\u662f\u62ff\u81ea\u5df1\u7684\u4f4d\u7f6e\u53bb\u548c\u7956\u5148\u53bb\u6bd4\u8f83&#xff0c;\u5982\u679c\u81ea\u5df1\u7684\u4f4d\u7f6e\u6bd4\u7956\u5148\u7684\u4f4d\u7f6e\u5c0f&#xff0c;\u5c31\u548c\u7956\u5148\u6362\u4e2a\u4f4d\u7f6e&#xff0c;\u4f9d\u6b21\u7c7b\u63a8&#xff0c;\u76f4\u5230\u81ea\u5df1\u7684\u7956\u5148\u6bd4\u81ea\u5df1\u5c0f\u505c\u6b62&#xff0c;\u6216\u8005\u662f\u81ea\u5df1\u7684\u4f4d\u7f6e\u5df2\u7ecf\u5230\u4e86\u6839\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\/\/\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5<br \/>\nvoid AdjustUp(HeapDataType* a,int child)<br \/>\n{<br \/>\nassert(a);<br \/>\n\/\/\u53cc\u4eb2<br \/>\nint parent &#061; (child &#8211; 1) \/ 2;<br \/>\nwhile (child &gt; 0)<br \/>\n{<br \/>\nif (a[child] &lt; a[parent])<br \/>\n{<br \/>\n\/\/\u4ea4\u6362<br \/>\nSwap(&amp;a[child], &amp;a[parent]);<br \/>\nchild &#061; parent;<br \/>\nparent &#061; (child &#8211; 1) \/ 2;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nbreak;<br \/>\n}<br \/>\n} <\/p>\n<p>\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6O(log n)&#xff0c;\u56e0\u4e3a\u5806\u662f\u5b8c\u5168\u2f06\u53c9\u6811&#xff0c;\u5b8c\u5168\u2f06\u53c9\u6811\u7684\u2fbc\u5ea6\u662f[log\u2082 n]&#043;1&#xff0c; \u5411\u4e0a\u8c03\u6574\u7b97\u6cd5\u6700\u574f\u60c5\u51b5\u7684\u8c03\u6574\u6b21\u6570\u662f\u2fbc\u5ea6\u6b21\u3002<\/p>\n<h5>2.5.3.2 \u7ec3\u4e60<\/h5>\n<p>\u5df2\u77e5\u5173\u952e\u5b57\u5e8f\u5217 5,8,12,19,28,20,15,22 \u662f\u5c0f\u6839\u5806 (\u6700\u5c0f\u5806)&#xff0c;\u63d2\u5165\u5173\u952e\u5b57 3&#xff0c;\u8c03\u6574\u540e\u5f97\u5230\u7684\u5c0f\u6839\u5806\u662f__<span style=\"color:#fe2c24\">A<\/span>__<\/p>\n<p>A. 3,5,12,8,28,20,15,22,19\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0B. 3,5,12,19,20,15,22,8,28<\/p>\n<p>C. 3,8,12,5,20,15,22,28,19\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0D. 3,12,5,8,28,20,15,22,19<\/p>\n<\/p>\n<p>\u5df2\u77e5\u5e8f\u5217 25,13,10,12,9 \u662f\u5927\u6839\u5806&#xff0c;\u5728\u5e8f\u5217\u5c3e\u90e8\u63d2\u5165\u65b0\u5143\u7d20 18&#xff0c;\u5c06\u5176\u518d\u8c03\u6574\u4e3a\u5927\u6839\u5806&#xff0c;\u8c03\u6574\u8fc7\u7a0b\u4e2d\u5143\u7d20\u4e4b\u95f4\u8fdb\u884c\u7684\u6bd4\u8f83\u6b21\u6570\u662f__<span style=\"color:#fe2c24\">B<\/span>__<\/p>\n<p>A. 1\u2003B. 2\u2003C. 4\u2003D. 5<\/p>\n<p><span style=\"color:#fe2c24\">\u6ce8\u610f&#xff1a;\u8fd9\u91cc\u662f\u6bd4\u8f83\u6b21\u6570&#xff0c;\u4e0d\u662f\u4ea4\u6362\u6b21\u6570\u3002<\/span><\/p>\n<h4><span style=\"color:null\">2.5.4 \u5806\u7684\u5220\u9664<\/span><\/h4>\n<\/p>\n<ul>\n<li>\u5806\u7684\u5220\u9664\u4e0d\u662f\u5220\u9664\u5806\u5c3e\u7684\u6570\u636e&#xff0c;\u56e0\u4e3a\u90a3\u6837\u6ca1\u6709\u4ec0\u4e48\u4ef7\u503c\u3002\u5806\u7684\u5220\u9664\u662f\u5220\u9664\u5806\u9876\u7684\u6570\u636e&#xff0c;\u5220\u9664\u540e\u4f7f\u7528\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u4fdd\u6301\u5b83\u7ee7\u7eed\u662f\u5806&#xff0c;\u540c\u65f6\u628a\u6b21\u5927\u6216\u6b21\u5c0f\u7684\u6570\u636e\u9009\u51fa\u6765\u653e\u5230\u4e86\u5806\u9876\u4f4d\u7f6e\u3002<\/li>\n<li>\u5220\u9664\u5806\u9876\u6570\u636e&#xff0c;\u5e76\u4e0d\u662f\u628a\u540e\u9762\u7684\u6570\u636e\u5f80\u524d\u632a\u52a8\u8986\u76d6&#xff0c;\u539f\u56e0\u6709\u4e8c&#xff1a;<\/li>\n<\/ul>\n<p>a. \u540e\u9762\u6570\u636e\u5f80\u524d\u632a\u52a8\u8986\u76d6\u6548\u7387\u592a\u4f4e&#xff0c;\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a (O(n))<\/p>\n<p>b. \u5f80\u524d\u632a\u52a8\u8986\u76d6&#xff0c;\u5806\u7ed3\u6784\u5c31\u88ab\u7834\u574f\u4e86&#xff0c;\u8981\u628a\u5b83\u91cd\u65b0\u8c03\u6574\u4e3a\u5806&#xff0c;\u6210\u672c\u5f88\u5927\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1952\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142548-6ae74beccc31e.png\" width=\"1216\" \/><\/p>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u4f1a\u7834\u73af\u5de6\u53f3\u5b50\u6811\u7684\u7ed3\u6784\u3002<\/p>\n<p>\u5220\u9664\u5806\u9876\u6570\u636e\u7684<span style=\"color:#fe2c24\">\u2fbc\u6548\u2f45\u6cd5<\/span>\u662f\u628a\u5806\u5c3e\u7684\u6570\u636e\u548c\u5806\u9876\u7684\u6570\u636e\u4ea4\u6362&#xff0c;\u5220\u9664\u5806\u5c3e\u6570\u636e&#xff0c;\u8fd9\u6837\u5de6\u2f26\u6811\u548c\u53f3\u2f26\u6811 \u7ed3\u6784\u4e0d\u53d8&#xff0c;\u4f9d\u65e7\u4fdd\u6301\u662f\u5806&#xff0c;\u4f7f\u2f64\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5\u5c31\u53ef\u4ee5\u628a\u5b83\u2fbc\u6548\u7684\u8c03\u6574\u6210\u5806\u3002<\/p>\n<p>\/\/ \u5806\u7684\u5220\u9664&#xff0c;\u5220\u9664\u5806\u9876\u6570\u636e<br \/>\nvoid HeapPop(Heap* hp)<br \/>\n{<br \/>\nassert(hp);<br \/>\nassert(hp-&gt;size &gt; 0);<br \/>\n\/\/\u4ea4\u6362\u5806\u9876\u548c\u5806\u5c3e\u7684\u6570\u636e\u4f4d\u7f6e<br \/>\nSwap(&amp;hp-&gt;a[0], &amp;hp-&gt;a[hp-&gt;size &#8211; 1]);<br \/>\nhp-&gt;size&#8211;;<\/p>\n<p>\/\/\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5<br \/>\nAdjustDown(hp-&gt;a, hp-&gt;size,0);<br \/>\n}<\/p>\n<h5 style=\"background-color:transparent\">2.5.4.1 \u5411\u4e0b\u8c03\u6574\u7b97\u6cd5<\/h5>\n<p><span style=\"color:#fe2c24\">\u4ee5\u5c0f\u5806\u4e3a\u4f8b&#xff1a;<\/span><\/p>\n<p>\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5\u5c31\u662f\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u4e8e\u5b83\u7684\u4e24\u4e2a\u5b50\u6811\u76f8\u6bd4&#xff0c;\u4e0e\u5176\u4e2d\u5c0f\u7684\u8fdb\u884c\u4ea4\u6362&#xff0c;\u4f9d\u6b21\u5411\u4e0b\u8c03\u6574\u4ea4\u6362\u76f4\u5230\u4e24\u4e2a\u5b50\u6811\u90fd\u6bd4\u81ea\u5df1\u5c0f\u4e3a\u6b62&#xff0c;\u6216\u8005\u5230\u8fbe\u53f6\u8282\u70b9\u4e3a\u6b62\u3002<\/p>\n<p>\/\/\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5<br \/>\nvoid AdjustDown(HeapDataType* a, int size, int parent)<br \/>\n{<br \/>\nassert(a);<br \/>\n\/\/\u9ed8\u8ba4child\u4e3a\u5de6\u5b69\u5b50<br \/>\nint child &#061; parent * 2 &#043; 1;<br \/>\nwhile (child &lt; size)<br \/>\n{<br \/>\n\/\/\u9009\u51fa\u5c0f\u7684\u90a3\u4e2a\u5b69\u5b50<br \/>\nif (child &#043; 1 &lt; size &amp;&amp; a[child &#043; 1] &lt; a[child])<br \/>\n{<br \/>\nchild&#043;&#043;;<br \/>\n}<\/p>\n<p>\/\/\u6bd4\u8f83\u5c0f\u7684\u5b69\u5b50\u8ddf\u7236\u4eb2\u6bd4\u8f83<br \/>\nif (a[child] &lt; a[parent])<br \/>\n{<br \/>\n\/\/\u4ea4\u6362\u7236\u4eb2\u548c\u5b69\u5b50<br \/>\nSwap(&amp;a[child], &amp;a[parent]);<br \/>\n\/\/\u7236\u4eb2\u5230\u5b69\u5b50\u7684\u4f4d\u7f6e\u4e0a\u6765<br \/>\nparent &#061; child;<br \/>\nchild &#061; parent * 2 &#043; 1;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nbreak;<br \/>\n}<br \/>\n}<br \/>\n} <\/p>\n<p>\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6O(log\u00a0n)&#xff0c;\u56e0\u4e3a\u5806\u662f\u5b8c\u5168\u2f06\u53c9\u6811&#xff0c;\u5b8c\u5168\u2f06\u53c9\u6811\u7684\u2fbc\u5ea6\u662f[log\u2082 n]&#043;1&#xff0c; \u5411\u4e0b\u8c03\u6574\u7b97\u6cd5\u6700\u574f\u60c5\u51b5\u7684\u8c03\u6574\u6b21\u6570\u662f\u2fbc\u5ea6\u6b21\u3002<\/p>\n<h5>2.5.4.2 \u7ec3\u4e60<\/h5>\n<p>\u5df2\u77e5\u5c0f\u6839\u5806\u4e3a 8&#xff0c;15&#xff0c;10&#xff0c;21&#xff0c;34&#xff0c;16&#xff0c;12&#xff0c;\u5220\u9664\u5173\u952e\u5b57 8 \u4e4b\u540e\u9700\u91cd\u5efa\u5806&#xff0c;\u5728\u6b64\u8fc7\u7a0b\u4e2d&#xff0c;\u5173\u952e\u5b57\u4e4b\u95f4\u7684\u6bd4\u8f83\u6b21\u6570\u662f__C___<\/p>\n<p>A. 1\u2003B. 2\u2003C. 3\u2003D. 4<\/p>\n<h4>2.5.5 \u5efa\u5806<\/h4>\n<ul>\n<li>\u6709\u65f6\u6211\u4eec\u9700\u8981\u628a\u4e00\u4e2a\u6570\u7ec4\u76f4\u63a5\u6784\u5efa\u6210\u4e00\u4e2a\u5c0f\u5806\u6216\u8005\u5927\u5806&#xff0c;\u5efa\u5806\u6709\u4e24\u79cd\u65b9\u6cd5\u3002<\/li>\n<li>\u7b2c\u4e00\u79cd\u65b9\u6cd5\u7c7b\u4f3c\u5806\u63d2\u5165\u7684\u8fc7\u7a0b&#xff0c;\u5148\u628a\u7b2c 0 \u4e2a\u6570\u770b\u505a\u5806&#xff0c;\u7136\u540e\u4f9d\u6b21\u628a 1 \u81f3 n-1 \u4f4d\u7f6e\u7684\u6570\u636e\u4f7f\u7528\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5\u63d2\u5165\u5806\u3002<\/li>\n<li>\u7b2c\u2f06\u79cd\u2f45\u6cd5\u628a\u6240\u6709\u7684\u53f6\u2f26\u7ed3\u70b9\u90fd\u770b\u505a\u2f00\u4e2a\u4e2a\u5806&#xff0c;\u4ece\u5012\u6570\u7b2c\u2f06\u5c42\u7684\u6700\u540e\u2f00\u4e2a\u2fae\u53f6\u2f26\u7ed3\u70b9(\u6700\u540e\u2f00\u4e2a\u53f6\u2f26 \u7684\u53cc\u4eb2)\u5f00\u59cb\u8fdb\u2f8f\u5411\u4e0b\u8c03\u6574\u7b97\u6cd5\u5efa\u5806&#xff0c;\u76f4\u5230\u8c03\u6574\u5230\u6839\u3002<\/li>\n<\/ul>\n<p>\u7b2c\u4e00\u79cd\u65b9\u6cd5\u5c31\u662f\u7b80\u5355\u7684\u63d2\u5165\u548c\u5411\u4e0a\u8c03\u6574\u7b97\u6cd5&#xff0c;\u6211\u4eec\u91cd\u70b9\u5b66\u4e60\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1312\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142549-6ae74bedbfdce.png\" width=\"1664\" \/><\/p>\n<p><span style=\"color:#fe2c24\">\u4ece\u7b2c\u4e00\u4e2a\u975e\u53f6\u7ed3\u70b9\u5f00\u59cb\u5411\u4e0b\u8c03\u6574<\/span>&#xff0c;\u4f9d\u6b21\u7c7b\u63a8\u76f4\u5230\u6839\u8282\u70b9\u8c03\u6574\u5b8c\u6210\u4e4b\u540e\u5c31\u662f\u4e00\u4e2a\u5806\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1280\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142550-6ae74beec5e38.png\" width=\"1824\" \/><\/p>\n<p>\/\/\u5efa\u5c0f\u5806<br \/>\nvoid HeapInitArray(Heap* hp, HeapDataType* a, int n)<br \/>\n{<br \/>\nassert(hp);<br \/>\nassert(a);<br \/>\nassert(n &gt; 0);<\/p>\n<p>hp-&gt;a &#061; (HeapDataType*)malloc(sizeof(HeapDataType) * n);<br \/>\nif (hp-&gt;a &#061;&#061; NULL)<br \/>\n{<br \/>\nperror(&#034;HeapInitArray::malloc()&#034;);<br \/>\nexit(-1);<br \/>\n}<br \/>\nmemcpy(hp-&gt;a, a, sizeof(HeapDataType) * n);<br \/>\nhp-&gt;size &#061; hp-&gt;capacity &#061; n;<\/p>\n<p>\/\/\u5411\u4e0b\u8c03\u6574     \u627e\u5230\u6700\u540e\u4e00\u4e2a\u975e\u53f6\u5b50&#xff08;\u53f6\u5b50\u7684\u53cc\u4eb2&#xff09;<br \/>\nfor (int i &#061; (n &#8211; 1 &#8211; 1) \/ 2; i &gt;&#061; 0 ; i&#8211;)<br \/>\n{<br \/>\nAdjustDown(hp-&gt;a, n, i);<br \/>\n}<br \/>\n} <\/p>\n<p>\u8fd9\u5176\u4e2d\u6211\u4eec\u8981\u6ce8\u610f\u7684\u662f\u5411\u4e0b\u8c03\u6574\u65f6&#xff0c;\u627e\u6700\u540e\u4e00\u4e2a\u975e\u53f6\u8282\u70b9\u65f6&#xff0c;\u4e00\u5b9a\u65f6\u6700\u540e\u4e00\u4e2a\u7ed3\u70b9\u7684\u7236\u4eb2&#xff0c;\u6240\u4ee5\u6211\u4eecn-1-1 \u8fd9\u6837\u53ef\u4ee5\u66f4\u52a0\u65b9\u4fbf\u6211\u4eec\u7406\u89e3\u3002<\/p>\n<p>\u6211\u4eec\u5efa\u5927\u5806\u4e5f\u662f\u5982\u6b64&#xff0c;\u53ea\u662f\u5728\u5de6\u53f3\u5b69\u5b50\u4e2d\u627e\u5de6\u53f3\u5b69\u5b50\u4e2d\u6bd4\u8f83\u5927\u7684\u6765\u4ea4\u6362\u3002<\/p>\n<h5>2.5.5.1 \u65f6\u95f4\u590d\u6742\u5ea6\u7684\u6bd4\u8f83<\/h5>\n<p><span style=\"color:#fe2c24\">\u5411\u4e0a\u8c03\u6574\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(nlog n)\u3002<\/span><\/p>\n<p>\u5047\u8bbe\u6811\u7684\u2fbc\u5ea6\u4e3ah&#xff0c;\u6700\u574f\u60c5\u51b5\u4e0b\u5806\u4e3a\u5b8c\u5168\u2f06\u53c9\u6811&#xff0c;\u4e14\u6bcf\u6b21\u90fd\u9700\u8981\u8c03\u6574\u5230\u6839&#xff0c;\u5219\u8c03\u6574\u603b\u6b21\u6570&#061;\u6bcf\u5c42\u7ed3 \u70b9\u4e2a\u6570*\u6700\u574f\u9700\u8981\u5411\u4e0a\u8c03\u7684\u6b21\u6570\u3002<\/p>\n<p>\u5411\u4e0b\u8c03\u6574\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6O(n)&#xff0c;\u6240\u4ee5\u5efa\u5806\u5e94\u8be5\u4f18\u5148\u9009\u62e9\u5411\u4e0b\u8c03\u6574\u5efa\u5806\u3002<\/p>\n<h5>2.5.5.2 \u7ec3\u4e60<\/h5>\n<p>\u5728\u5c06\u6570\u636e\u5e8f\u5217 (6,1,5,9,8,4,7) \u5efa\u6210\u5927\u6839\u5806\u65f6&#xff0c;\u6b63\u786e\u7684\u5e8f\u5217\u53d8\u5316\u8fc7\u7a0b\u662f___<span style=\"color:#fe2c24\">A<\/span>___<\/p>\n<p>A. 6,1,7,9,8,4,5 \u21926,9,7,1,8,4,5 \u21929,6,7,1,8,4,5 \u21929,8,7,1,6,4,5<\/p>\n<p>B. 6,9,5,1,8,4,7 \u21926,9,7,1,8,4,5 \u21929,6,7,1,8,4,5 \u21929,8,7,1,6,4,5<\/p>\n<p>C. 6,9,5,1,8,4,7 \u21929,6,5,1,8,4,7 \u21929,6,7,1,8,4,5 \u21929,8,7,1,6,4,5<\/p>\n<p>\u00a0D. 6,1,7,9,8,4,5 \u21927,1,6,9,8,4,5 \u21927,9,6,1,8,4,5 \u21929,7,6,1,8,4,5 \u21929,8,6,1,7,4,5<\/p>\n<\/p>\n<p>\u4e0b\u5217\u5173\u4e8e\u5927\u6839\u5806 (\u81f3\u5c11\u542b 2 \u4e2a\u5143\u7d20) \u7684\u53d9\u8ff0\u4e2d&#xff0c;\u6b63\u786e\u7684\u662f___<span style=\"color:#fe2c24\">C<\/span>___\u3002<\/p>\n<p>\u2160. \u53ef\u4ee5\u5c06\u5806\u89c6\u4e3a\u4e00\u68f5\u5b8c\u5168\u4e8c\u53c9\u6811<\/p>\n<p>\u2161. \u53ef\u4ee5\u91c7\u7528\u987a\u5e8f\u5b58\u50a8\u65b9\u5f0f\u4fdd\u5b58\u5806<\/p>\n<p>\u2162. \u53ef\u4ee5\u5c06\u5806\u89c6\u4e3a\u4e00\u68f5\u4e8c\u53c9\u6392\u5e8f\u6811<\/p>\n<p>\u2163. \u5806\u4e2d\u7684\u6b21\u5927\u503c\u4e00\u5b9a\u5728\u6839\u7684\u4e0b\u4e00\u5c42<\/p>\n<\/p>\n<p>A\u3001\u4ec5 \u2160\u3001\u2161\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0B\u3001\u4ec5 \u2161\u3001\u2162<\/p>\n<p>C\u3001\u4ec5 \u2160\u3001\u2161 \u548c \u2163\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0D\u3001\u2160\u3001\u2162 \u548c \u2163<\/p>\n<p><span style=\"color:#fe2c24\">\u4e8c\u53c9\u6392\u5e8f\u6811\u662f\u5de6\u8fb9\u4e25\u683c\u5927\u4e8e\u6839\u7ed3\u70b9&#xff0c;\u53f3\u8fb9\u4e25\u683c\u5c0f\u4e8e\u6839\u8282\u70b9\u3002<\/span><\/p>\n<h4>2.5.6 \u5806\u6392\u5e8f<\/h4>\n<ul>\n<li>\u5806\u6392\u5e8f\u662f\u5806\u7684\u4e00\u4e2a\u91cd\u8981\u5e94\u7528\u573a\u666f\u4e4b\u4e00&#xff0c;\u5806\u7684\u672c\u8d28\u662f\u53ef\u4ee5\u5feb\u901f\u9009\u51fa\u6700\u5927\u6570\u6216\u6700\u5c0f\u6570&#xff0c;\u5220\u9664\u5806\u9876\u540e\u53ef\u4ee5\u5feb\u901f\u9009\u51fa\u6b21\u5927\u6216\u6b21\u5c0f\u6570\u636e\u3002\u90a3\u6211\u4eec\u60f3\u8981\u6392\u5e8f\u5c31\u662f\u4e0d\u65ad\u7684\u9009\u51fa\u5269\u4f59\u6570\u636e\u4e2d\u6700\u5927\u503c\u6216\u6700\u5c0f\u503c\u5b8c\u6210\u6392\u5e8f&#xff0c;\u5806\u6392\u5e8f\u7684\u601d\u60f3\u4e0a\u662f\u4e00\u79cd\u9009\u62e9\u6392\u5e8f\u3002<\/li>\n<li>\u5806\u6392\u5e8f\u5f88\u591a\u4e66\u7c4d\u90fd\u662f\u5b89\u6392\u5728\u6392\u5e8f\u7ae0\u8282\u7684&#xff0c;\u6211\u4eec\u653e\u5230\u8fd9\u91cc\u8bb2\u662f\u56e0\u4e3a\u6709\u4e86\u524d\u9762\u7684\u5806\u5b66\u4e60\u57fa\u7840&#xff0c;\u73b0\u5728\u8981\u7406\u89e3\u5806\u6392\u5e8f\u5982\u63a2\u56ca\u53d6\u7269&#xff0c;\u6240\u4ee5\u5c31\u653e\u5230\u8fd9\u91cc\u8bb2\u89e3\u4e86&#xff0c;\u5f53\u7136\u6392\u5e8f\u7ae0\u8282&#xff0c;\u6211\u4eec\u8fd8\u4f1a\u603b\u7ed3\u6027\u7684\u8ddf\u5176\u4ed6\u6392\u5e8f\u6bd4\u8f83\u3002<\/li>\n<li>\u5806\u6392\u5e8f\u5982\u679c\u6211\u4eec\u501f\u52a9\u4e00\u4e2a\u5806\u6570\u636e\u7ed3\u6784&#xff0c;\u90a3\u5c31\u7b80\u5355\u591a\u4e86&#xff0c;\u4f46\u662f\u8fd9\u6837\u9700\u8981\u5148\u5b9e\u73b0\u4e00\u4e2a\u5806\u6570\u636e\u7ed3\u6784&#xff0c;\u592a\u9ebb\u70e6&#xff0c;\u7a7a\u95f4\u6548\u7387\u4e5f\u4e0d\u9ad8\u3002\u6211\u4eec\u5176\u5b9e\u53ef\u4ee5\u76f4\u63a5\u628a\u6570\u7ec4\u770b\u505a\u5b8c\u5168\u4e8c\u53c9\u6811&#xff0c;\u5efa\u5806&#xff0c;\u518d\u9009\u6570\u5373\u53ef\u3002<\/li>\n<li>n \u4e2a\u6570\u8981\u6392\u5347\u5e8f&#xff0c;\u90a3\u4e48\u6ce8\u610f\u6211\u4eec\u4e0d\u80fd\u5efa\u5c0f\u5806&#xff0c;\u56e0\u4e3a\u5982\u679c\u5efa\u5c0f\u5806&#xff0c;\u4f1a\u5bfc\u81f4\u7b2c 0 \u4e2a\u6570\u6392\u597d\u4e86&#xff0c;\u4f46\u662f\u8981\u9009\u51fa\u6b21\u5c0f\u7684\u6570\u4ee5\u53ca\u540e\u9762\u7684\u6811&#xff0c;\u5269\u4e0b\u7684\u6570\u5806\u7ed3\u6784\u5168\u4e71\u4e86&#xff0c;\u9700\u8981\u91cd\u65b0\u5efa\u5806&#xff0c;\u4ee3\u4ef7\u592a\u5927\u3002<\/li>\n<\/ul>\n<p>\u8003\u70b9&#xff1a;<\/p>\n<p>\u5347\u5e8f \u2192 \u5efa\u5927\u6839\u5806<\/p>\n<p>\u964d\u5e8f \u2192 \u5efa\u5c0f\u6839\u5806<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1888\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142551-6ae74befc90ec.png\" width=\"1312\" \/><\/p>\n<p>n \u4e2a\u6570\u8981\u6392\u5347\u5e8f\u7684\u903b\u8f91&#xff1a;<\/p>\n<p>a. n \u4e2a\u5efa\u5927\u5806&#xff0c;\u9009\u51fa\u6700\u5927\u7684\u6570<\/p>\n<p>b. \u7136\u540e\u628a\u5806\u9876\u7684\u6570\u636e\u8ddf\u5806\u5c3e\u6570\u636e\u4ea4\u6362&#xff0c;\u6700\u5927\u7684\u6570\u6392\u5230\u6700\u540e\u4e00\u4e2a\u4f4d\u7f6e\u4e86<\/p>\n<p>c. \u7136\u540e\u63a7\u5236\u5806\u6570\u636e\u4e2a\u6570\u4e3a n-1&#xff0c;\u903b\u8f91\u4e0a\u6700\u540e\u4e00\u4e2a\u6570\u4e0d\u662f\u5806\u91cc\u9762\u7684&#xff0c;\u7136\u540e\u6839\u4f4d\u7f6e\u5411\u4e0b\u8c03\u6574\u9009\u51fa\u6b21\u5927\u6570<\/p>\n<p>d. \u7136\u540e\u628a\u6b21\u5927\u7684\u6570\u4ea4\u6362\u5230\u5012\u6570\u7b2c\u4e8c\u4e2a\u4f4d\u7f6e&#xff0c;\u4ee5\u6b64\u7c7b\u63a8&#xff0c;\u91cd\u590d b\u3001c\u3001d \u6b65\u9aa4\u7684\u903b\u8f91&#xff0c;\u76f4\u5230\u6570\u7ec4\u6709\u5e8f<\/p>\n<p>e. \u6392\u964d\u5e8f\u5c31\u662f\u53cd\u8fc7\u6765&#xff0c;\u5efa\u5c0f\u5806&#xff0c;\u9009\u51fa\u6700\u5c0f\u6570&#xff0c;\u6362\u5230\u6700\u540e\u3002\u672c\u8d28\u6b64\u903b\u8f91\u7c7b\u4f3c\u5806\u5220\u9664\u7684\u903b\u8f91<\/p>\n<p>\/\/\u5806\u6392\u5e8f<br \/>\nvoid HeapSort(int* a, int n)<br \/>\n{<br \/>\n\/\/\u5347\u5e8f&#xff0c;\u5efa\u5927\u5806<br \/>\nfor (int i &#061; (n &#8211; 1 &#8211; 1) \/ 2; i &gt;&#061; 0; i&#043;&#043;)<br \/>\n{<br \/>\nAdjustDown(a, n, i);<br \/>\n}<br \/>\n\/\/\u9009\u6570\u6392\u5e8f<br \/>\nint j &#061; 1;  \/\/\u9009\u7b2c\u51e0\u5927\u7684\u6570<br \/>\nwhile (j &lt; n)     \/\/\u5f53j\u7b49\u4e8en\u65f6&#xff0c;\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\u4e86<br \/>\n{<br \/>\nSwap(&amp;a[0], &amp;a[n &#8211; j]);<br \/>\nAdjustDown(a, n &#8211; j, 0);<br \/>\nj&#043;&#043;;<br \/>\n}<\/p>\n<p>} <\/p>\n<p>\u5806\u6392\u5e8f\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a (O(nlog n))&#xff0c;\u5176\u4e2d\u5efa\u5806 (O(n))&#xff0c;\u9009\u6570\u6392\u5e8f\u4e3a (O(nlog n))&#xff0c;\u9009\u6570\u6392\u5e8f\u90e8\u5206\u590d\u6742\u5ea6\u8ba1\u7b97\u8ddf\u5411\u4e0a\u8c03\u6574\u5efa\u5806\u7c7b\u4f3c\u3002<\/p>\n<p>\u540e\u7eed\u5b66\u4e60\u6392\u5e8f\u65f6&#xff0c;\u8fd9\u5c31\u662f\u6211\u4eec\u9009\u62e9\u6392\u5e8f\u7684\u4e00\u79cd\u3002<\/p>\n<h4>2.5.7 top-k\u95ee\u9898<\/h4>\n<p>top-k \u95ee\u9898\u6307\u7684\u662f&#xff1a;\u4ece\u6d77\u91cf\u6570\u636e&#xff08;\u6709\u65f6\u751a\u81f3\u5927\u5230\u65e0\u6cd5\u4e00\u6b21\u6027\u5168\u90e8\u88c5\u5165\u5185\u5b58&#xff09;\u4e2d&#xff0c;\u5feb\u901f\u3001\u9ad8\u6548\u5730\u627e\u51fa\u6700\u5927&#xff08;\u6216\u6700\u5c0f&#xff09;\u7684\u524d k \u4e2a\u5143\u7d20&#xff0c;\u6216\u51fa\u73b0\u9891\u7387\u6700\u9ad8\u7684 K \u4e2a\u5143\u7d20\u7b49\u3002\u5982&#xff1a;\u5728\u6296\u97f3\u6bcf\u5929\u7684\u5e26\u8d27\u6392\u884c\u699c\u524d 100&#xff0c;\u6216\u8005<\/p>\n<p>\u5728\u4e00\u4e2a\u91d1\u878d\u4ea4\u6613\u7cfb\u7edf\u4e2d&#xff0c;\u9700\u8981\u5b9e\u65f6\u76d1\u63a7\u4ea4\u6613\u91d1\u989d\u6700\u5927\u7684\u524d k \u7b14\u4ea4\u6613&#xff0c;\u4ee5\u8bc6\u522b\u6f5c\u5728\u7684\u5f02\u5e38\u884c\u4e3a\u7b49\u7b49\u3002\u6211\u4eec\u8981\u627e\u524d k \u5927\u7684\u6570\u636e&#xff0c;\u4e3b\u8981\u6709\u4ee5\u4e0b\u4e09\u79cd\u601d\u8def (\u524d k \u5c0f\u7684\u53cd\u8fc7\u6765\u5c31\u884c)&#xff1a;<\/p>\n<ul>\n<li>\u601d\u8def 1&#xff1a;\u6392\u964d\u5e8f&#xff0c;\u6570\u7ec4\u524d k \u4e2a\u4f4d\u7f6e\u5c31\u662f\u524d k \u5927\u7684\u3002\u7528\u5806\u6392 \/ \u5feb\u6392\u7b49\u6700\u4f18\u79c0\u7684\u6392\u5e8f\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(nlogn)\\\\)\u3002\u4f46\u662f\u5982\u679c\u6570\u636e\u91cf\u975e\u5e38\u5927&#xff0c;\u90fd\u65e0\u6cd5\u4e00\u6b21\u6027\u88c5\u5165\u5185\u5b58&#xff0c;\u5219\u8fd9\u4e2a\u601d\u8def\u5c31\u6ca1\u529e\u6cd5\u4f7f\u7528\u4e86&#xff0c;\u56e0\u4e3a\u6392\u5e8f\u57fa\u672c\u90fd\u9700\u8981\u5728\u5185\u5b58\u4e2d\u5b8c\u6210\u3002<\/li>\n<li>\u601d\u8def 2&#xff1a;\u5c06\u6574\u4e2a\u6570\u7ec4\u5efa\u6210\u4e00\u4e2a\u5927\u5806&#xff0c;\u53d6\u5806\u9876\u6570\u636e&#xff0c;\u518d\u5220\u9664\u5806\u9876\u7684\u6570\u636e k-1 \u6b21&#xff0c;\u5c31\u53ef\u4ee5\u53d6\u5230\u524d k \u5927\u7684\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(n &#043; (k-1)logn)\\\\)&#xff0c;\u4e00\u822c\u60c5\u51b5\u4e0b k \u8fdc\u5c0f\u4e8e n \u662f\u4e00\u4e2a\u5e38\u6570&#xff0c;\u5219\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(n)\\\\)&#xff0c;\u6700\u574f\u60c5\u51b5\u4e0b k \u63a5\u8fd1 n \u65f6&#xff0c;\u5219\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(nlogn)\\\\)\u3002\u4f46\u662f\u5982\u679c\u6570\u636e\u91cf\u975e\u5e38\u5927&#xff0c;\u90fd\u65e0\u6cd5\u4e00\u6b21\u6027\u88c5\u5165\u5185\u5b58&#xff0c;\u5219\u8fd9\u4e2a\u601d\u8def\u4e5f\u6ca1\u529e\u6cd5\u4f7f\u7528&#xff0c;\u56e0\u4e3a\u5806\u53ea\u80fd\u5efa\u5728\u5185\u5b58\u4e2d\u3002<\/li>\n<li><span style=\"color:#fe2c24\">\u601d\u8def 3&#xff1a;\u7528\u6570\u7ec4\u7684\u524d k \u4e2a\u6570\u5efa\u5c0f\u5806&#xff0c;\u5269\u4e0b\u7684\u6570\u636e n-k \u4f9d\u6b21\u8ddf\u5806\u9876\u7684\u6570\u636e\u6bd4\u8f83&#xff0c;\u5982\u679c\u6bd4\u5806\u9876\u7684\u6570\u636e\u5927&#xff0c;\u5219\u66ff\u6362\u5806\u9876\u7684\u6570\u636e&#xff0c;\u518d\u5411\u4e0b\u8c03\u6574\u7ef4\u62a4\u5806\u3002\u7ed3\u675f\u540e&#xff0c;\u5806\u91cc\u9762\u5269\u4e0b\u7684\u6570\u636e\u5c31\u662f\u524d k \u5927\u7684\u6570\u636e&#xff0c;\u56e0\u4e3a\u662f\u5c0f\u5806&#xff0c;\u6240\u4ee5\u5806\u9876\u7684\u6570\u636e\u5c31\u662f\u7b2c k \u5927\u7684\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(k &#043; (n-k)*logk)\\\\)&#xff0c;\u4e00\u822c\u60c5\u51b5\u4e0b k \u8fdc\u5c0f\u4e8e n \u65f6&#xff0c;\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\\\(O(n)\\\\)&#xff1b;\u5f53 k&#061;n\/2 \u65f6&#xff0c;\u65f6\u95f4\u590d\u6742\u5ea6\u662f \\\\(O(nlogn)\\\\)&#xff1b;\u672c\u601d\u8def\u662f\u6700\u9002\u5408\u89e3\u51b3\u73b0\u5b9e\u4e2d\u7684 top-k \u95ee\u9898&#xff0c;\u56e0\u4e3a\u6570\u636e\u91cf\u975e\u5e38\u5927\u65e0\u6cd5\u653e\u5165\u5185\u5b58\u65f6&#xff0c;\u4ed6\u4e5f\u80fd\u89e3\u51b3&#xff0c;\u4e14\u6548\u7387\u5f88\u9ad8\u3002<\/span><\/li>\n<\/ul>\n<h3>2.6 \u4e8c\u53c9\u6811\u7684\u94fe\u5f0f\u5b58\u50a8<\/h3>\n<h4>2.6.1 \u4e8c\u53c9\u6811\u7684\u524d\u4e2d\u540e\u5e8f\u904d\u5386<\/h4>\n<p>\u2f06\u53c9\u6811\u662f\u2f00\u4e2a\u9012\u5f52\u5b9a\u4e49\u7684\u6570\u636e\u7ed3\u6784&#xff0c;\u4efb\u4f55\u2f00\u68f5\u2f06\u53c9\u6811\u53ef\u4ee5\u5206\u4e3a\u6839\u548c\u5de6\u53f3\u2f26\u6811&#xff0c;\u2fae\u7a7a\u7684\u5de6\u53f3\u2f26\u6811\u2f1c\u53ef \u4ee5\u5206\u4e3a\u6839\u548c\u5de6\u53f3\u2f26\u6811\u3002<\/p>\n<p>\u4e8c\u53c9\u6811\u6839\u636e\u5b83\u7684\u9012\u5f52\u7ed3\u6784\u6765\u8fdb\u884c\u904d\u5386&#xff0c;\u5219\u5206\u4e3a\u524d\u5e8f\u904d\u5386\u3001\u4e2d\u5e8f\u904d\u5386\u3001\u540e\u5e8f\u904d\u5386<\/p>\n<p>a. \u524d\u5e8f\u904d\u5386 (Preorder Traversal)&#xff0c;\u4ea6\u79f0\u5148\u5e8f\u904d\u5386 \/ \u5148\u6839\u904d\u5386&#xff0c;\u8bbf\u95ee\u987a\u5e8f\u4e3a&#xff1a;\u6839\u7ed3\u70b9\u3001\u5de6\u5b50\u6811\u3001\u53f3\u5b50\u6811<\/p>\n<p>b. \u4e2d\u5e8f\u904d\u5386 (Inorder Traversal)&#xff0c;\u4ea6\u79f0\u4e2d\u6839\u904d\u5386&#xff0c;\u8bbf\u95ee\u987a\u5e8f\u4e3a&#xff1a;\u5de6\u5b50\u6811\u3001\u6839\u7ed3\u70b9\u3001\u53f3\u5b50\u6811<\/p>\n<p>c. \u540e\u5e8f\u904d\u5386 (Postorder Traversal)&#xff0c;\u4ea6\u79f0\u540e\u6839\u904d\u5386&#xff0c;\u8bbf\u95ee\u987a\u5e8f\u4e3a&#xff1a;\u5de6\u5b50\u6811\u3001\u53f3\u5b50\u6811\u3001\u6839\u7ed3\u70b9<\/p>\n<p>typedef int BTDataType;<br \/>\n\/\/ \u4e8c\u53c9\u94fe<br \/>\ntypedef struct BinaryTreeNode {<br \/>\nstruct BinaryTreeNode* left;   \/\/ \u6307\u5411\u5de6\u5b69\u5b50\u7684\u6307\u9488<br \/>\nstruct BinaryTreeNode* right;  \/\/ \u6307\u5411\u53f3\u5b69\u5b50\u7684\u6307\u9488<br \/>\nBTDataType data;               \/\/ \u6570\u636e\u5143\u7d20<br \/>\n}BTNode;<\/p>\n<p>\/\/\u524d\u5e8f\u904d\u5386<br \/>\nvoid Preorder(BTNode* root) {<br \/>\nif (root &#061;&#061; NULL) {<br \/>\nprintf(&#034;N &#034;);<br \/>\nreturn;<br \/>\n}<br \/>\n\/\/ \u6839<br \/>\nprintf(&#034;%c &#034;, root-&gt;data);<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u5de6\u5b50\u6811<br \/>\nPreorder(root-&gt;left);<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u53f3\u5b50\u6811<br \/>\nPreorder(root-&gt;right);<br \/>\n}<\/p>\n<p>\/\/\u4e2d\u5e8f\u904d\u5386<br \/>\nvoid Inorder(BTNode* root) {<br \/>\nif (root &#061;&#061; NULL) {<br \/>\nprintf(&#034;N &#034;);<br \/>\nreturn;<br \/>\n}<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u5de6\u5b50\u6811<br \/>\nInorder(root-&gt;left);<br \/>\n\/\/ \u6839<br \/>\nprintf(&#034;%c &#034;, root-&gt;data);<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u53f3\u5b50\u6811<br \/>\nInorder(root-&gt;right);<br \/>\n}<\/p>\n<p>\/\/\u540e\u5e8f\u904d\u5386<br \/>\nvoid Postorder(BTNode* root) {<br \/>\nif (root &#061;&#061; NULL) {<br \/>\nprintf(&#034;N &#034;);<br \/>\nreturn;<br \/>\n}<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u5de6\u5b50\u6811<br \/>\nPostorder(root-&gt;left);<br \/>\n\/\/ \u9012\u5f52\u904d\u5386\u53f3\u5b50\u6811<br \/>\nPostorder(root-&gt;right);<br \/>\n\/\/ \u6839<br \/>\nprintf(&#034;%c &#034;, root-&gt;data);<br \/>\n} <\/p>\n<h2>3. GitHub<\/h2>\n<p>\u5b8c\u6574\u4ee3\u7801\u5df2\u7ecf\u4e0a\u4f20GitHub&#xff0c;\u6b22\u8fceStar<\/p>\n<p>https:\/\/github.com\/PeterYuanCoder\/ds-c-programs.git<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u6811\u7684\u6982\u5ff5<br \/>\n1.1 \u6811\u7684\u5b9a\u4e49<br \/>\n\u6811 (Tree) \u662f n (n \u2265 0) \u4e2a\u7ed3\u70b9\u7684\u6709\u9650\u96c6\u3002\u5f53 n  0 \u65f6&#xff0c;\u79f0\u4e3a\u7a7a\u6811\u3002\u5f53 n &gt; 0 \u65f6&#xff0c;\u79f0\u4e3a\u975e\u7a7a\u6811&#xff0c;\u4efb\u610f\u4e00\u68f5\u975e\u7a7a\u6811\u5e94\u8be5\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42&#xff1a;<br \/>\na. \u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u7279\u5b9a\u7684\u79f0\u4e3a\u6839\u7684\u7ed3\u70b9\u3002<br \/>\nb. \u5f53 n &gt; 1 \u65f6&#xff0c;\u5176\u4f59\u7ed3\u70b9\u53ef\u5206\u4e3a m (m&gt; 0) \u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u6709\u9650\u96c6 T1&#xff0c;T2&#xff0c;T3&#8230;&#8230;Tn&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u96c6\u5408\u672c\u8eab\u53c8\u662f<\/p>\n","protected":false},"author":2,"featured_media":120977,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1813,427],"topic":[],"class_list":["post-120991","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-1813","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/120991.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. \u6811\u7684\u6982\u5ff5 1.1 \u6811\u7684\u5b9a\u4e49 \u6811 (Tree) \u662f n (n \u2265 0) \u4e2a\u7ed3\u70b9\u7684\u6709\u9650\u96c6\u3002\u5f53 n 0 \u65f6&#xff0c;\u79f0\u4e3a\u7a7a\u6811\u3002\u5f53 n &gt; 0 \u65f6&#xff0c;\u79f0\u4e3a\u975e\u7a7a\u6811&#xff0c;\u4efb\u610f\u4e00\u68f5\u975e\u7a7a\u6811\u5e94\u8be5\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42&#xff1a; a. \u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u7279\u5b9a\u7684\u79f0\u4e3a\u6839\u7684\u7ed3\u70b9\u3002 b. \u5f53 n &gt; 1 \u65f6&#xff0c;\u5176\u4f59\u7ed3\u70b9\u53ef\u5206\u4e3a m (m&gt; 0) \u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u6709\u9650\u96c6 T1&#xff0c;T2&#xff0c;T3......Tn&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u96c6\u5408\u672c\u8eab\u53c8\u662f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/120991.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-01T14:25:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142538-6ae74be2355b9.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120991.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/120991.html\",\"name\":\"\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-01T14:25:53+00:00\",\"dateModified\":\"2026-11-01T14:25:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/120991.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/120991.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120991.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e00\u6587\u901a\u5173-----\u6811\u548c\u4e8c\u53c9\u6811\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/120991.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. \u6811\u7684\u6982\u5ff5 1.1 \u6811\u7684\u5b9a\u4e49 \u6811 (Tree) \u662f n (n \u2265 0) \u4e2a\u7ed3\u70b9\u7684\u6709\u9650\u96c6\u3002\u5f53 n 0 \u65f6&#xff0c;\u79f0\u4e3a\u7a7a\u6811\u3002\u5f53 n &gt; 0 \u65f6&#xff0c;\u79f0\u4e3a\u975e\u7a7a\u6811&#xff0c;\u4efb\u610f\u4e00\u68f5\u975e\u7a7a\u6811\u5e94\u8be5\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42&#xff1a; a. \u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u7279\u5b9a\u7684\u79f0\u4e3a\u6839\u7684\u7ed3\u70b9\u3002 b. \u5f53 n &gt; 1 \u65f6&#xff0c;\u5176\u4f59\u7ed3\u70b9\u53ef\u5206\u4e3a m (m&gt; 0) \u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u6709\u9650\u96c6 T1&#xff0c;T2&#xff0c;T3......Tn&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u96c6\u5408\u672c\u8eab\u53c8\u662f","og_url":"https:\/\/www.wsisp.com\/helps\/120991.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-01T14:25:53+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101142538-6ae74be2355b9.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/120991.html","url":"https:\/\/www.wsisp.com\/helps\/120991.html","name":"\u4e00\u6587\u901a\u5173-\u6811\u548c\u4e8c\u53c9\u6811 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-01T14:25:53+00:00","dateModified":"2026-11-01T14:25:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/120991.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/120991.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/120991.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e00\u6587\u901a\u5173-----\u6811\u548c\u4e8c\u53c9\u6811"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/120991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=120991"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/120991\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/120977"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=120991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=120991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=120991"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=120991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}