{"id":360,"date":"2023-04-29T11:59:35","date_gmt":"2023-04-29T03:59:35","guid":{"rendered":"https:\/\/blog.taiyang.space\/?p=360"},"modified":"2023-04-29T11:59:36","modified_gmt":"2023-04-29T03:59:36","slug":"%e7%ac%ac1%e7%ab%a0-%e7%bb%aa%e8%ae%ba","status":"publish","type":"post","link":"https:\/\/blog.taiyang.space\/?p=360","title":{"rendered":"\u7b2c1\u7ae0-\u7eea\u8bba"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909093.jpeg\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<h2>1.1 \u6570\u636e\u7ed3\u6784\u7684\u7814\u7a76\u5185\u5bb9<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909095.jpeg\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<h2>1.2 \u57fa\u672c\u6982\u5ff5\u548c\u672f\u8bed<\/h2>\n<h3>1.2.1 \u672f\u8bed<\/h3>\n<ul>\n<li>\u6570\u636e\uff08Data\uff09<\/li>\n<li>\u6570\u636e\u5143\u7d20\uff08Data Element\uff09<\/li>\n<li>\u6570\u636e\u9879\uff08Data Item\uff09<\/li>\n<li>\u6570\u636e\u5bf9\u8c61\uff08Data Object\uff09<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>\u6570\u636e<\/h4>\n<p>\u5b9a\u4e49\uff1a<\/p>\n<ul>\n<li>\u662f\u80fd\u8f93\u5165\u8ba1\u7b97\u673a\u4e14\u80fd\u88ab\u8ba1\u7b97\u673a\u5904\u7406\u7684<strong>\u5404\u79cd\u7b26\u53f7\u7684\u96c6\u5408<\/strong><\/li>\n<li>\u4fe1\u606f\u7684\u8f7d\u4f53<\/li>\n<li>\u662f\u5bf9\u5ba2\u89c2\u4e8b\u7269\u7b26\u53f7\u5316\u7684\u8868\u793a<\/li>\n<li>\u80fd\u591f\u88ab\u8ba1\u7b97\u673a\u8bc6\u522b\u3001\u5b58\u50a8\u548c\u52a0\u5de5<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u6570\u503c\u578b\u7684\u6570\u636e\uff1a\u6574\u6570\u3001\u5b9e\u6570\u7b49<\/li>\n<li>\u975e\u6570\u503c\u578b\u7684\u6570\u636e\uff1a\u6587\u5b57\u3001\u56fe\u50cf\u3001\u56fe\u5f62\u3001\u58f0\u97f3\u7b49<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>\u6570\u636e\u5143\u7d20<\/h4>\n<ul>\n<li>\u662f\u6570\u636e\u7684<strong>\u57fa\u672c\u5355\u4f4d<\/strong>\uff0c\u5728\u8ba1\u7b97\u673a\u7a0b\u5e8f\u79cd\u901a\u5e38\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53\u8fdb\u884c\u8003\u8651\u548c\u5904\u7406<\/li>\n<li>\u4e5f\u7b80\u79f0\u4e3a\uff1a\u5143\u7d20\u3001\u8bb0\u5f55\u3001\u7ed3\u70b9\u3001\u5b9a\u70b9<\/li>\n<li>\u4e00\u4e2a<strong>\u6570\u636e\u5143\u7d20<\/strong>\u53ef\u7531\u82e5\u5e72\u4e2a<strong>\u6570\u636e\u9879<\/strong>\u7ec4\u6210\uff08Data Item\uff09<\/li>\n<\/ul>\n<p>\u4f8b\u5982\u4e8c\u7ef4\u8868\u4e2d\u6bcf\u4e00\u4e2a\u5143\u7ec4\uff08\u8bb0\u5f55\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909096.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<h4>\u6570\u636e\u9879<\/h4>\n<ul>\n<li>\u6784\u6210\u6570\u636e\u5143\u7d20\u7684\u4e0d\u53ef\u5206\u5272\u7684\u6700\u5c0f\u5355\u4f4d   \uff08\u539f\u5b50\u6027\uff09<\/li>\n<li>\u53ef\u7406\u89e3\u4e3a\u4e8c\u7ef4\u8868\u4e2d\u7684\u5c5e\u6027\uff08\u5b57\u6bb5\uff09<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909103.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<p>\u6570\u636e\u3001\u6570\u636e\u5143\u7d20\u3001\u6570\u636e\u9879\u4e09\u8005\u4e4b\u95f4\u7684\u5173\u7cfb\uff1a<\/p>\n<p>\u6570\u636e &gt; \u6570\u636e\u5143\u7d20 &gt; \u6570\u636e\u9879<\/p>\n<p>\u4f8b\uff1a\u5b66\u751f\u8868 &gt; \u4e2a\u4eba\u8bb0\u5f55 &gt; \u5b66\u53f7\u3001\u59d3\u540d<\/p>\n<p>&nbsp;<\/p>\n<h4>\u6570\u636e\u5bf9\u8c61<\/h4>\n<p>\u662f<strong>\u6027\u8d28\u76f8\u540c\u7684\u6570\u636e\u5143\u7d20\u7684\u96c6\u5408<\/strong>\uff0c\u662f<strong>\u6570\u636e<\/strong>\u7684\u4e00\u4e2a\u5b50\u96c6<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u6574\u6570\u6570\u636e\u5bf9\u8c61\u662f\u96c6\u5408N={0\uff0c\u00b11\uff0c\u00b12\uff0c\u00b13\uff0c&#8230;&#8230;}<\/li>\n<li>\u5b57\u6bcd\u5b57\u7b26\u6570\u636e\u5bf9\u8c61\u662f\u96c6\u5408C={&#8216;A&#8217;\uff0c&#8217;B&#8217;\uff0c&#8230;&#8230;\uff0c&#8217;Z&#8217;}<\/li>\n<li>\u5b66\u7c4d\u8868\u4e5f\u53ef\u770b\u505a\u4e00\u4e2a\u6570\u636e\u5bf9\u8c61<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u6570\u636e\u5143\u7d20\u4e0e\u6570\u636e\u5bf9\u8c61\u7684\u533a\u522b\uff1a<\/p>\n<ul>\n<li>\u6570\u636e\u5143\u7d20\uff1a\u7ec4\u6210\u6570\u636e\u7684\u57fa\u672c\u5355\u4f4d<\/li>\n<li>\n<ul>\n<li>\u4e0e\u6570\u636e\u7684\u5173\u7cfb\uff1a\u662f\u96c6\u5408\u7684<strong>\u4e2a\u4f53<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>\u6570\u636e\u5bf9\u8c61\uff1a\u6027\u8d28\u76f8\u540c\u7684\u6570\u636e\u5143\u7d20\u7684\u96c6\u5408<\/li>\n<li>\n<ul>\n<li>\u4e0e\u6570\u636e\u7684\u5173\u7cfb\uff1a\u96c6\u5408\u7684<strong>\u5b50\u96c6<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>1.2.2 \u6570\u636e\u7ed3\u6784<\/h3>\n<ul>\n<li>\u6570\u636e\u7ed3\u6784\u4e0d\u662f\u72ec\u7acb\u5b58\u5728\u7684\uff0c\u5b83\u4eec\u4e4b\u95f4\u5b58\u5728\u67d0\u79cd\u5173\u7cfb\uff0c<strong>\u6570\u636e\u5143\u7d20\u76f8\u4e92\u4e4b\u95f4\u7684\u5173\u7cfb\u79f0\u4e3a\u7ed3\u6784<\/strong>\uff08Structure\uff09<\/li>\n<li>\u662f\u6307<strong>\u76f8\u4e92\u4e4b\u95f4\u5b58\u5728\u4e00\u79cd\u6216\u591a\u79cd\u7279\u5b9a\u5173\u7cfb<\/strong>\u7684\u6570\u636e\u5143\u7d20\u7684\u96c6\u5408<\/li>\n<li>\u6216\u8005\u8bf4\uff0c\u6570\u636e\u7ed3\u6784\u662f<strong>\u5e26\u7ed3\u6784\u7684<\/strong>\u6570\u636e\u5143\u7d20\u7684\u96c6\u5408<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5305\u62ec\u4ee5\u4e0b\u4e09\u4e2a\u65b9\u9762\u7684\u5185\u5bb9\uff1a<\/p>\n<ol start=\"\">\n<li>\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\uff0c\u4e5f\u6210\u4e3a<strong>\u903b\u8f91\u7ed3\u6784<\/strong><\/li>\n<li>\u6570\u636e\u5143\u7d20\u53ca\u5176\u5173\u7cfb\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u8868\u793a\uff08\u53c8\u79f0\u4e3a\u6620\u50cf\uff09\uff0c\u79f0\u4e3a\u6570\u636e\u7684<strong>\u7269\u7406\u7ed3\u6784<\/strong>\u6216\u6570\u636e\u7684<strong>\u5b58\u50a8\u7ed3\u6784<\/strong><\/li>\n<li>\u6570\u636e\u7684<strong>\u8fd0\u7b97\u548c\u5b9e\u73b0<\/strong>\uff0c\u5373\u5bf9\u6570\u636e\u5143\u7d20\u53ef\u4ee5\u65bd\u52a0\u7684\u64cd\u4f5c\u4ee5\u53ca\u8fd9\u4e9b\u64cd\u4f5c\u5728\u76f8\u5e94\u7684\u5b58\u50a8\u7ed3\u6784\u4e0a\u7684\u5b9e\u73b0<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4>\u903b\u8f91\u7ed3\u6784<\/h4>\n<ul>\n<li>\u63cf\u8ff0\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb<\/li>\n<li>\u4e0e\u6570\u636e\u7684\u5b58\u50a8\u65e0\u5173\uff0c\u72ec\u7acb\u4e8e\u8ba1\u7b97\u673a<\/li>\n<li>\u662f\u4ece\u5177\u4f53\u95ee\u9898\u62bd\u8c61\u51fa\u6765\u7684\u6570\u5b66\u6a21\u578b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5212\u5206\u65b9\u6cd5\u4e00<\/p>\n<ul>\n<li><strong>\u7ebf\u6027<\/strong>\u7ed3\u6784\uff1a\u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u5f00\u59cb\u548c\u4e00\u4e2a\u7ec8\u7aef\u7ed3\u70b9\uff0c\u5e76\u4e14\u6240\u6709\u7ed3\u70b9\u90fd<strong>\u6700\u591a\u53ea\u6709\u4e00\u4e2a<\/strong>\u76f4\u63a5\u524d\u8d8b\u548c\u4e00\u4e2a\u76f4\u63a5\u540e\u7ee7<\/li>\n<li>\n<ul>\n<li>\u4f8b\u5982\uff1a\u7ebf\u6027\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u4e32<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u975e\u7ebf\u6027<\/strong>\u7ed3\u6784\uff1a\u4e00\u4e2a\u7ed3\u70b9<strong>\u53ef\u80fd\u6709\u591a\u4e2a<\/strong>\u76f4\u63a5\u524d\u8d8b\u548c\u76f4\u63a5\u540e\u7ee7<\/li>\n<li>\n<ul>\n<li>\u4f8b\u5982\uff1a\u6811\u3001\u56fe<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5212\u5206\u65b9\u6cd5\u4e8c<\/p>\n<ul>\n<li><strong>\u96c6\u5408<\/strong>\u7ed3\u6784\uff1a\u7ed3\u6784\u4e2d\u7684\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u9664\u4e86<strong>\u540c\u5c5e\u4e8e\u4e00\u4e2a\u96c6\u5408<\/strong>\u7684\u5173\u7cfb\u5916\uff0c\u65e0\u4efb\u4f55\u5176\u5b83\u5173\u7cfb<\/li>\n<li><strong>\u7ebf\u6027<\/strong>\u7ed3\u6784\uff1a\u7ed3\u6784\u4e2d\u7684\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u5b58\u5728\u7740<strong>\u4e00\u5bf9\u4e00<\/strong>\u7684<strong>\u7ebf\u6027<\/strong>\u5173\u7cfb<\/li>\n<li><strong>\u6811\u5f62<\/strong>\u7ed3\u6784\uff1a\u7ed3\u6784\u4e2d\u7684\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u5b58\u5728\u7740<strong>\u4e00\u5bf9\u591a<\/strong>\u7684<strong>\u5c42\u6b21<\/strong>\u5173\u7cfb<\/li>\n<li><strong>\u56fe\u72b6<\/strong>\u7ed3\u6784\u6216<strong>\u7f51\u72b6<\/strong>\u7ed3\u6784\uff1a\u7ed3\u6784\u4e2d\u7684\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u5b58\u5728\u7740<strong>\u591a\u5bf9\u591a<\/strong>\u7684<strong>\u4efb\u610f<\/strong>\u5173\u7cfb<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>\u7269\u7406\u7ed3\u6784<\/h4>\n<ul>\n<li>\u6570\u636e\u5143\u7d20\u53ca\u5176\u5173\u7cfb\u5728\u8ba1\u7b97\u673a\u5b58\u50a8\u5668\u4e2d\u7684\u7ed3\u6784\uff08\u5b58\u50a8\u65b9\u5f0f\uff09<\/li>\n<li>\u662f\u903b\u8f91\u7ed3\u6784\u5728\u8ba1\u7b97\u673a\u4e2d\u7684\u8868\u793a<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u56db\u79cd\u57fa\u672c\u7684\u5b58\u50a8\u7ed3\u6784\uff1a<\/p>\n<ul>\n<li><strong>\u987a\u5e8f<\/strong>\u5b58\u50a8\u7ed3\u6784\uff1a\u7528\u4e00\u7ec4<strong>\u8fde\u7eed<\/strong>\u7684\u5b58\u50a8\u5355\u5143<strong>\u4f9d\u6b21<\/strong>\u5b58\u50a8\u6570\u636e\u5143\u7d20\uff0c\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u7531\u5143\u7d20\u7684<strong>\u5b58\u50a8\u4f4d\u7f6e<\/strong>\u6765\u8868\u793a\n<ul>\n<li>C\u8bed\u8a00\u4e2d\u7528<strong>\u6570\u7ec4<\/strong>\u6765\u5b9e\u73b0\u987a\u5e8f\u5b58\u50a8\u7ed3\u6784<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u94fe\u5f0f<\/strong>\u5b58\u50a8\u7ed3\u6784\uff1a\u7528\u4e00\u7ec4<strong>\u4efb\u610f<\/strong>\u7684\u5b58\u50a8\u5355\u5143\u5b58\u50a8\u6570\u636e\u5143\u7d20\uff0c\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u7528<strong>\u6307\u9488<\/strong>\u6765\u8868\u793a\n<ul>\n<li>C\u8bed\u8a00\u4e2d\u7528<strong>\u6307\u9488<\/strong>\u6765\u5b9e\u73b0\u94fe\u5f0f\u5b58\u50a8\u7ed3\u6784<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7d22\u5f15<\/strong>\u5b58\u50a8\u7ed3\u6784\uff1a\u5728\u5b58\u50a8\u7ed3\u70b9\u4fe1\u606f\u7684\u540c\u65f6\uff0c\u8fd8\u5efa\u7acb\u9644\u52a0\u7684\u7d22\u5f15\u8868<\/li>\n<li><strong>\u6563\u5217<\/strong>\u5b58\u50a8\u7ed3\u6784\uff1a\u6839\u636e\u7ed3\u70b9\u7684\u5173\u952e\u5b57\u76f4\u63a5\u8ba1\u7b97\u51fa\u8be5\u7ed3\u70b9\u7684\u5b58\u50a8\u5730\u5740<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u903b\u8f91\u7ed3\u6784\u4e0e\u5b58\u50a8\u7ed3\u6784\u7684\u5173\u7cfb\uff1a<\/p>\n<ul>\n<li>\u5b58\u50a8\u7ed3\u6784\u662f\u903b\u8f91\u5173\u7cfb\u7684\u6620\u50cf\u4e0e\u5143\u7d20\u672c\u8eab\u7684\u6620\u50cf<\/li>\n<li><strong>\u903b\u8f91\u7ed3\u6784<\/strong>\u662f\u6570\u636e\u7ed3\u6784\u7684<strong>\u62bd\u8c61<\/strong>\uff0c<strong>\u5b58\u50a8\u7ed3\u6784<\/strong>\u662f\u6570\u636e\u7ed3\u6784\u7684<strong>\u5b9e\u73b0<\/strong><\/li>\n<li>\u4e24\u8005\u7efc\u5408\u8d77\u6765\u5efa\u7acb\u4e86\u6570\u636e\u5143\u7d20\u4e4b\u95f4\u7684\u7ed3\u6784\u5173\u7cfb<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>1.2.3 \u6570\u636e\u7c7b\u578b\u548c\u62bd\u8c61\u6570\u636e\u7c7b\u578b<\/h3>\n<h4>\u6570\u636e\u7c7b\u578b<\/h4>\n<p>\u5728\u4f7f\u7528\u9ad8\u7ea7\u7a0b\u5e8f\u8bbe\u8ba1\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u65f6\uff0c\u5fc5\u987b\u5bf9\u7a0b\u5e8f\u4e2d\u51fa\u73b0\u7684\u6bcf\u4e2a\u53d8\u91cf\u3001\u5e38\u91cf\u6216\u8868\u8fbe\u5f0f\uff0c\u660e\u786e\u8bf4\u660e\u5b83\u4eec\u6240\u5c5e\u7684<strong>\u6570\u636e\u7c7b\u578b<\/strong><\/p>\n<p>\u4f8b\u5982\uff0cC\u8bed\u8a00\u4e2d\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9bint\uff0cchar\uff0cfloat\uff0cdouble \u7b49\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/li>\n<li>\u6570\u7ec4\u3001\u7ed3\u6784\u3001\u5171\u7528\u4f53\u3001\u679a\u4e3e\u7b49\u6784\u9020\u6570\u636e\u7c7b\u578b<\/li>\n<li>\u8fd8\u6709\u6307\u9488\u3001\u7a7a\uff08void\uff09\u7c7b\u578b<\/li>\n<li>\u4f7f\u7528typedef\u81ea\u5b9a\u4e49\u6570\u636e\u7c7b\u578b<\/li>\n<\/ul>\n<p>\u4e00\u4e9b\u6700\u57fa\u672c\u7684\u6570\u636e\u7ed3\u6784\u53ef\u4ee5\u7528\u6570\u636e\u7c7b\u578b\u6765\u5b9e\u73b0\uff0c\u5982\u6570\u7ec4\u3001\u5b57\u7b26\u4e32\u7b49\uff1b\u800c\u53e6\u4e00\u4e9b\u5e38\u7528\u7684\u6570\u636e\u7ed3\u6784\uff0c\u5982\u6808\u3001\u961f\u5217\u3001\u6811\u3001\u56fe\u7b49\uff0c\u4e0d\u80fd\u76f4\u63a5\u7528\u6570\u636e\u7c7b\u578b\u8868\u793a<\/p>\n<p>&nbsp;<\/p>\n<p>\u6570\u636e\u7c7b\u578b\u7684\u4f5c\u7528<\/p>\n<ul>\n<li>\u7ea6\u675f\u53d8\u91cf\u6216\u5e38\u91cf\u7684<strong>\u53d6\u503c\u8303\u56f4<\/strong><\/li>\n<li>\u7ea6\u675f\u53d8\u91cf\u6216\u5e38\u91cf\u7684<strong>\u64cd\u4f5c<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5b9a\u4e49\uff1a<strong>\u6570\u636e\u7c7b\u578b<\/strong>\u662f\u4e00\u7ec4\u6027\u8d28\u76f8\u540c\u7684<strong>\u503c\u7684\u96c6\u5408<\/strong>\u4ee5\u53ca\u5b9a\u4e49\u4e8e\u8fd9\u4e2a\u503c\u96c6\u5408\u4e0a\u7684<strong>\u4e00\u7ec4\u64cd\u4f5c<\/strong>\u7684\u603b\u79f0<\/p>\n<p>\u6570\u636e\u7c7b\u578b = \u503c\u7684\u96c6\u5408 + \u503c\u96c6\u5408\u4e0a\u7684\u4e00\u7ec4\u64cd\u4f5c<\/p>\n<p>&nbsp;<\/p>\n<h4>\u62bd\u8c61\u6570\u636e\u7c7b\u578b<\/h4>\n<h5>\u5b9a\u4e49<\/h5>\n<p>Abstract Data Type\uff1a\u662f\u6307\u4e00\u4e2a\u6570\u5b66\u6a21\u578b\u4ee5\u53ca\u5b9a\u4e49\u5728\u6b64\u6570\u5b66\u6a21\u578b\u4e0a\u7684\u4e00\u7ec4\u64cd\u4f5c<\/p>\n<ul>\n<li>\u7531\u7528\u6237\u5b9a\u4e49\uff0c\u4ece\u95ee\u9898\u62bd\u8c61\u51fa<strong>\u6570\u636e\u6a21\u578b<\/strong>\uff08\u903b\u8f91\u7ed3\u6784\uff09<\/li>\n<li>\u8fd8\u5305\u62ec\u5b9a\u4e49\u5728\u6570\u636e\u6a21\u578b\u4e0a\u7684\u4e00\u7ec4<strong>\u62bd\u8c61\u8fd0\u7b97<\/strong>\uff08\u76f8\u5173\u64cd\u4f5c\uff09<\/li>\n<li>\u4e0d\u8003\u8651\u8ba1\u7b97\u673a\u5185\u7684\u5177\u4f53\u5b58\u50a8\u7ed3\u6784\u4e0e\u8fd0\u7b97\u7684\u5177\u4f53\u5b9e\u73b0\u7b97\u6cd5<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h5>\u5f62\u5f0f\u5b9a\u4e49<\/h5>\n<p>\u62bd\u8c61\u6570\u636e\u7c7b\u578b\u53ef\u7528\uff08D\uff0cS\uff0cP\uff09<strong>\u4e09\u5143\u7ec4<\/strong>\u8868\u793a<\/p>\n<p>\u5176\u4e2d\uff1aD\u662f\u6570\u636e\u7c7b\u578b<\/p>\n<p>S\u662fD\u4e0a\u7684\u5173\u7cfb\u96c6<\/p>\n<p>P\u662f\u5bf9D\u7684\u57fa\u672c\u64cd\u4f5c\u96c6<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e00\u4e2a\u62bd\u8c61\u6570\u636e\u7c7b\u578b\u7684\u5b9a\u4e49\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-cpp\" lang=\"cpp\">ADT \u62bd\u8c61\u6570\u636e\u7c7b\u578b\u540d{\n    \u6570\u636e\u5bf9\u8c61: &lt;\u6570\u636e\u5bf9\u8c61\u7684\u5b9a\u4e49&gt;\n    \u6570\u636e\u5173\u7cfb: &lt;\u6570\u636e\u5173\u7cfb\u7684\u5b9a\u4e49&gt;\n    \u57fa\u672c\u64cd\u4f5c: &lt;\u57fa\u672c\u64cd\u4f5c\u7684\u5b9a\u4e49&gt;\n}ADT \u62bd\u8c61\u6570\u636e\u7c7b\u578b\u540d\n<\/code><\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>\u6570\u636e\u5bf9\u8c61\u3001\u6570\u636e\u5173\u7cfb\u7684\u5b9a\u4e49\u7528\u4f2a\u4ee3\u7801\u63cf\u8ff0<\/li>\n<li>\u57fa\u672c\u64cd\u4f5c\u7684\u5b9a\u4e49\u683c\u5f0f\u4e3a\uff1a\n<ul>\n<li>\u57fa\u672c\u64cd\u4f5c\u540d\uff08\u53c2\u6570\u8868\uff09<\/li>\n<li>\u521d\u59cb\u6761\u4ef6\uff1a&lt;\u521d\u59cb\u6761\u4ef6\u63cf\u8ff0&gt;<\/li>\n<li>\u64cd\u4f5c\u7ed3\u679c\uff1a&lt;\u64cd\u4f5c\u7ed3\u679c\u63cf\u8ff0&gt;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4e3e\u4f8b\uff1aCircle\u7684\u5b9a\u4e49<\/p>\n<pre><code class=\"language-cpp\" lang=\"cpp\">ADT Circle{\n    \u6570\u636e\u5bf9\u8c61: D={r\uff0cx\uff0cy|r\uff0cx\uff0cy\u5747\u4e3a\u5b9e\u6570}\n    \u6570\u636e\u5173\u7cfb: R={&lt;r\uff0cx\uff0cy&gt;|r\u662f\u534a\u5f84\uff0c&lt;x\uff0cy&gt;\u662f\u5706\u5fc3\u5750\u6807}\n    \u57fa\u672c\u64cd\u4f5c: \n\tCircle(&amp;C, r, x, y)\n        \t\u64cd\u4f5c\u7ed3\u679c\uff1a\u6784\u9020\u4e00\u4e2a\u5706\n\tdouble Area(C)\n        \t\u521d\u59cb\u6761\u4ef6\uff1a\u5706\u5df2\u5b58\u5728\n        \t\u64cd\u4f5c\u7ed3\u679c\uff1a\u8ba1\u7b97\u9762\u79ef\n\tdouble Circumference(C)\n        \t\u521d\u59cb\u6761\u4ef6\uff1a\u5706\u5df2\u5b58\u5728\n        \t\u64cd\u4f5c\u7ed3\u679c\uff1a\u8ba1\u7b97\u5468\u957f\n    \t......\n}ADT Circle\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h2>1.3 \u62bd\u8c61\u6570\u636e\u7c7b\u578b\u7684\u8868\u793a\u4e0e\u5b9e\u73b0<\/h2>\n<h3>\u6982\u5ff5\u5c0f\u7ed3<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909097.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<h3>\u5b9e\u73b0<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909106.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u5373\u5229\u7528\u5904\u7406\u5668\u4e2d\u5df2\u5b58\u5728\u7684\u6570\u636e\u7c7b\u578b\u6765\u8bf4\u660e\u65b0\u7684\u7ed3\u6784\uff0c\u7528\u5df2\u7ecf\u5b9e\u73b0\u7684\u64cd\u4f5c\u6765\u7ec4\u5408\u65b0\u7684\u64cd\u4f5c<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u672c\u95e8\u8bfe\u7a0b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u7c7bC\u8bed\u8a00\uff08\u4ecb\u4e8e\u4f2a\u4ee3\u7801\u548cC\u8bed\u8a00\u4e4b\u95f4\uff09\u4f5c\u4e3a\u63cf\u8ff0\u5de5\u5177\uff0c\u4f46\u662f\u4ee3\u7801\u90fd\u662fC\u8bed\u8a00\u7248<\/p>\n<p>&nbsp;<\/p>\n<h2>1.4 \u7b97\u6cd5\u548c\u7b97\u6cd5\u5206\u6790<\/h2>\n<h3>\u7b97\u6cd5\u7684\u5b9a\u4e49<\/h3>\n<p>\u5bf9\u7279\u5b9a\u95ee\u9898<strong>\u6c42\u89e3\u65b9\u6cd5\u548c\u6b65\u9aa4<\/strong>\u7684\u4e00\u79cd\u63cf\u8ff0\uff0c\u5b83\u662f<strong>\u6307\u4ee4<\/strong>\u7684<strong>\u6709\u9650\u5e8f\u5217<\/strong>\u3002\u5176\u4e2d\u6bcf\u4e2a\u6307\u4ee4\u8868\u793a\u4e00\u4e2a\u6216\u591a\u4e2a\u64cd\u4f5c\u3002\u7b80\u800c\u8a00\u4e4b\uff0c\u7b97\u6cd5\u5c31\u662f<strong>\u89e3\u51b3\u95ee\u9898\u7684\u65b9\u6cd5\u548c\u6b65\u9aa4<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3>\u7b97\u6cd5\u7684\u63cf\u8ff0<\/h3>\n<ul>\n<li>\u81ea\u7136\u8bed\u8a00\uff1a\u82f1\u8bed\u3001\u4e2d\u6587<\/li>\n<li>\u6d41\u7a0b\u56fe\uff1a\u4f20\u7edf\u6d41\u7a0b\u56fe\u3001NS\u76d2\u56fe<\/li>\n<li>\u4f2a\u4ee3\u7801<\/li>\n<li>\u7a0b\u5e8f\u8bbe\u8ba1\u8bed\u8a00<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>\u7b97\u6cd5\u4e0e\u7a0b\u5e8f<\/h3>\n<ul>\n<li><strong>\u7b97\u6cd5<\/strong>\u662f\u89e3\u51b3\u95ee\u9898\u7684\u4e00\u79cd\u65b9\u6cd5\u6216\u4e00\u4e2a\u8fc7\u7a0b\uff0c\u8003\u8651\u5982\u4f55\u5c06\u8f93\u5165\u8f6c\u6362\u6210\u8f93\u51fa\uff0c\u4e00\u4e2a\u95ee\u9898\u53ef\u4ee5\u6709\u591a\u79cd\u7b97\u6cd5<\/li>\n<li><strong>\u7a0b\u5e8f<\/strong>\u662f\u7528\u67d0\u79cd\u7a0b\u5e8f\u8bbe\u8ba1\u8bed\u8a00\u5bf9\u7b97\u6cd5\u7684\u5177\u4f53\u5b9e\u73b0<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u7a0b\u5e8f = \u6570\u636e\u7ed3\u6784 + \u7b97\u6cd5<\/p>\n<ul>\n<li>\u6570\u636e\u7ed3\u6784\u901a\u8fc7\u7b97\u6cd5\u5b9e\u73b0\u64cd\u4f5c<\/li>\n<li>\u7b97\u6cd5\u6839\u636e\u6570\u636e\u7ed3\u6784\u8bbe\u8ba1\u7a0b\u5e8f<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>\u7b97\u6cd5\u7279\u6027<\/h3>\n<ul>\n<li>\u6709\u7a77\u6027\uff1a\u4e00\u4e2a\u7b97\u6cd5\u5fc5\u987b\u603b\u5728\u6267\u884c\u6709\u7a77\u6b65\u4e4b\u540e\u7ed3\u675f\uff0c\u4e14\u6bcf\u4e00\u6b65\u90fd\u5728<strong>\u6709\u7a77\u65f6\u95f4<\/strong>\u5185\u5b8c\u6210<\/li>\n<li>\u786e\u5b9a\u6027\uff1a\u7b97\u6cd5\u4e2d\u7684\u6bcf\u4e00\u6761\u6307\u4ee4\u5fc5\u987b\u6709\u786e\u5207\u7684\u542b\u4e49\uff0c<strong>\u6ca1\u6709\u4e8c\u4e49\u6027<\/strong>\uff0c\u5728\u4efb\u4f55\u6761\u4ef6\u4e0b\uff0c\u53ea\u6709\u552f\u4e00\u7684\u4e00\u6761\u6267\u884c\u8def\u5f84\uff0c\u5373\u5bf9\u4e8e\u76f8\u540c\u7684\u8f93\u5165\u53ea\u80fd\u5f97\u5230\u76f8\u540c\u7684\u8f93\u51fa<\/li>\n<li>\u53ef\u884c\u6027\uff1a\u7b97\u6cd5\u662fCPU\u53ef\u6267\u884c\u7684\uff0c\u7b97\u6cd5\u63cf\u8ff0\u7684\u64cd\u4f5c\u53ef\u4ee5\u901a\u8fc7\u5df2\u7ecf\u5b9e\u73b0\u7684\u57fa\u672c\u64cd\u4f5c\u6267\u884c\u6709\u9650\u6b21\u6765\u5b9e\u73b0<\/li>\n<li>\u53ef\u4ee5\u6ca1\u6709\u8f93\u5165\uff0c\u4f46\u81f3\u5c11\u6709\u4e00\u4e2a\u8f93\u51fa<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u7b97\u6cd5\u8bbe\u8ba1\u7684\u8981\u6c42<\/p>\n<ul>\n<li>\u6b63\u786e\u6027\uff1a\u7b97\u6cd5\u6ee1\u8db3\u95ee\u9898\u8981\u6c42\uff0c\u80fd\u6b63\u786e\u89e3\u51b3\u95ee\u9898<\/li>\n<li>\u53ef\u8bfb\u6027\uff1a\u5e94\u8be5\u6613\u4e8e\u4eba\u7684\u7406\u89e3<\/li>\n<li>\u5065\u58ee\u6027\uff1a\u8f93\u5165\u975e\u6cd5\u6570\u636e\u65f6\uff0c\u7b97\u6cd5\u505a\u51fa\u6070\u5f53\u53cd\u5e94\uff0c\u800c\u4e0d\u662f\u4ea7\u751f\u83ab\u540d\u5947\u5999\u7684\u7ed3\u679c<\/li>\n<li>\u9ad8\u6548\u6027\uff1a\u8981\u6c42\u5c3d\u91cf\u5c11\u7684\u65f6\u95f4\u548c\u5c3d\u91cf\u4f4e\u7684\u5b58\u50a8\u8981\u6c42<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>\u7b97\u6cd5\u5206\u6790<\/h3>\n<p>\u4e00\u4e2a\u597d\u7684\u7b97\u6cd5\u9996\u5148\u8981\u5177\u5907\u6b63\u786e\u6027\uff0c\u7136\u540e\u662f\u5065\u58ee\u6027\uff0c\u53ef\u8bfb\u6027\uff0c\u5728\u51e0\u4e2a\u65b9\u9762\u90fd\u6ee1\u8db3\u7684\u60c5\u51b5\u4e0b\uff0c\u4e3b\u8981\u8003\u8651\u7b97\u6cd5\u7684\u6548\u7387\uff0c\u901a\u8fc7\u7b97\u6cd5\u7684\u6548\u7387\u9ad8\u4f4e\u6765\u8bc4\u5224\u4e0d\u540c\u7b97\u6cd5\u7684\u4f18\u52a3\u7a0b\u5ea6\u3002\u901a\u5e38\u4ece\u8fd9\u4e24\u65b9\u9762\uff1a\u65f6\u95f4\u590d\u6742\u5ea6\u3001\u7a7a\u95f4\u590d\u6742\u5ea6<\/p>\n<ul>\n<li><strong>\u65f6\u95f4<\/strong>\u6548\u7387\uff1a\u6307\u7684\u662f\u7b97\u6cd5\u6240\u8017\u8d39\u7684<strong>\u65f6\u95f4<\/strong><\/li>\n<li><strong>\u7a7a\u95f4<\/strong>\u6548\u7387\uff1a\u6307\u7684\u662f\u7b97\u6cd5\u6267\u884c\u8fc7\u7a0b\u4e2d\u6240\u8017\u8d39\u7684<strong>\u5b58\u50a8\u7a7a\u95f4<\/strong><\/li>\n<\/ul>\n<p><strong>\u65f6\u95f4\u6548\u7387\u548c\u7a7a\u95f4\u6548\u7387\u6709\u65f6\u5019\u662f\u77db\u76fe\u7684<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h4>\u65f6\u95f4\u590d\u6742\u5ea6<\/h4>\n<p>\u7b97\u6cd5\u65f6\u95f4\u6548\u7387\u53ef\u4ee5\u7528\u8be5\u7b97\u6cd5\u7f16\u5236\u7684\u7a0b\u5e8f\u5728\u8ba1\u7b97\u673a\u4e0a\u6267\u884c<strong>\u6240\u6d88\u8017\u7684\u65f6\u95f4<\/strong>\u6765\u5ea6\u91cf<\/p>\n<p>\u4e24\u79cd\u5ea6\u91cf\u65b9\u6cd5<\/p>\n<ul>\n<li>\u4e8b\u540e\u7edf\u8ba1\uff1a\u5c06\u7b97\u6cd5\u5b9e\u73b0\uff0c\u6d4b\u7b97\u5176\u65f6\u95f4\u548c\u7a7a\u95f4\u5f00\u9500\n<ul>\n<li>\u7f3a\u70b9\uff1a\u82b1\u8d39\u8f83\u591a\u7684\u65f6\u95f4\u548c\u7cbe\u529b\uff1b\u6240\u5f97\u5b9e\u9a8c\u7ed3\u679c\u4f9d\u8d56\u4e8e\u8ba1\u7b97\u673a\u5f97\u8f6f\u786c\u4ef6\u7b49\u73af\u5883\u56e0\u7d20\uff0c\u63a9\u76d6\u7b97\u6cd5\u672c\u8eab\u7684\u4f18\u52a3<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8b\u524d\u5206\u6790\uff1a\u5bf9\u7b97\u6cd5\u6240\u6d88\u8017\u8d44\u6e90\u7684\u4e00\u79cd\u4f30\u7b97\u65b9\u6cd5<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h5>\u4e8b\u524d\u5206\u6790\u65b9\u6cd5<\/h5>\n<p>\u4e00\u4e2a\u7b97\u6cd5\u7684\u8fd0\u884c\u65f6\u95f4\u662f\u6307\u4e00\u4e2a\u7b97\u6cd5\u5728\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u6240\u8017\u8d39\u7684\u65f6\u95f4\u5927\u81f4\u53ef\u4ee5\u7b49\u4e8e\u8ba1\u7b97\u673a\u6267\u884c\u4e00\u79cd\u7b80\u5355\u7684\u64cd\u4f5c\uff08\u5982\u8d4b\u503c\u3001\u6bd4\u8f83\u3001\u79fb\u52a8\u7b49\uff09\u6240\u9700\u7684<strong>\u65f6\u95f4<\/strong>\u4e0e\u7b97\u6cd5\u4e2d\u8fdb\u884c\u7684\u7b80\u5355\u64cd\u4f5c<strong>\u6b21\u6570\u4e58\u79ef<\/strong><\/p>\n<p>\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4 = \u4e00\u4e2a\u7b80\u5355\u64cd\u4f5c\u6240\u9700\u7684\u65f6\u95f4  x  \u7b80\u5355\u64cd\u4f5c\u6b21\u6570<\/p>\n<p>\u4e5f\u53ef\u8bb0\u4e3a\uff1a \u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4 = <img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909371.svg\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<p>\u6bcf\u4e00\u6761\u8bed\u53e5\u6267\u884c\u4f9d\u6b21\u6240\u9700\u7684\u65f6\u95f4\uff0c\u4e00\u822c\u662f\u968f\u673a\u5668\u800c\u5f02\u7684\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u5047\u8bbe\u6267\u884c\u6bcf\u6761\u8bed\u53e5\u6240\u9700\u7684\u65f6\u95f4\u5747\u4e3a<strong>\u5355\u4f4d\u65f6\u95f4<\/strong><\/p>\n<p>\u8fd9\u6837\uff1a\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4 = <img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909374.svg\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<p>\u4f8b\u5982\uff1a\u4e24\u4e2a n x n\u77e9\u9635\u76f8\u4e58\u7684\u7b97\u6cd5\u53ef\u63cf\u8ff0\u4e3a<\/p>\n<pre><code class=\"language-cpp\" lang=\"cpp\">for(i=1; i&lt;=n; i++){\t\t\t\t\t\t\t\t\t\/\/ n+1 \u6b21\n    for(j=1; j&lt;=n; j++){\t\t\t\t\t\t\t\t\/\/ n(n+1)\u6b21\n        c[i][j] = 0;\t\t\t\t\t\t\t\t\t\/\/ n*n\u6b21\n        for(k=0; k&lt;n; k++){\t\t\t\t\t\t\t\t\/\/ n*n*(n+1)\u6b21\n            c[i][j] = c[i][j] + a[i][k] * b[k][j];\t\t\/\/ n*n*n\u6b21\n        }\n    }\n}\n<\/code><\/pre>\n<p>\u5219\u4e0a\u8ff0\u7b97\u6cd5\u7684\u65f6\u95f4\u6d88\u8017 T(n) = 2n^3 + 3n^2 +2n +1    \u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(n^3)<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e3a\u4e86\u4fbf\u4e8e\u6bd4\u8f83\u4e0d\u540c\u7b97\u6cd5\u7684\u65f6\u95f4\u6548\u7387\uff0c\u6211\u4eec\u4ec5\u6bd4\u8f83\u5b83\u4eec\u7684\u6570\u91cf\u7ea7<\/p>\n<p>\u4f8b\u5982\uff1a\u4e24\u4e2a\u4e0d\u540c\u7684\u7b97\u6cd5\uff0c\u65f6\u95f4\u6d88\u8017\u5206\u522b\u662f\uff1aT1(n) = 10n^2    T2(n) = 5n^3<\/p>\n<p><strong>\u53ea\u770b\u6700\u9ad8\u6b21\u5e42\u7684\u90a3\u4e00\u9879\u5e76\u53ef\u4ee5\u628a\u7cfb\u6570\u53bb\u6389<\/strong>\uff0c\u6240\u4ee5T1\u597d\uff0cT1\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n^3)<\/p>\n<p>&nbsp;<\/p>\n<p>\u5b9a\u4e49\uff1a\u7b97\u6cd5\u4e2d<strong>\u57fa\u672c\u8bed\u53e5<\/strong>\u91cd\u590d\u6267\u884c\u7684\u6b21\u6570\u662f<strong>\u95ee\u9898\u89c4\u6a21n<\/strong>\u7684\u67d0\u4e2a\u51fd\u6570f(n)\uff0c\u7b97\u6cd5\u7684\u65f6\u95f4\u91cf\u5ea6\u8bb0\u4f5c\uff1a T(n) = O(f(n))<\/p>\n<p>\u57fa\u672c\u8bed\u53e5\uff1a<\/p>\n<ul>\n<li>\u7b97\u6cd5\u4e2d\u91cd\u590d\u6267\u884c\u6b21\u6570\u548c\u7b97\u6cd5\u7684\u6267\u884c\u65f6\u95f4\u6210\u6b63\u6bd4\u7684\u8bed\u53e5<\/li>\n<li>\u5bf9\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u7684\u8d21\u732e\u6700\u5927<\/li>\n<li>\u6267\u884c\u6b21\u6570\u6700\u591a<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>n\u8d8a\u5927\u7b97\u6cd5\u7684\u6267\u884c\u65f6\u95f4\u8d8a\u957f<\/p>\n<ul>\n<li>\u6392\u5e8f\uff1an\u4e3a\u8bb0\u5f55\u6570<\/li>\n<li>\u77e9\u9635\uff1an\u4e3a\u77e9\u9635\u7684\u9636\u6570\u3001<\/li>\n<li>\u591a\u9879\u5f0f\uff1an\u4e3a\u591a\u9879\u5f0f\u7684\u9879\u6570<\/li>\n<li>\u96c6\u5408\uff1an\u4e3a\u5143\u7d20\u4e2a\u6570<\/li>\n<li>\u6811\uff1an\u4e3a\u6811\u7684\u7ed3\u70b9\u4e2a\u6570<\/li>\n<li>\u56fe\uff1an\u4e3a\u56fe\u7684\u9876\u70b9\u6570\u6216\u8fb9\u6570<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4e3e\u4f8b\uff1a<\/p>\n<pre><code class=\"language-cpp\" lang=\"cpp\">i = 1;\nwhile(i &lt;= n)\n    i = i * 2;\n<\/code><\/pre>\n<p>\u8bbe\u8bed\u53e5 i = i * 2; \u6267\u884c\u6b21\u6570\u4e3a x \u6b21\uff0c\u7531\u5faa\u73af\u6761\u4ef6 i &lt;= n   \u6240\u4ee5 2^x  &lt;= n<\/p>\n<p>\u5219 x &lt;= log(2, n)  \u6240\u4ee5\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(log(2, n))\uff0c\u79f0\u8fd9\u79cd\u4e3a\uff1a\u5bf9\u6570\u7ea7 \u53ef\u76f4\u63a5\u79f0\u4e3a log n\uff0c\u5ffd\u7565\u5e95\u6570<\/p>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610f\uff1a\u6709\u7684\u60c5\u51b5\u4e0b\uff0c\u7b97\u6cd5\u4e2d\u57fa\u672c\u64cd\u4f5c\u91cd\u590d\u6267\u884c\u7684\u6b21\u6570\u8fd8\u968f\u95ee\u9898\u7684<strong>\u8f93\u5165\u6570\u636e\u96c6<\/strong>\u4e0d\u540c\u800c\u4e0d\u540c<\/p>\n<pre><code class=\"language-cpp\" lang=\"cpp\">\/\/ \u987a\u5e8f\u67e5\u627e\uff0c\u5728\u6570\u7ec4a[i]\u4e2d\u67e5\u627e\u7b49\u4e8e e \u7684\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u6240\u5728\u4f4d\u7f6e\nfor(i=0;i&lt;n;i++){\n    if(a[i]==e)\n        return i+1;\n}\n\nreturn 0;\n<\/code><\/pre>\n<p>\u6700\u597d\u60c5\u51b5\uff1a1\u6b21      \u6700\u574f\u60c5\u51b5\uff1an\u6b21      \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\uff1aO(n)<\/p>\n<p>\u4e00\u822c\u603b\u662f\u8003\u8651\u5728\u6700\u574f\u65f6\u95f4\u590d\u6742\u5ea6<\/p>\n<p>&nbsp;<\/p>\n<p>\u65f6\u95f4\u590d\u6742\u5ea6T(n)\u6309\u6570\u91cf\u7ea7\u9012\u589e\u987a\u5e8f\u4e3a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909849.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>&nbsp;<\/p>\n<h4>\u7a7a\u95f4\u590d\u6742\u5ea6<\/h4>\n<p>\u7b97\u6cd5\u6240\u9700\u5b58\u50a8\u7a7a\u95f4\u7684\u5ea6\u91cf\uff0c\u8bb0\u4e3a\uff1aS(n)=O(f(n))\uff0c\u5176\u4e2dn\u4e3a\u95ee\u9898\u7684\u89c4\u6a21\uff08\u6216\u5927\u5c0f\uff09<\/p>\n<p>\u7b97\u6cd5\u8981\u5360\u636e\u7684\u7a7a\u95f4\uff1a<\/p>\n<ul>\n<li>\u7b97\u6cd5\u672c\u8eab\u8981\u5360\u636e\u7684\u7a7a\u95f4\uff1a\u8f93\u5165\/\u8f93\u51fa\uff0c\u6307\u4ee4\u3001\u5e38\u6570\u3001\u53d8\u91cf\u7b49<\/li>\n<li>\u7b97\u6cd5\u8981\u4f7f\u7528\u7684<strong>\u8f85\u52a9\u7a7a\u95f4<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4f8b\uff1a\u5c06\u4e00\u7ef4\u6570\u7ec4a\u4e2d\u7684n\u4e2a\u6570\u9006\u5e8f\u5b58\u653e\u5230\u539f\u6570\u7ec4\u4e2d<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202304031909851.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u7b97\u6cd51\uff1aS(n) = O(1)    \u539f\u5730\u5de5\u4f5c<\/p>\n<p>\u7b97\u6cd52\uff1aS(n) = O(n)<\/p>\n<p>&nbsp;<\/p>\n<h2>1.5 \u603b\u7ed3<\/h2>\n<ul>\n<li>\u62bd\u8c61\u6570\u636e\u7c7b\u578b = \u6570\u636e\u7684\u903b\u8f91\u7ed3\u6784 + \u62bd\u8c61\u8fd0\u7b97\uff08\u8fd0\u7b97\u7684\u529f\u80fd\u63cf\u8ff0\uff09<\/li>\n<li>\u6570\u636e\u7684\u903b\u8f91\u7ed3\u6784\u53ef\u4ee5\u91c7\u53d6\u4e0d\u540c\u7684\u5b58\u50a8\u7ed3\u6784<\/li>\n<li>\u57fa\u4e8e\u4e0d\u540c\u7684\u5b58\u50a8\u7ed3\u6784\u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u7b97\u6cd5\uff0c\u6bd4\u5982\u57fa\u4e8e\u987a\u5e8f\u5b58\u50a8\u7ed3\u6784\u7684\u7b97\u6cd5A\u3001\u57fa\u4e8e\u94fe\u5f0f\u5b58\u50a8\u7ed3\u6784\u7684\u7b97\u6cd5B<\/li>\n<li>\u5bf9\u4e0d\u540c\u7684\u7b97\u6cd5\u8fdb\u884c\u7b97\u6cd5\u5206\u6790\uff0c\u6bd4\u5bf9\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\uff0c\u9009\u62e9\u8f83\u4f18\u7684\u7b97\u6cd5<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6570\u636e\u7ed3\u6784\u7eea\u8bba<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-360","post","type-post","status-publish","format-standard","hentry","category-11"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0<\/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:\/\/blog.taiyang.space\/?p=360\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"og:description\" content=\"\u6570\u636e\u7ed3\u6784\u7eea\u8bba\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.taiyang.space\/?p=360\" \/>\n<meta property=\"og:site_name\" content=\"#\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-29T03:59:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-29T03:59:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picture.chentaiyang.space\/202304031909093.jpeg\" \/>\n<meta name=\"author\" content=\"taiyang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"taiyang\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=360#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=360\"},\"author\":{\"name\":\"taiyang\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"headline\":\"\u7b2c1\u7ae0-\u7eea\u8bba\",\"datePublished\":\"2023-04-29T03:59:35+00:00\",\"dateModified\":\"2023-04-29T03:59:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=360\"},\"wordCount\":173,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"articleSection\":[\"\u6570\u636e\u7ed3\u6784\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=360#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=360\",\"url\":\"https:\/\/blog.taiyang.space\/?p=360\",\"name\":\"\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/#website\"},\"datePublished\":\"2023-04-29T03:59:35+00:00\",\"dateModified\":\"2023-04-29T03:59:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=360#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=360\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=360#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/blog.taiyang.space\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b2c1\u7ae0-\u7eea\u8bba\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.taiyang.space\/#website\",\"url\":\"https:\/\/blog.taiyang.space\/\",\"name\":\"#\u762b\u7537\u65e5\u8bb0\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.taiyang.space\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\",\"name\":\"taiyang\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"contentUrl\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"width\":612,\"height\":640,\"caption\":\"taiyang\"},\"logo\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/blog.taiyang.space\"],\"url\":\"https:\/\/blog.taiyang.space\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0","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:\/\/blog.taiyang.space\/?p=360","og_locale":"zh_CN","og_type":"article","og_title":"\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0","og_description":"\u6570\u636e\u7ed3\u6784\u7eea\u8bba","og_url":"https:\/\/blog.taiyang.space\/?p=360","og_site_name":"#\u762b\u7537\u65e5\u8bb0","article_published_time":"2023-04-29T03:59:35+00:00","article_modified_time":"2023-04-29T03:59:36+00:00","og_image":[{"url":"https:\/\/picture.chentaiyang.space\/202304031909093.jpeg"}],"author":"taiyang","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"taiyang","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.taiyang.space\/?p=360#article","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/?p=360"},"author":{"name":"taiyang","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"headline":"\u7b2c1\u7ae0-\u7eea\u8bba","datePublished":"2023-04-29T03:59:35+00:00","dateModified":"2023-04-29T03:59:36+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.taiyang.space\/?p=360"},"wordCount":173,"commentCount":0,"publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"articleSection":["\u6570\u636e\u7ed3\u6784"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.taiyang.space\/?p=360#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.taiyang.space\/?p=360","url":"https:\/\/blog.taiyang.space\/?p=360","name":"\u7b2c1\u7ae0-\u7eea\u8bba - #\u762b\u7537\u65e5\u8bb0","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/#website"},"datePublished":"2023-04-29T03:59:35+00:00","dateModified":"2023-04-29T03:59:36+00:00","breadcrumb":{"@id":"https:\/\/blog.taiyang.space\/?p=360#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.taiyang.space\/?p=360"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.taiyang.space\/?p=360#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/blog.taiyang.space\/"},{"@type":"ListItem","position":2,"name":"\u7b2c1\u7ae0-\u7eea\u8bba"}]},{"@type":"WebSite","@id":"https:\/\/blog.taiyang.space\/#website","url":"https:\/\/blog.taiyang.space\/","name":"#\u762b\u7537\u65e5\u8bb0","description":"","publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.taiyang.space\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c","name":"taiyang","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/","url":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","contentUrl":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","width":612,"height":640,"caption":"taiyang"},"logo":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/blog.taiyang.space"],"url":"https:\/\/blog.taiyang.space\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":1,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions\/361"}],"wp:attachment":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}