{"id":118084,"date":"2026-10-26T06:18:25","date_gmt":"2026-10-25T22:18:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/118084.html"},"modified":"2026-10-26T06:18:25","modified_gmt":"2026-10-25T22:18:25","slug":"%e3%80%90c%e3%80%91%e4%b8%80%e6%ac%a1%e6%8f%92%e5%85%a5%ef%bc%8c%e5%9b%9b%e5%9c%ba%e6%97%8b%e8%bd%ac%ef%bc%9ac-avl-%e6%a0%91%e7%9a%84%e8%87%aa%e5%b9%b3%e8%a1%a1%e4%b9%8b%e8%b7%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/118084.html","title":{"rendered":"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def"},"content":{"rendered":"<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"150\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade80292c154.png\" width=\"193\" \/><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&#x1f3c6;\u6d6e\u4e16\u5c18\u5f26&#xff1a;<span tabindex=\"-1\">\u4e2a\u4eba\u4e3b\u9875<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0\u2b50\u4e2a\u4eba\u4e13\u680f&#xff1a;<span tabindex=\"-1\">\u300aC\u8bed\u8a00\u300b<\/span>\u3001<span tabindex=\"-1\">\u300a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300b<\/span>\u3001<span tabindex=\"-1\">\u300aC&#043;&#043;\u300b<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#x1f48e;&#xff1a;\u975e\u6de1\u8584\u65e0\u4ee5\u660e\u5fd7&#xff0c;\u975e\u5b81\u9759\u65e0\u4ee5\u81f4\u8fdc<\/p>\n<hr \/>\n<h2 id=\"%E5%89%8D%E8%A8%80\" style=\"background-color:transparent\">\u524d\u8a00<\/h2>\n<p>\u666e\u901a\u4e8c\u53c9\u641c\u7d22\u6811\u5728\u6570\u636e\u63a5\u8fd1\u6709\u5e8f\u65f6\u5bb9\u6613\u9000\u5316\u6210\u94fe\u8868&#xff0c;\u67e5\u627e\u6548\u7387\u4f1a\u4ece O(log n) \u964d\u5230 O(n)\u3002\u800cAVL\u6811\u901a\u8fc7\u63a7\u5236\u6bcf\u4e2a\u8282\u70b9\u5de6\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u5dee&#xff0c;\u8ba9\u6811\u5728\u63d2\u5165\u540e\u59cb\u7ec8\u4fdd\u6301\u76f8\u5bf9\u5e73\u8861\u3002<\/p>\n<p>\u672c\u6587\u5148\u7528 C&#043;&#043; \u8ba4\u8bc6 AVL \u6811\u53ca\u5176\u8282\u70b9\u7ed3\u6784&#xff0c;\u518d<span style=\"color:#ff9900\">\u5b8c\u6574\u6a21\u62df\u4e00\u6b21\u63d2\u5165&#xff1a;\u5bfb\u627e\u4f4d\u7f6e\u3001\u63d2\u5165\u8282\u70b9\u3001\u66f4\u65b0\u5e73\u8861\u56e0\u5b50<\/span>\u3002\u968f\u540e\u4f9d\u6b21\u5206\u6790<span style=\"color:#956fe7\">\u53f3\u5355\u65cb\u3001\u5de6\u5355\u65cb\u3001\u5de6\u53f3\u53cc\u65cb\u548c\u53f3\u5de6\u53cc\u65cb\u56db\u79cd\u8c03\u6574\u65b9\u5f0f<\/span>&#xff0c;\u5e76\u5b9e\u73b0\u67e5\u627e\u64cd\u4f5c\u4e0e AVL \u6811\u5224\u5b9a\u3002<\/p>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u6cbf\u7740\u201c\u63d2\u5165\u3001\u5931\u8861\u3001\u65cb\u8f6c\u3001\u6062\u590d\u5e73\u8861\u201d\u7684\u8def\u5f84\u5c55\u5f00&#xff0c;\u4e0d\u6025\u4e8e\u5806\u780c\u4ee3\u7801&#xff0c;\u800c\u662f\u5f04\u6e05\u6bcf\u4e00\u6b65\u4e3a\u4f55\u53d1\u751f\u3001\u4e3a\u4ec0\u4e48\u9009\u62e9\u8fd9\u79cd\u8c03\u6574\u3002<\/p>\n<p>\u8ba9\u6211\u4eec\u5f00\u59cb\u4eca\u5929\u7684\u5b66\u4e60\u5427&#xff01;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"816\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade802946d18.jpg\" width=\"1080\" \/><\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E5%89%8D%E8%A8%80-toc\" style=\"margin-left:0px\">\u524d\u8a00<\/p>\n<p id=\"%E4%B8%80%EF%BC%8C%E4%BB%8B%E7%BB%8DAVL%E6%A0%91-toc\" style=\"margin-left:0px\">\u4e00&#xff0c;\u4ecb\u7ecdAVL\u6811<\/p>\n<p id=\"%E4%BA%8C%EF%BC%8C%E6%A8%A1%E6%8B%9F%E5%AE%9E%E7%8E%B0AVL%E6%A0%91-toc\" style=\"margin-left:0px\">\u4e8c&#xff0c;\u6a21\u62df\u5b9e\u73b0AVL\u6811<\/p>\n<p id=\"1%EF%BC%8CAVL%E6%A0%91%E8%8A%82%E7%82%B9-toc\" style=\"margin-left:40px\">1&#xff0c;AVL\u6811\u8282\u70b9<\/p>\n<p id=\"2%EF%BC%8CAVL%E6%A0%91%E7%9A%84%E6%8F%92%E5%85%A5-toc\" style=\"margin-left:40px\">2&#xff0c;AVL\u6811\u7684\u63d2\u5165<\/p>\n<p id=\"1%EF%BC%8C%E5%AF%BB%E6%89%BE%E6%8F%92%E5%85%A5%E4%BD%8D%E7%BD%AE%E5%B9%B6%E6%8F%92%E5%85%A5-toc\" style=\"margin-left:80px\">1&#xff0c;\u5bfb\u627e\u63d2\u5165\u4f4d\u7f6e\u5e76\u63d2\u5165<\/p>\n<p id=\"2%EF%BC%8C%E6%9B%B4%E6%96%B0%E5%B9%B3%E8%A1%A1%E5%9B%A0%E5%AD%90-toc\" style=\"margin-left:80px\">2&#xff0c;\u66f4\u65b0\u5e73\u8861\u56e0\u5b50<\/p>\n<p id=\"3%EF%BC%8C%E6%97%8B%E8%BD%AC-toc\" style=\"margin-left:40px\">3&#xff0c;\u65cb\u8f6c<\/p>\n<p id=\"1%EF%BC%8C%E5%8F%B3%E5%8D%95%E6%97%8B-toc\" style=\"margin-left:80px\">1&#xff0c;\u53f3\u5355\u65cb<\/p>\n<p id=\"2%EF%BC%8C%E5%B7%A6%E5%8D%95%E6%97%8B-toc\" style=\"margin-left:80px\">2&#xff0c;\u5de6\u5355\u65cb<\/p>\n<p id=\"3%EF%BC%8C%E5%B7%A6%E5%8F%B3%E5%8F%8C%E6%97%8B-toc\" style=\"margin-left:80px\">3&#xff0c;\u5de6\u53f3\u53cc\u65cb<\/p>\n<p id=\"4%EF%BC%8C%E5%8F%B3%E5%B7%A6%E5%8F%8C%E6%97%8B-toc\" style=\"margin-left:80px\">4&#xff0c;\u53f3\u5de6\u53cc\u65cb<\/p>\n<p id=\"4%EF%BC%8CAVL%E6%A0%91%E7%9A%84%E6%9F%A5%E6%89%BE-toc\" style=\"margin-left:40px\">4&#xff0c;AVL\u6811\u7684\u67e5\u627e<\/p>\n<p id=\"5%EF%BC%8C%E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E6%98%AFAVL%E6%A0%91-toc\" style=\"margin-left:40px\">5&#xff0c;\u5224\u65ad\u662f\u5426\u662fAVL\u6811<\/p>\n<p id=\"%C2%A0%E7%BB%93%E5%B0%BE-toc\" style=\"margin-left:0px\">\u00a0\u00a0\u00a0\u00a0\u7ed3\u5c3e<\/p>\n<hr id=\"hr-toc\" \/>\n<h2>\u4e00&#xff0c;\u4ecb\u7ecdAVL\u6811<\/h2>\n<p>AVL\u6811\u662f\u6700\u5148\u88ab\u53d1\u660e\u7684\u81ea\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811&#xff0c;AVL\u6811\u8981\u4e48\u662f\u4e00\u4e2a\u7a7a\u6811&#xff0c;\u8981\u4e48\u5177\u6709\u4ee5\u4e0b\u7279\u70b9&#xff1a;<\/p>\n<p><span style=\"color:#ff9900\">\u5de6\u53f3\u5b50\u6811\u90fd\u662fAVL\u6811&#xff0c;\u4e14\u6bcf\u4e2a\u8282\u70b9\u7684\u5de6\u53f3\u5b50\u6811\u9ad8\u5ea6\u5dee\u90fd\u4e0d\u8d85\u8fc71<\/span><\/p>\n<p>\u6838\u5fc3\u6982\u5ff5&#xff1a;\u5e73\u8861\u56e0\u5b50&#xff08;bf&#xff09;<\/p>\n<p>\u6bcf\u4e2a\u8282\u70b9\u90fd\u6709\u4e00\u4e2a\u5e73\u8861\u56e0\u5b50&#xff0c;\u7528\u6765\u8bb0\u5f55\u5de6\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u5dee\u3002<\/p>\n<p>\u9ad8\u5ea6\u5dee\u5408\u7406\u53d6\u503c&#xff1a;<span style=\"color:#4da8ee\">-1,0,1<\/span>\u00a0 <span style=\"color:#fe2c24\">\u00a0\u5982\u679c\u5e73\u8861\u56e0\u5b50\u7684\u503c\u4e3a2&#xff0c;-2&#xff0c;\u8868\u660e\u8fd9\u68f5\u6811\u4e0d\u5e73\u8861\u9700\u8981\u8fdb\u884c\u8c03\u6574&#xff08;\u65cb\u8f6c&#xff09;<\/span><\/p>\n<p>AVL\u6811\u7684\u7ed3\u6784\u548c\u5b8c\u5168\u4e8c\u53c9\u6811\u7c7b\u4f3c&#xff0c;\u9ad8\u5ea6\u5927\u7ea6\u5728logN,\u76f8\u8f83\u4e8e\u4e8c\u53c9\u641c\u7d22\u6811\u589e\u5220\u67e5\u6539\u5e73\u5747\u4e3aO(N),\u6700\u597dO(logN).<span style=\"color:#956fe7\">AVL\u589e\u5220\u67e5\u6539\u7684\u6548\u7387\u4e25\u683c\u4e3aO(logN)&#xff0c;\u6548\u7387\u8f83\u9ad8\u3002<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"441\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade802998289.png\" width=\"1023\" \/><\/p>\n<h2 id=\"%E4%BA%8C%EF%BC%8C%E6%A8%A1%E6%8B%9F%E5%AE%9E%E7%8E%B0AVL%E6%A0%91\">\u4e8c&#xff0c;\u6a21\u62df\u5b9e\u73b0AVL\u6811<\/h2>\n<h3 id=\"1%EF%BC%8CAVL%E6%A0%91%E8%8A%82%E7%82%B9\">1&#xff0c;AVL\u6811\u8282\u70b9<\/h3>\n<p>AVL\u6811\u7684\u8282\u70b9\u7531\u4e94\u90e8\u5206\u6784\u6210&#xff1a;1&#xff0c;\u5173\u952e\u5b57key&#xff0c;\u4e5f\u53ef\u4ee5\u4e3apair\u7c7b\u578b\u30022&#xff0c;\u6307\u5411\u5de6\u5b50\u6811\u7684\u6307\u9488&#xff1a;left<\/p>\n<p>3,\u6307\u5411\u53f3\u5b50\u6811\u7684\u6307\u9488&#xff1a;right 4&#xff0c;\u6307\u5411\u7236\u4eb2\u8282\u70b9\u7684\u6307\u9488 5&#xff0c;\u5e73\u8861\u56e0\u5b50bf<\/p>\n<p>template &lt;class K,class V&gt;<br \/>\n\/\/AVL\u6570\u8282\u70b9<br \/>\nstruct AVLTreeNode<br \/>\n{<br \/>\n\/\/struct\u9ed8\u8ba4\u4e3a\u516c\u6709<br \/>\npair&lt;K, V&gt; kv;<br \/>\nAVLTreeNode* left;<br \/>\nAVLTreeNode* right;<br \/>\nAVLTreeNode* parent;<br \/>\nint bf;\/\/\u5e73\u8861\u56e0\u5b50<br \/>\nAVLTreeNode(const pair&lt;K, V&gt;&amp; p)<br \/>\n:kv(p)<br \/>\n, left(nullptr)<br \/>\n, right(nullptr)<br \/>\n,parent(nullptr)<br \/>\n,bf(0)<br \/>\n{}<br \/>\n}; <\/p>\n<h3 id=\"2%EF%BC%8CAVL%E6%A0%91%E7%9A%84%E6%8F%92%E5%85%A5\" style=\"background-color:transparent\">2&#xff0c;AVL\u6811\u7684\u63d2\u5165<\/h3>\n<p><span style=\"color:#ff9900\">\u63d2\u5165\u6b65\u9aa4&#xff1a;<\/span><\/p>\n<h4 id=\"1%EF%BC%8C%E5%AF%BB%E6%89%BE%E6%8F%92%E5%85%A5%E4%BD%8D%E7%BD%AE%E5%B9%B6%E6%8F%92%E5%85%A5\">1&#xff0c;\u5bfb\u627e\u63d2\u5165\u4f4d\u7f6e\u5e76\u63d2\u5165<\/h4>\n<p>\u5bfb\u627e\u4f4d\u7f6e\u548c\u63d2\u5165\u7684\u89c4\u5219\u548c\u5e73\u8861\u4e8c\u53c9\u6811\u63d2\u5165\u503c\u7684\u8fc7\u7a0b\u4e00\u6837\u3002<\/p>\n<p><span style=\"color:#956fe7\">\u4ece\u6839\u8282\u70b9\u4f4d\u7f6e\u5f00\u59cb&#xff0c;\u6bd4\u8f83\u8282\u70b9\u503c\u7684\u5927\u5c0f\u3002\u8d70\u5411\u5de6\u5b50\u6811\u6216\u8005\u53f3\u5b50\u6811\u3002\u77e5\u9053\u627e\u5230\u63d2\u5165\u4f4d\u7f6e\u3002<\/span><\/p>\n<p><span style=\"color:#fe2c24\">\u6ce8\u610f:\u8981\u63d0\u524d\u8bbe\u8ba1\u4e00\u4e2a\u7236\u4eb2\u8282\u70b9&#xff0c;\u63d0\u524d\u8bb0\u5f55\u4f4d\u7f6e&#xff0c;\u65b9\u4fbf\u63d2\u5165\u3002<\/span><\/p>\n<p>template &lt;class K,class V&gt;<br \/>\nclass AVLTree<br \/>\n{<br \/>\ntypedef AVLTreeNode&lt;K, V&gt; Node;<br \/>\npublic:<br \/>\n\/\/\u63d2\u5165<br \/>\nbool Insert(pair&lt;K, V&gt; p1)<br \/>\n{<br \/>\n\/\/\u6839\u8282\u70b9\u4e3a\u7a7a<br \/>\nif (root &#061;&#061; nullptr)<br \/>\n{<br \/>\nroot &#061; new Node(p1);<br \/>\nreturn true;<br \/>\n}<br \/>\n\/\/\u6839\u8282\u70b9\u4e0d\u4e3a\u7a7a&#xff0c;\u627e\u5230\u8981\u63d2\u5165\u7684\u4f4d\u7f6e<br \/>\nNode* cur &#061; root;<br \/>\nNode* parent &#061; nullptr;<br \/>\nwhile (cur)<br \/>\n{<br \/>\nif (p1.first &gt; cur-&gt;kv.first)<br \/>\n{<br \/>\nparent &#061; cur;<br \/>\ncur &#061; cur-&gt;right;<br \/>\n}<br \/>\nelse if (p1.first &lt; cur-&gt;kv.first)<br \/>\n{<br \/>\nparent &#061; cur;<br \/>\ncur &#061; cur-&gt;left;<br \/>\n}<br \/>\nelse  \/\/\u4e0d\u80fd\u5b58\u5728\u76f8\u540c\u8282\u70b9<br \/>\n{<br \/>\nreturn false;<br \/>\n}<br \/>\n}<br \/>\n\/\/\u8fdb\u884c\u63d2\u5165<br \/>\ncur &#061; new Node(p1);<br \/>\nif (p1.first &gt; parent-&gt;kv.first)<br \/>\n{<br \/>\nparent-&gt;right &#061; cur;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nparent-&gt;left &#061; cur;<br \/>\n}<br \/>\ncur-&gt;parent &#061; parent; <\/p>\n<h4 id=\"2%EF%BC%8C%E6%9B%B4%E6%96%B0%E5%B9%B3%E8%A1%A1%E5%9B%A0%E5%AD%90\" style=\"background-color:transparent\">2&#xff0c;\u66f4\u65b0\u5e73\u8861\u56e0\u5b50 \u2b50<\/h4>\n<p><span style=\"color:#956fe7\">\u5e73\u8861\u56e0\u5b50\u7684\u66f4\u65b0\u89c4\u5219&#xff1a;<\/span><\/p>\n<p>\u5e73\u8861\u56e0\u5b50&#061; \u53f3\u5b50\u6811\u9ad8\u5ea6- \u5de6\u5b50\u6811\u9ad8\u5ea6<\/p>\n<p>\u53ea\u6709\u5b50\u6811\u9ad8\u5ea6\u53d8\u5316\u624d\u4f1a\u5f71\u54cd\u5f53\u524d\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u3002<\/p>\n<p>\u63d2\u5165\u8282\u70b9\u4f1a\u5f71\u54cd\u5f53\u524d\u8282\u70b9parent\u7684\u5e73\u8861\u56e0\u5b50&#xff0c;\u63d2\u5165\u5728\u53f3\u8fb9\u5f53\u524d\u5e73\u8861\u56e0\u5b50&#043;&#043;&#xff0c;\u63d2\u5165\u5728\u5de6\u8fb9\u5f53\u524d\u5e73\u8861\u56e0\u5b50&#8211;\u3002<\/p>\n<p>parent\u8282\u70b9\u4f4d\u7f6e\u7684\u5e73\u8861\u56e0\u5b50\u662f\u5426\u53d1\u751f\u53d8\u5316\u4f1a\u5f71\u54cd\u662f\u5426\u9700\u8981\u5411\u4e0a\u8fdb\u884c\u66f4\u65b0\u5e73\u8861\u56e0\u5b50\u3002<\/p>\n<p><span style=\"color:#956fe7\">\u66f4\u65b0\u5e73\u8861\u56e0\u5b50\u7684\u4e09\u79cd\u60c5\u51b5&#xff1a;<\/span><\/p>\n<p>1&#xff0c;<span style=\"background-color:#4da8ee\">\u66f4\u65b0\u540eparent\u7684\u5e73\u8861\u56e0\u5b50\u503c\u4e3a0&#xff0c;\u8bf4\u660e\u66f4\u65b0\u524dparent\u7684\u5e73\u8861\u56e0\u5b50\u662f-1\/1<\/span>\u3002<\/p>\n<p>\u8868\u660e\u63d2\u5165\u524d\u5b50\u6811\u4e00\u8fb9\u9ad8\u4e00\u8fb9\u4f4e&#xff0c;\u800c\u65b0\u63d2\u5165\u7684\u8282\u70b9\u4f4d\u4e8e\u8f83\u4f4e\u7684\u4e00\u4fa7\u3002\u6545\u8be5\u8282\u70b9\u5b50\u6811\u9ad8\u5ea6\u6ca1\u6709\u8fdb\u884c\u53d8\u5316&#xff0c;\u4e0d\u5f71\u54cd\u4e0a\u5c42\u7684\u5e73\u8861\u8282\u70b9\u3002\u6545\u4e0d\u9700\u8981\u5411\u4e0a\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n<\/p>\n<p>2&#xff0c;<span style=\"background-color:#4da8ee\">\u66f4\u65b0\u540eparent\u7684\u5e73\u8861\u56e0\u5b50\u503c\u4e3a-1\/1&#xff0c;\u8bf4\u660e\u66f4\u65b0\u524dparent\u7684\u5e73\u8861\u56e0\u5b50\u662f0<\/span>\u3002<\/p>\n<p>\u8868\u660e\u63d2\u5165\u524d\u5b50\u6811\u662f\u5e73\u8861\u7684&#xff0c;\u800c\u65b0\u63d2\u5165\u4e00\u4e2a\u8282\u70b9\u5bfc\u81f4\u5b50\u6811\u4e00\u8fb9\u9ad8\u4e00\u8fb9\u4f4e\u3002\u5b50\u6811\u7684\u9ad8\u5ea6\u53d8\u5316\u4e86&#xff0c;\u5f71\u54cd\u4e86\u4e0a\u5c42\u7684\u5e73\u8861\u56e0\u5b50&#xff0c;\u9700\u8981\u5411\u4e0a\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"612\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade8029c7d2b.png\" width=\"913\" \/><\/p>\n<p>3&#xff0c;\u66f4\u65b0\u540eparent\u7684\u5e73\u8861\u56e0\u5b50\u503c\u4e3a-2\/2&#xff0c;\u8bf4\u660e\u66f4\u65b0\u524dparent\u7684\u5e73\u8861\u56e0\u5b50\u662f-1\/1\u3002<\/p>\n<p>\u8868\u660e\u63d2\u5165\u524d\u5b50\u6811\u5c31\u662f\u4e00\u8fb9\u9ad8\u4e00\u8fb9\u4f4e&#xff0c;\u800c\u65b0\u63d2\u5165\u7684\u8282\u70b9\u5728\u8f83\u9ad8\u7684\u90a3\u4e00\u4fa7\u3002\u5bfc\u81f4\u9ad8\u7684\u66f4\u9ad8\u3002\u7834\u574f\u4e86AVL\u6811\u7684\u5e73\u8861\u3002\u9700\u8981\u8fdb\u884c\u65cb\u8f6c\u8c03\u6574\u3002\u65cb\u8f6c\u9700\u8981\u5b9e\u73b0\u4e24\u4e2a\u76ee\u6807&#xff1a;1&#xff0c;\u628aparent\u5b50\u6811\u65cb\u8f6c\u5e73\u8861\u30022&#xff0c;\u964d\u4f4eparent\u5b50\u6811\u7684\u9ad8\u5ea6&#xff0c;\u6062\u590d\u5230\u63d2\u5165\u8282\u70b9\u524d\u7684\u9ad8\u5ea6\u3002\u5b8c\u6210\u540e\u4e0d\u9700\u8981\u5411\u4e0a\u66f4\u65b0\u5e73\u8861\u56e0\u5b50&#xff0c;\u5e94\u4e3a\u5b50\u6811\u7684\u9ad8\u5ea6\u6ca1\u6709\u53d8\u5316\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"678\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221818-6ade802a081ba.png\" width=\"993\" \/><\/p>\n<p>4&#xff0c;\u6700\u574f\u9700\u8981\u66f4\u65b0\u5230\u6839\u8282\u70b9\u3002<\/p>\n<p>\u63d2\u5165\u4e2d\u66f4\u65b0\u5e73\u8861\u56e0\u5b50\u90e8\u5206&#xff1a;<\/p>\n<p>\/\/\u5904\u7406\u5e73\u8861\u56e0\u5b50<br \/>\nwhile (parent)<br \/>\n{<br \/>\nif (cur &#061;&#061; parent-&gt;left)<br \/>\n{<br \/>\nparent-&gt;bf&#8211;;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nparent-&gt;bf&#043;&#043;;<br \/>\n}<br \/>\nif (parent-&gt;bf &#061;&#061; 0)<br \/>\n{<br \/>\nreturn true;<br \/>\n}<br \/>\nelse if (parent-&gt;bf &#061;&#061; 1 || parent-&gt;bf &#061;&#061; -1)\/\/\u5411\u4e0a\u8ddf\u65b0<br \/>\n{<br \/>\ncur &#061; parent;<br \/>\nparent &#061; parent-&gt;parent;<br \/>\n}<br \/>\nelse if (parent-&gt;bf &#061;&#061; 2 || parent-&gt;bf &#061;&#061; -2)\/\/\u9700\u8981\u65cb\u8f6c<br \/>\n{<br \/>\n\/\/\u53f3\u65cb<br \/>\nif (cur-&gt;bf &#061;&#061; -1 &amp;&amp; parent-&gt;bf &#061;&#061; -2)<br \/>\n{<br \/>\nRotateR(parent);<br \/>\n}<br \/>\n\/\/\u5de6\u65cb<br \/>\nelse if (cur-&gt;bf &#061;&#061; 1 &amp;&amp; parent-&gt;bf &#061;&#061; 2)<br \/>\n{<br \/>\nRotateL(parent);<br \/>\n}<br \/>\n\/\/\u5de6\u53f3\u65cb<br \/>\nelse if (cur-&gt;bf &#061;&#061; 1 &amp;&amp; parent-&gt;bf &#061;&#061; -2)<br \/>\n{<br \/>\nRotateLR(parent);<br \/>\n}<br \/>\n\/\/\u53f3\u5de6\u65cb<br \/>\nelse if (cur-&gt;bf &#061;&#061; -1 &amp;&amp; parent-&gt;bf &#061;&#061; 2)<br \/>\n{<br \/>\nRotateRL(parent);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nassert(false);<br \/>\n}<br \/>\nbreak; \/\/\u65cb\u8f6c\u5b8c\u540e\u8df3\u51fa<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nassert(false);<br \/>\n}<br \/>\n}<br \/>\nreturn true;<br \/>\n} <\/p>\n<h3 id=\"3%EF%BC%8C%E6%97%8B%E8%BD%AC\" style=\"background-color:transparent\">3&#xff0c;\u65cb\u8f6c \u2b50<\/h3>\n<p>\u65cb\u8f6c\u7684\u76ee\u7684&#xff1a;<\/p>\n<p><span style=\"color:#fe2c24\">1&#xff0c;\u8ba9\u65cb\u8f6c\u7684\u6811\u7531\u4e0d\u5e73\u8861\u8f6c\u5411\u5e73\u8861&#xff0c;\u540c\u65f6\u964d\u4f4e\u65cb\u8f6c\u6811\u7684\u9ad8\u5ea6&#xff0c;\u4e0d\u5f71\u54cd\u4e0a\u5c42\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u3002<\/span><\/p>\n<h4 id=\"1%EF%BC%8C%E5%8F%B3%E5%8D%95%E6%97%8B\" style=\"background-color:transparent\">1&#xff0c;\u53f3\u5355\u65cb<\/h4>\n<p>\u53f3\u5355\u65cb\u62bd\u8c61\u56fe&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"633\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221818-6ade802a456da.png\" width=\"1689\" \/><\/p>\n<p>\u4e0a\u56fe\u4e2d\u768410\u53ef\u80fd\u662f\u6574\u68f5\u6811\u7684\u6839&#xff0c;\u4e5f\u53ef\u80fd\u662f\u4e00\u9897\u5c40\u90e8\u5b50\u6811\u7684\u6839\u3002a,b,c\u662f\u62bd\u8c61\u6210\u9ad8\u5ea6\u4e3ah&#xff08;h&gt;&#061;0&#xff09;\u7684\u5b50\u6811&#xff0c;\u62bd\u8c61\u7684\u597d\u5904\u5728\u4e8e&#xff1a;\u4e0d\u9700\u8981\u8003\u8651a\/b\/c\u5185\u90e8\u662f\u4ec0\u4e48\u7ed3\u6784\u3002<\/p>\n<p><span style=\"color:#ff9900\">\u65cb\u8f6c\u7684\u6b65\u9aa4&#xff1a;<\/span><\/p>\n<p>\u90a3\u8fb9\u9ad8\u5c31\u9700\u8981\u5c06\u6839\u8282\u70b9\u671d\u7740\u76f8\u53cd\u7684\u65b9\u5411\u6309\u4e0b\u53bb\u3002<\/p>\n<p><span style=\"color:#956fe7\">1&#xff0c;\u5c06parent\u63d2\u5165\u5230subL\u7684\u53f3\u5b50\u6811\u3002<\/span><\/p>\n<p><span style=\"color:#956fe7\">2&#xff0c;subLR\u4f5c\u4e3aparent\u7684\u53f3\u5b50\u6811<\/span><\/p>\n<p><span style=\"color:#956fe7\">3&#xff0c;\u5982\u679cparent\u4e4b\u524d\u53ea\u662f\u5c40\u90e8\u5b50\u6811\u7684\u6839\u8282\u70b9&#xff0c;\u9700\u8981\u66f4\u65b0\u66f4\u4e0a\u5c42\u8282\u70b9\u7684\u94fe\u63a5subL<\/span><\/p>\n<p>\u4e0b\u9762\u662fh\u4e0d\u540c\u503c\u7684\u5b9e\u9645\u56fe&#xff1a;<\/p>\n<p>\u5f53h&#061; 0\u65f6&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"562\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221818-6ade802aca344.png\" width=\"1620\" \/><\/p>\n<p>\u5f53h &#061; 1\u65f6&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"591\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221819-6ade802b6a363.png\" width=\"1689\" \/><\/p>\n<\/p>\n<p>\u5f53h &#061; 2\u65f6&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"705\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221820-6ade802c298a8.png\" width=\"1660\" \/><\/p>\n<p>\u65cb\u8f6c\u4ee3\u7801\u5b9e\u73b0&#xff1a;<\/p>\n<p>\/\/\u53f3\u65cb<br \/>\nvoid RotateR(Node* p)<br \/>\n{<br \/>\nNode* subL &#061; p-&gt;left;<br \/>\nNode* subLR &#061; subL-&gt;right;<\/p>\n<p>p-&gt;left &#061; subLR;<br \/>\nif (subLR !&#061; nullptr)\/\/\u53ef\u80fd\u4e3a\u7a7a\u5904\u7406\u4e00\u4e0b<br \/>\nsubLR-&gt;parent &#061; p;<br \/>\nsubL-&gt;right &#061; p;<br \/>\nif (p &#061;&#061; root)<br \/>\n{<br \/>\nroot &#061; subL;<br \/>\nsubL-&gt;parent &#061; nullptr;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nNode* pparent &#061; p-&gt;parent;<br \/>\n\/\/parent\u539f\u6765\u4e0d\u662f\u6839<br \/>\nif (pparent-&gt;left &#061;&#061; p)<br \/>\n{<br \/>\npparent-&gt;left &#061; subL;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\npparent-&gt;right &#061; subL;<br \/>\n}<br \/>\nsubL-&gt;parent &#061; pparent;<br \/>\n}<br \/>\np-&gt;parent &#061; subL;<br \/>\np-&gt;bf &#061; 0;<br \/>\nsubL-&gt;bf &#061; 0;<br \/>\n} <\/p>\n<h4 id=\"2%EF%BC%8C%E5%B7%A6%E5%8D%95%E6%97%8B\" style=\"background-color:transparent\">2&#xff0c;\u5de6\u5355\u65cb<\/h4>\n<p>\u5de6\u5355\u65cb\u5c31\u76f8\u5f53\u4e8e\u53f3\u65cb\u7684\u53cd\u9762&#xff0c;\u5341\u5206\u7c7b\u4f3c&#xff0c;\u4e0b\u9762\u7b80\u5355\u89e3\u91ca\u4e00\u4e0b&#xff1a;<\/p>\n<p>\u5de6\u5355\u65cb\u62bd\u8c61\u56fe&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"608\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221820-6ade802cca4bf.png\" width=\"1664\" \/><\/p>\n<p>\u65cb\u8f6c\u7684\u6b65\u9aa4&#xff1a;<\/p>\n<p>1&#xff0c;\u5c06parent\u90e8\u5206&#xff08;\u84dd\u8272&#xff09;\u63d2\u5165\u5230subR\u7684\u5de6\u5b50\u6811\u5904<\/p>\n<p>2&#xff0c;subRL\u63d2\u5165\u5230parent\u7684\u53f3\u5b50\u6811\u5904<\/p>\n<p>3&#xff0c;\u5982\u679cparent\u4e4b\u524d\u53ea\u662f\u5c40\u90e8\u5b50\u6811\u7684\u6839\u8282\u70b9&#xff0c;\u9700\u8981\u66f4\u65b0\u66f4\u4e0a\u5c42\u8282\u70b9\u7684\u94fe\u63a5subR<\/p>\n<p>\u4ee3\u7801\u5b9e\u73b0&#xff1a;<\/p>\n<p>\/\/\u5de6\u65cb<br \/>\nvoid RotateL(Node* p)<br \/>\n{<br \/>\nNode* subR &#061; p-&gt;right;<br \/>\nNode* subRL &#061; subR-&gt;left;<\/p>\n<p>p-&gt;right &#061; subRL;<br \/>\nif (subRL)<br \/>\nsubRL-&gt;parent &#061; p;<br \/>\nsubR-&gt;left &#061; p;<br \/>\nif (p &#061;&#061; root)<br \/>\n{<br \/>\nroot &#061; subR;<br \/>\nsubR-&gt;parent &#061; nullptr;<br \/>\n}<br \/>\nelse \/\/p\u4e0d\u662f\u6839\u8282\u70b9<br \/>\n{<br \/>\nNode* pparent &#061; p-&gt;parent;<br \/>\nif (pparent-&gt;left &#061;&#061; p)<br \/>\n{<br \/>\npparent-&gt;left &#061; subR;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\npparent-&gt;right &#061; subR;<br \/>\n}<br \/>\nsubR-&gt;parent &#061; pparent;<br \/>\n}<br \/>\np-&gt;parent &#061; subR;<br \/>\np-&gt;bf &#061; subR-&gt;bf &#061; 0;<br \/>\n} <\/p>\n<h4 id=\"3%EF%BC%8C%E5%B7%A6%E5%8F%B3%E5%8F%8C%E6%97%8B\" style=\"background-color:transparent\">3&#xff0c;\u5de6\u53f3\u53cc\u65cb<\/h4>\n<p>\u5148\u770b\u8fd9\u6837\u4e24\u7ec4\u6848\u4f8b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"492\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221821-6ade802d52c6d.png\" width=\"1401\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"534\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221821-6ade802d91e54.png\" width=\"1270\" \/><\/p>\n<p>\u5de6\u8fb9\u9ad8&#xff0c;\u4f46\u662f\u65b0\u63d2\u5165\u7684\u8282\u70b9\u5728b\u4f4d\u7f6e&#xff0c;\u4ec5\u4ec5\u8fdb\u884c\u53f3\u5355\u65cb\u662f\u4e0d\u884c\u7684&#xff0c;\u65cb\u8f6c\u540e\u7684\u8fd8\u662f\u4e0d\u5e73\u8861\u3002<\/p>\n<p>\u6b64\u65f6\u5c06\u4e0a\u9762\u7684\u573a\u666f\u62bd\u8c61\u6210\u4e0b\u9762\u7684\u7ed3\u6784\u56fe&#xff1a;<\/p>\n<p>\u6839\u636e\u63d2\u5165\u7684\u4f4d\u7f6e\u53ef\u4ee5\u5206\u6210\u4e09\u79cd\u60c5\u666f&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"2000\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221821-6ade802dd8e92.png\" width=\"1553\" \/><\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u63d2\u5165\u8282\u70b9\u540e&#xff0c;<span style=\"color:#956fe7\">parent\u548csubL&#xff0c;subLR\u7684\u5e73\u8861\u56e0\u5b50\u662f\u5f02\u53f7\u7684<\/span>\u3002\u8fd9\u662f\u548c\u53ea\u5355\u72ec\u65cb\u8f6c\u7684\u4e00\u4e2a\u8f83\u5927\u7684\u533a\u522b\u3002<\/p>\n<p>\u63d2\u5165\u540e\u9700\u8981<span style=\"color:#1a439c\">\u5148\u5bf9subL\u8fdb\u884c\u5de6\u5355\u65cb&#xff0c;\u7136\u540e\u5bf9\u6574\u4f53parent\u8fdb\u884c\u53f3\u5355\u65cb<\/span>\u3002\u5c31\u53ef\u4ee5\u8fbe\u6210\u5e73\u8861\u3002<\/p>\n<p>\u5de6\u53f3\u53cc\u65cb\u4ee3\u7801:<\/p>\n<p>\/\/\u53cc\u65cb-\u5148\u5de6\u540e\u53f3<br \/>\nvoid RotateLR(Node* p)<br \/>\n{<br \/>\nNode* subL &#061; p-&gt;left;<br \/>\nNode* subLR &#061; subL-&gt;right;<br \/>\nint _bf &#061; subLR-&gt;bf;<br \/>\nRotateL(subL);<br \/>\nRotateR(p);<br \/>\nif (_bf &#061;&#061; -1)<br \/>\n{<br \/>\nsubL-&gt;bf &#061; 0;<br \/>\nsubLR-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; 1;<br \/>\n}<br \/>\nelse if (_bf &#061;&#061; 1)<br \/>\n{<br \/>\nsubL-&gt;bf &#061; -1;<br \/>\nsubLR-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; 0;<br \/>\n}<br \/>\nelse if (_bf &#061;&#061; 0)<br \/>\n{<br \/>\nsubL-&gt;bf &#061; 0;<br \/>\nsubLR-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; 0;<br \/>\n}<br \/>\nelse\/\/\u9632\u5fa1\u6027\u7f16\u7a0b&#xff0c;\u53ef\u4ee5\u4e0d\u5199<br \/>\n{<br \/>\nassert(false);<br \/>\n}<br \/>\n} <\/p>\n<h4 id=\"4%EF%BC%8C%E5%8F%B3%E5%B7%A6%E5%8F%8C%E6%97%8B\" style=\"background-color:transparent\">4&#xff0c;\u53f3\u5de6\u53cc\u65cb<\/h4>\n<p>\u53f3\u5de6\u53cc\u65cb\u7684\u60c5\u51b5\u548c\u5de6\u53f3\u53cc\u65cb\u7684\u60c5\u51b5\u7c7b\u4f3c&#xff0c;\u4e0b\u9762\u7b80\u5355\u89e3\u91ca\u4e00\u4e0b<\/p>\n<p>\u76f4\u63a5\u770b\u62bd\u8c61\u7ed3\u6784\u56fe&#xff1a;<\/p>\n<p>\u6839\u636e\u63d2\u5165\u7684\u4e0d\u540c\u4f4d\u7f6e\u53ef\u4ee5\u5206\u6210\u4e09\u79cd\u573a\u666f&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1603\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221822-6ade802eec44f.png\" width=\"1377\" \/><\/p>\n<p>parent\u548csubR\u4ee5\u53casubRL\u7684\u5e73\u8861\u56e0\u5b50\u4f9d\u65e7\u662f\u5f02\u53f7\u7684\u3002<\/p>\n<p>\u63d2\u5165\u540e<span style=\"color:#1a439c\">\u5148\u5bf9subR\u8fdb\u884c\u53f3\u5355\u65cb&#xff0c;\u518d\u5bf9parent\u8fdb\u884c\u5de6\u5355\u65cb<\/span>&#xff0c;\u5c31\u53ef\u4ee5\u8fbe\u5230\u5e73\u8861\u3002<\/p>\n<p>\u53f3\u5de6\u53cc\u65cb\u4ee3\u7801&#xff1a;<\/p>\n<p>\/\/\u53cc\u65cb-\u5148\u53f3\u540e\u5de6<br \/>\nvoid RotateRL(Node* p)<br \/>\n{<br \/>\nNode* subR &#061; p-&gt;right;<br \/>\nNode* subRL &#061; subR-&gt;left;<br \/>\nint _bf &#061; subRL-&gt;bf;<br \/>\nRotateR(subR);<br \/>\nRotateL(p);<br \/>\nif (_bf &#061;&#061; -1)<br \/>\n{<br \/>\nsubR-&gt;bf &#061; 1;<br \/>\nsubRL-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; 0;<br \/>\n}<br \/>\nelse if (_bf &#061;&#061; 1)<br \/>\n{<br \/>\nsubR-&gt;bf &#061; 0;<br \/>\nsubRL-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; -1;<br \/>\n}<br \/>\nelse if (_bf &#061;&#061; 0)<br \/>\n{<br \/>\nsubR-&gt;bf &#061; 0;<br \/>\nsubRL-&gt;bf &#061; 0;<br \/>\np-&gt;bf &#061; 0;<br \/>\n}<br \/>\nelse\/\/\u9632\u5fa1\u6027\u7f16\u7a0b<br \/>\n{<br \/>\nassert(false);<br \/>\n}<br \/>\n} <\/p>\n<h3 id=\"4%EF%BC%8CAVL%E6%A0%91%E7%9A%84%E6%9F%A5%E6%89%BE\">4&#xff0c;AVL\u6811\u7684\u67e5\u627e<\/h3>\n<p>\u76f4\u63a5\u4ece\u6839\u8282\u70b9\u6839\u636eAVL\u6811\u7684\u89c4\u5219\u5411\u4e0b\u8fdb\u884c\u67e5\u627e\u3002<\/p>\n<p>AVL\u6811\u67e5\u627e\u4ee3\u7801&#xff1a;<\/p>\n<p>\/\/\u67e5\u627e<br \/>\nNode* Find(const K&amp; k)<br \/>\n{<br \/>\nNode* cur &#061; root;<br \/>\nwhile (cur)<br \/>\n{<br \/>\nif (k &gt; cur-&gt;kv.first)<br \/>\n{<br \/>\ncur &#061; cur-&gt;right;<br \/>\n}<br \/>\nelse if (k &lt; cur-&gt;kv.first)<br \/>\n{<br \/>\ncur &#061; cur-&gt;left;<br \/>\n}<br \/>\nelse \/\/\u627e\u5230\u4e86<br \/>\n{<br \/>\nreturn cur;<br \/>\n}<br \/>\n}<br \/>\nreturn nullptr;<br \/>\n} <\/p>\n<h3 id=\"5%EF%BC%8C%E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E6%98%AFAVL%E6%A0%91\" style=\"background-color:transparent\">5&#xff0c;\u5224\u65ad\u662f\u5426\u662fAVL\u6811<\/h3>\n<p>1&#xff0c;\u5de6\u53f3\u9ad8\u5ea6\u5dee\u4e0d\u8d85\u8fc71&#xff0c;\u540c\u65f6\u5de6\u53f3\u90fd\u662fAVL\u6811<\/p>\n<p>\/\/\u5224\u65ad\u662f\u5426\u662f\u4e00\u9897AVL\u6811<br \/>\nbool _IsAVLTree(Node* root)<br \/>\n{<br \/>\n\/\/\u7a7a\u6811\u4e5f\u662f\u4e00\u4e2aAVL\u6811<br \/>\nif (root &#061;&#061; nullptr)<br \/>\nreturn true;<br \/>\nint leftHeight &#061; _Height(root-&gt;left);<br \/>\nint rightHeight &#061; _Height(root-&gt;right);<br \/>\nint d &#061; rightHeight &#8211; leftHeight;<br \/>\nif (abs(d) &gt;&#061; 2)<br \/>\n{<br \/>\ncout &lt;&lt; &#034;\u9ad8\u5ea6\u5dee\u5f02\u5e38&#034; &lt;&lt; endl;<br \/>\nreturn false;<br \/>\n}<br \/>\nif (d !&#061; root-&gt;bf)\/\/\u5e73\u8861\u56e0\u5b50\u548c\u9ad8\u5ea6\u5dee\u5bf9\u4e0d\u4e0a<br \/>\n{<br \/>\ncout &lt;&lt; &#034;\u5e73\u8861\u56e0\u5b50\u5f02\u5e38&#034; &lt;&lt; endl;<br \/>\nreturn false;<br \/>\n}<br \/>\n\/\/\u4fdd\u8bc1\u5de6\u53f3\u5b50\u6811\u90fd\u662fAVL\u6811<br \/>\nreturn _IsAVLTree(root-&gt;left) &amp;&amp; _IsAVLTree(root-&gt;right);<br \/>\n} <\/p>\n<p>\u6d4b\u8bd5\u7ed3\u6784\u6392\u5e8f\u4ee3\u7801&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"513\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221824-6ade80300ee0f.png\" width=\"1012\" \/><\/p>\n<p>\u6d4b\u8bd5\u6027\u80fd&#xff1a;<\/p>\n<p>\/\/ \u63d2\u5165\u4e00\u5806\u968f\u673a\u503c&#xff0c;\u6d4b\u8bd5\u5e73\u8861&#xff0c;\u987a\u4fbf\u6d4b\u8bd5\u4e00\u4e0b\u9ad8\u5ea6\u548c\u6027\u80fd\u7b49<br \/>\nvoid TestAVLTree2()<br \/>\n{<br \/>\nconst int N &#061; 1000000;<br \/>\nvector&lt;int&gt; v;<br \/>\nv.reserve(N);<br \/>\nsrand(time(0));<br \/>\nfor (size_t i &#061; 0; i &lt; N; i&#043;&#043;)<br \/>\n{<br \/>\nv.push_back(rand() &#043; i);<br \/>\n}<br \/>\n\/\/\u63d2\u5165<br \/>\nsize_t begin2 &#061; clock();<br \/>\nAVLTree&lt;int, int&gt; t;<br \/>\nfor (auto e : v)<br \/>\n{<br \/>\nt.Insert(make_pair(e, e));<br \/>\n}<br \/>\nsize_t end2 &#061; clock();<\/p>\n<p>cout &lt;&lt; &#034;Insert:&#034; &lt;&lt; end2 &#8211; begin2 &lt;&lt; endl;<br \/>\ncout &lt;&lt; t.IsAVLTree() &lt;&lt; endl;<\/p>\n<p>cout &lt;&lt; &#034;Height:&#034; &lt;&lt; t.Height() &lt;&lt; endl;<br \/>\ncout &lt;&lt; &#034;Size:&#034; &lt;&lt; t.Size() &lt;&lt; endl;<\/p>\n<p>size_t begin1 &#061; clock();<br \/>\n\/\/ \u786e\u5b9a\u5728\u7684\u503c<br \/>\nfor (auto e : v)<br \/>\n{<br \/>\nt.Find(e);<br \/>\n}<br \/>\nsize_t end1 &#061; clock();<br \/>\ncout &lt;&lt; &#034;Find:&#034; &lt;&lt; end1 &#8211; begin1 &lt;&lt; endl;<br \/>\n}<br \/>\nint main()<br \/>\n{<br \/>\nTestAVLTree2();<br \/>\nreturn 0;<br \/>\n} <\/p>\n<p>\u6d4b\u8bd5\u7ed3\u679c&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"346\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221824-6ade803038c3e.png\" width=\"726\" \/><\/p>\n<hr \/>\n<h2 id=\"%C2%A0%E7%BB%93%E5%B0%BE\" style=\"background-color:transparent\">\u00a0\u00a0\u00a0\u00a0\u7ed3\u5c3e<\/h2>\n<p>\u672c\u7bc7\u6587\u7ae0\u4e2d\u6240\u6d89\u53ca\u5230\u7684\u4ee3\u7801&#xff1a;<\/p>\n<p>gitee\u94fe\u63a5&#xff1a;AVL\u6811\u7684\u5b9e\u73b0<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86&#xff0c;\u5982\u679c\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u7684\u8bdd&#xff0c;\u8bf7\u5927\u4f6c\u4e0d\u59a8\u7ed9\u535a\u4e3b\u6765\u4e2a\u201c<span style=\"color:#fe2c24\">\u4e00\u952e\u4e09\u8fde<\/span>\u201d&#xff0c;\u8fd9\u5bf9\u6211\u662f\u5927\u5927\u7684\u652f\u6301&#xff0c;\u4e5f\u80fd\u8ba9\u535a\u4e3b\u4ea7\u51fa\u66f4\u4f18\u8d28\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u5f80\u671f\u56de\u987e&#xff1a;<\/p>\n<p> <span tabindex=\"-1\">\u3010C&#043;&#043;\u3011\u300a\u624b\u6495\u4e8c\u53c9\u641c\u7d22\u6811&#xff1a;\u5220\u9664\u624d\u662f\u771f\u6b63\u7684\u5206\u6c34\u5cad\u300b<\/span><\/p>\n<p> \u3010C&#043;&#043;\u3011map \u4e0e set \u7684\u5173\u8054\u5f0f\u5bb9\u5668\u5b9e\u8df5<\/p>\n<p>\u603b\u7ed3&#xff1a;\u672c\u6587\u7cfb\u7edf\u8bb2\u89e3\u4e86AVL\u6811\u7684\u539f\u7406\u4e0e\u6a21\u62df\u5b9e\u73b0&#xff0c;\u6db5\u76d6\u8282\u70b9\u7ed3\u6784\u3001\u63d2\u5165\u64cd\u4f5c\u3001\u5e73\u8861\u56e0\u5b50\u66f4\u65b0\u53ca\u56db\u79cd\u65cb\u8f6c\u673a\u5236&#xff08;\u53f3\u5355\u65cb\u3001\u5de6\u5355\u65cb\u3001\u5de6\u53f3\u53cc\u65cb\u3001\u53f3\u5de6\u53cc\u65cb&#xff09;&#xff0c;\u786e\u4fdd\u6811\u59cb\u7ec8\u4fdd\u6301\u5e73\u8861\u3002\u901a\u8fc7\u63d2\u5165\u540e\u81ea\u4e0a\u800c\u4e0b\u7684\u5e73\u8861\u56e0\u5b50\u8c03\u6574\u4e0e\u65cb\u8f6c&#xff0c;\u4fdd\u969c\u589e\u5220\u67e5\u6548\u7387\u7a33\u5b9a\u5728O(logN)\u3002\u6587\u7ae0\u8fd8\u5b9e\u73b0\u4e86\u67e5\u627e\u3001\u5224\u65ad\u662f\u5426\u4e3aAVL\u6811\u7b49\u529f\u80fd&#xff0c;\u5e76\u901a\u8fc7\u6027\u80fd\u6d4b\u8bd5\u9a8c\u8bc1\u5176\u9ad8\u6548\u6027&#xff0c;\u9002\u5408\u6df1\u5165\u7406\u89e3\u81ea\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5b9e\u73b0\u903b\u8f91\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u26a1\u628a\u4e0a\u9762\u7684\u5185\u5bb9\u5403\u900f\u5c31\u4f11\u606f\u4e00\u4e0b\u5427\u26a1<\/p>\n<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"702\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221824-6ade80304f19d.png\" width=\"741\" \/><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f3c6;\u6d6e\u4e16\u5c18\u5f26&#xff1a;\u4e2a\u4eba\u4e3b\u9875 \u2b50\u4e2a\u4eba\u4e13\u680f&#xff1a;\u300aC\u8bed\u8a00\u300b\u3001\u300a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300b\u3001\u300aC\u300b &#x1f48e;&#xff1a;\u975e\u6de1\u8584\u65e0\u4ee5\u660e\u5fd7&#xff0c;\u975e\u5b81\u9759\u65e0\u4ee5\u81f4\u8fdc \u524d\u8a00 \u666e\u901a\u4e8c\u53c9\u641c\u7d22\u6811\u5728\u6570\u636e\u63a5\u8fd1\u6709\u5e8f\u65f6\u5bb9\u6613\u9000\u5316\u6210\u94fe\u8868&#xff0c;\u67e5\u627e\u6548\u7387\u4f1a\u4ece O(log n) \u964d\u5230 O(n)\u3002\u800cAVL\u6811\u901a\u8fc7\u63a7\u5236\u6bcf\u4e2a\u8282\u70b9\u5de6\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u5dee&#xff0c;\u8ba9\u6811\u5728\u63d2\u5165\u540e\u59cb\u7ec8\u4fdd\u6301\u76f8\u5bf9\u5e73\u8861\u3002 \u672c\u6587\u5148\u7528 C \u8ba4\u8bc6 AVL \u6811\u53ca\u5176\u8282\u70b9\u7ed3\u6784&#xff0c;\u518d\u5b8c\u6574\u6a21\u62df\u4e00\u6b21\u63d2\u5165&amp;<\/p>\n","protected":false},"author":2,"featured_media":118067,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[427],"topic":[],"class_list":["post-118084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \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\/118084.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f3c6;\u6d6e\u4e16\u5c18\u5f26&#xff1a;\u4e2a\u4eba\u4e3b\u9875 \u2b50\u4e2a\u4eba\u4e13\u680f&#xff1a;\u300aC\u8bed\u8a00\u300b\u3001\u300a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300b\u3001\u300aC\u300b &#x1f48e;&#xff1a;\u975e\u6de1\u8584\u65e0\u4ee5\u660e\u5fd7&#xff0c;\u975e\u5b81\u9759\u65e0\u4ee5\u81f4\u8fdc \u524d\u8a00 \u666e\u901a\u4e8c\u53c9\u641c\u7d22\u6811\u5728\u6570\u636e\u63a5\u8fd1\u6709\u5e8f\u65f6\u5bb9\u6613\u9000\u5316\u6210\u94fe\u8868&#xff0c;\u67e5\u627e\u6548\u7387\u4f1a\u4ece O(log n) \u964d\u5230 O(n)\u3002\u800cAVL\u6811\u901a\u8fc7\u63a7\u5236\u6bcf\u4e2a\u8282\u70b9\u5de6\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u5dee&#xff0c;\u8ba9\u6811\u5728\u63d2\u5165\u540e\u59cb\u7ec8\u4fdd\u6301\u76f8\u5bf9\u5e73\u8861\u3002 \u672c\u6587\u5148\u7528 C \u8ba4\u8bc6 AVL \u6811\u53ca\u5176\u8282\u70b9\u7ed3\u6784&#xff0c;\u518d\u5b8c\u6574\u6a21\u62df\u4e00\u6b21\u63d2\u5165&amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/118084.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-25T22:18:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade80292c154.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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/118084.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/118084.html\",\"name\":\"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-25T22:18:25+00:00\",\"dateModified\":\"2026-10-25T22:18:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/118084.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/118084.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/118084.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def\"}]},{\"@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":"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \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\/118084.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f3c6;\u6d6e\u4e16\u5c18\u5f26&#xff1a;\u4e2a\u4eba\u4e3b\u9875 \u2b50\u4e2a\u4eba\u4e13\u680f&#xff1a;\u300aC\u8bed\u8a00\u300b\u3001\u300a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300b\u3001\u300aC\u300b &#x1f48e;&#xff1a;\u975e\u6de1\u8584\u65e0\u4ee5\u660e\u5fd7&#xff0c;\u975e\u5b81\u9759\u65e0\u4ee5\u81f4\u8fdc \u524d\u8a00 \u666e\u901a\u4e8c\u53c9\u641c\u7d22\u6811\u5728\u6570\u636e\u63a5\u8fd1\u6709\u5e8f\u65f6\u5bb9\u6613\u9000\u5316\u6210\u94fe\u8868&#xff0c;\u67e5\u627e\u6548\u7387\u4f1a\u4ece O(log n) \u964d\u5230 O(n)\u3002\u800cAVL\u6811\u901a\u8fc7\u63a7\u5236\u6bcf\u4e2a\u8282\u70b9\u5de6\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u5dee&#xff0c;\u8ba9\u6811\u5728\u63d2\u5165\u540e\u59cb\u7ec8\u4fdd\u6301\u76f8\u5bf9\u5e73\u8861\u3002 \u672c\u6587\u5148\u7528 C \u8ba4\u8bc6 AVL \u6811\u53ca\u5176\u8282\u70b9\u7ed3\u6784&#xff0c;\u518d\u5b8c\u6574\u6a21\u62df\u4e00\u6b21\u63d2\u5165&amp;","og_url":"https:\/\/www.wsisp.com\/helps\/118084.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-25T22:18:25+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261025221817-6ade80292c154.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/118084.html","url":"https:\/\/www.wsisp.com\/helps\/118084.html","name":"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-25T22:18:25+00:00","dateModified":"2026-10-25T22:18:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/118084.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/118084.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/118084.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010C++\u3011\u4e00\u6b21\u63d2\u5165\uff0c\u56db\u573a\u65cb\u8f6c\uff1aC++ AVL \u6811\u7684\u81ea\u5e73\u8861\u4e4b\u8def"}]},{"@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\/118084","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=118084"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/118084\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/118067"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=118084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=118084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=118084"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=118084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}