{"id":124,"date":"2019-03-12T20:56:24","date_gmt":"2019-03-12T12:56:24","guid":{"rendered":"http:\/\/fankasy.xyz\/?p=124"},"modified":"2019-04-16T23:10:39","modified_gmt":"2019-04-16T15:10:39","slug":"%e5%ad%a6%e4%b9%a0%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%845-%e4%ba%8c%e5%8f%89%e6%a0%91%e9%81%8d%e5%8e%86","status":"publish","type":"post","link":"http:\/\/fankasy.xyz\/index.php\/2019\/03\/12\/%e5%ad%a6%e4%b9%a0%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%845-%e4%ba%8c%e5%8f%89%e6%a0%91%e9%81%8d%e5%8e%86\/","title":{"rendered":"\u5b66\u4e60\u6570\u636e\u7ed3\u67845-\u4e8c\u53c9\u6811\u904d\u5386"},"content":{"rendered":"<p>\u9996\u5148\u5927\u5bb6\u90fd\u77e5\u9053\u904d\u5386\u4e8c\u53c9\u6811\u662f\u5f88\u7b80\u5355\u7684\uff0c\u7528\u9012\u5f52\u7b97\u6cd5\u7684\u8bdd\u4ee3\u7801\u7b80\u6d01\u6613\u61c2<\/p>\n<pre>void ecsbl( TNode* t )\r\n{\r\n  if( !t ) retuen ;\r\n  \u64cd\u4f5c\u64cd\u4f5c\u64cd\u4f5c\u64cd\u4f5c;\r\n  ecsbl( t-&gt;lchild );\r\n  ecsbl( t-&gt;rchild );\r\n}<\/pre>\n<p>\u8fd9\u662f\u524d\u5e8f\u904d\u5386\uff0c\u628a\u64cd\u4f5c\u653e\u5230\u4e2d\u95f4\u6216\u4e0b\u9762\u5c31\u662f\u4e2d\u5e8f\u6216\u8005\u540e\u5e8f\u904d\u5386\uff0c\u5404\u79cd\u904d\u5386\u7684\u8f93\u51fa\u987a\u5e8f\u4e0d\u4e00\u6837\u3002<\/p>\n<p>\u4f46\u5982\u679c\u4e0d\u7528\u9012\u5f52\uff0c\u60f3\u8981\u904d\u5386\u6574\u4e00\u68f5\u4e8c\u53c9\u6811\u5c31\u8981\u7528\u5230\u989d\u5916\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<h2><span style=\"color: #008000;\"><strong>\u6df1\u5ea6\u4f18\u5148\u904d\u5386\uff1f<\/strong><\/span><\/h2>\n<p>\u60f3\u8981\u5b9e\u73b0\u6df1\u5ea6\u4f18\u5148\u904d\u5386\uff0c\u5c31\u8981\u505a\u5230\u4e00\u6839\u6761\u5b50\u6811\u5230\u5934\u4e4b\u524d\u90fd\u4e0d\u6362\u65b9\u5411\uff0c\u4e5f\u5c31\u662f\u6bcf\u6b21\u90fd\u662f\u5148\u8f93\u51fa\u5de6(\u53f3)\u5b50\u6811\u7684\u6570\u636e\uff0c\u518d\u5411\u53f3(\u5de6)\u79fb\u52a8\u4e00\u4f4d\u91cd\u590d\u8f93\u51fa\u3002\u60f3\u8981\u8fbe\u6210\u9700\u8981\u7528\u5230\u6808\u7ed3\u6784\u3002<\/p>\n<pre>void depth( TNode* t )\r\n{\r\n TNode* temp;\r\n stackin( S, t );\u00a0 <span style=\"color: #339966;\"> \/\/\u8fd9\u91cc\u5df2\u5b9a\u4e49\u6808stack<\/span>\r\n while( ! Isempty(S) )\r\n {\r\n  stackpop(S, temp);\r\n  if(temp-&gt;rchild != NULL)\r\n    stackin(S, temp-&gt;rchild);\r\n  if(temp-&gt;lchild != NULL)\r\n    stackin(S, temp-&gt;lchild);\r\n<span style=\"color: #339966;\">    \/\/\u5bf9temp-&gt;data\u64cd\u4f5c\u64cd\u4f5c\u64cd\u4f5c<\/span>\r\n  }\r\n}<\/pre>\n<p>\u6bcf\u6b21\u51fa\u6808\u90fd\u4f34\u968f\u7740\u5176\u4e24\u68f5\u5b50\u6811\u7684\u5165\u6808\uff0c\u5faa\u73af\u5373\u53ef\u8fbe\u6210\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u3002\u800c\u5728\u5faa\u73af\u4e2dtemp\u6c38\u8fdc\u4e3a\u521a\u521a\u51fa\u6808\u7684\u53f6\u5b50\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><strong><span style=\"color: #008000;\">\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\uff1f<\/span><\/strong><\/h2>\n<pre>\u6df1\u5ea6\u4f18\u5148\u9700\u8981\u5148\u8fdb\u540e\u51fa\u7684\u7ed3\u6784\uff0c\u81ea\u7136\u5e7f\u5ea6\u4f18\u5148\u9700\u8981\u5148\u8fdb\u5148\u51fa\u3002\u8fd9\u6837\u6bcf\u6b21\u5b58\u8fdb\u53bb\u7684\u5b50\u6811\u53ef\u4ee5\u9a6c\u4e0a\u88ab\u91ca\u653e\u8bfb\u53d6\uff0c\u518d\u8bfb\u53d6\u56e0\u91ca\u653e\u800c\u88ab\u8f7d\u5165\u7684\u4e0b\u4e00\u5c42\u3002\r\n\u5f88\u663e\u7136\uff0c\u6211\u6307\u7684\u662f\u961f\u5217\u3002\r\n\r\nvoid breadth(TNode* t)\r\n{\r\n  TNode* temp;\r\n  queuein(Q, t);\r\n  while( !isEmpty(Q) )\r\n  {\r\n  queuepop(Q, temp);\r\n    if(temp-&gt;lchild != NULL)\r\n  queuein(Q, temp-&gt;lchild);\r\n    if(temp-&gt;rchild != NULL)\r\n  queuein(Q, temp-&gt;rchild);\r\n<span style=\"color: #339966;\">   \/\/\u5bf9temp-&gt;data\u7684\u64cd\u4f5c\u64cd\u4f5c\u64cd\u4f5c<\/span>\r\n  }\r\n}\r\n\r\n\r\n<\/pre>\n<p>\u6709\u4e9b\u7c7b\u4f3c\u7684\u4ee3\u7801\u91cc\u662f\u5229\u7528\u51fd\u6570\u8fd4\u56de\u5199\u5165\u6570\u636e\u7684\u6570\u7ec4\uff0c\u4f46\u9274\u4e8e\u672c\u4e66\u4f5c\u8005\u6076\u52a3\u7684\u4ee3\u7801\u98ce\u683c\u8fd8\u6709\u53d8\u91cf\u540d\u5b9e\u5728\u4ee4\u4eba\u53cd\u80c3\uff0c\u8fd9\u91cc\u5c31\u76f4\u63a5\u8bfb\u53d6\u5373\u64cd\u4f5c\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u5927\u5bb6\u90fd\u77e5\u9053\u904d\u5386\u4e8c\u53c9\u6811\u662f\u5f88\u7b80\u5355\u7684\uff0c\u7528\u9012\u5f52\u7b97\u6cd5\u7684\u8bdd\u4ee3\u7801\u7b80\u6d01\u6613\u61c2 void ecsbl( TNode* t )  [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,10],"tags":[],"_links":{"self":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/124"}],"collection":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":0,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"wp:attachment":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}