From 2c1c264ceac4ae1b4846e7c833f210465b746594 Mon Sep 17 00:00:00 2001 From: krahets Date: Mon, 13 Mar 2023 22:41:04 +0800 Subject: [PATCH] deploy --- chapter_heap/heap.assets/heap_pop_step1.png | Bin 0 -> 69851 bytes chapter_heap/heap.assets/heap_pop_step10.png | Bin 0 -> 91043 bytes chapter_heap/heap.assets/heap_pop_step2.png | Bin 0 -> 67164 bytes chapter_heap/heap.assets/heap_pop_step3.png | Bin 0 -> 70258 bytes chapter_heap/heap.assets/heap_pop_step4.png | Bin 0 -> 83076 bytes chapter_heap/heap.assets/heap_pop_step5.png | Bin 0 -> 90770 bytes chapter_heap/heap.assets/heap_pop_step6.png | Bin 0 -> 86501 bytes chapter_heap/heap.assets/heap_pop_step7.png | Bin 0 -> 94815 bytes chapter_heap/heap.assets/heap_pop_step8.png | Bin 0 -> 88597 bytes chapter_heap/heap.assets/heap_pop_step9.png | Bin 0 -> 97065 bytes chapter_heap/heap/index.html | 74 +++++++++--------- chapter_stack_and_queue/deque/index.html | 37 +++------ chapter_stack_and_queue/queue/index.html | 10 +-- chapter_stack_and_queue/stack/index.html | 28 +++---- chapter_tree/binary_tree_traversal/index.html | 2 +- search/search_index.json | 2 +- sitemap.xml.gz | Bin 634 -> 634 bytes 17 files changed, 70 insertions(+), 83 deletions(-) create mode 100644 chapter_heap/heap.assets/heap_pop_step1.png create mode 100644 chapter_heap/heap.assets/heap_pop_step10.png create mode 100644 chapter_heap/heap.assets/heap_pop_step2.png create mode 100644 chapter_heap/heap.assets/heap_pop_step3.png create mode 100644 chapter_heap/heap.assets/heap_pop_step4.png create mode 100644 chapter_heap/heap.assets/heap_pop_step5.png create mode 100644 chapter_heap/heap.assets/heap_pop_step6.png create mode 100644 chapter_heap/heap.assets/heap_pop_step7.png create mode 100644 chapter_heap/heap.assets/heap_pop_step8.png create mode 100644 chapter_heap/heap.assets/heap_pop_step9.png diff --git a/chapter_heap/heap.assets/heap_pop_step1.png b/chapter_heap/heap.assets/heap_pop_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Tp^sX~1E&mx#_LF9vRJP> zz|otwnCh_9OIqCL#Fmxb>gOA1K_0f+l{YaVT;!-=R?=qzzrK(jr8C zT(4x(VU9V`hDaHnFbx@_FSL;U^@0n?7e8u~HG)q$DLu8ma5e@l zmX;RK{z@49asROZ&*)-yzapCR$GWn6^MnT+Os^L6q~iZrC%@KAIu`O|zU*A0o*xw) zZ;m{7ZqvIWFeAyVavs(1s`i(iJ;FMYd|zS@#p7I%3VwR<6rwWQr}y*h%vq`Mn^fyj z_48kV>>rQQMy*>uk@p@yuL?K1aw8&p9vhO7kPz3ATasMh`5LjHosOoxksJCe!S>ri zCWjM+dA-w-M<|=24<5`7+0&`<&p(%hrK^c_Fb>_hivBl&NKh_^by8|=(+ERcDR zVSqhAh+er?_8-M@Cvg<>nYbx^p!EN@*i9VQ3p_iXWXhfDSPL%3sYBK_WW5vFfVErO z+~ncmX|O<}><4}Ed(8;Ac0b0$T&hK!TraeAMNaA2q`;zon@`x{5RvDpm1f);-{Zyc#=e`W znP@WOG{$U)!Qk{W)6>^EA5%VZxTtLBlR*IE%DQh)k_1gQF|z*awcbD&`DA>@3USg2 zXx%e~6xsk6{RO*JtTt?@vb_ArKk?;a69# z^}Rhky1BX{tVrCc)b&0LSv6!O8Y#kohd-w0ndM#GGxJ=;m`XxaqN(`Kg8tJ9{zrU1g$rpd*5x8Vg+%e$|WL z^vN8NgQz{3_S<2tpxVc?_FHj{U z9n`y3M_RN>mVs4O_5YW3d=?-qtzZThEoaL|ur?5tl9G~?loT8LJ=K_=69#sE7*ARH gU)1b6!r!K2KbS9Co59?M%VlQ0kkiWvj6}9 literal 0 HcmV?d00001 diff --git a/chapter_heap/heap.assets/heap_pop_step10.png b/chapter_heap/heap.assets/heap_pop_step10.png new file mode 100644 index 0000000000000000000000000000000000000000..3e117b7456a165a4f9b2a291bfe68347e92e1ab6 GIT binary patch literal 91043 zcmeEuWmr^e7d8xo64G7L-635n-GWGWhk%51jM9yCgGdR|-O^o>(jeX4@a;M8>y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ozQ4a8 syo`Ocu}pPn9`05mO~2h?PQB;uz(uD1b>I>j3Vcb3$Oz{OYQO(~0M)y=CjbBd literal 0 HcmV?d00001 diff --git a/chapter_heap/heap.assets/heap_pop_step2.png b/chapter_heap/heap.assets/heap_pop_step2.png new file mode 100644 index 0000000000000000000000000000000000000000..c9755910c83d7086336142a80aa189332edca7a8 GIT binary patch literal 67164 zcmeFZWmuG3-#!e(APgum2#9o}AV^53be9s+4U*CgBPb0b-3`(b(%lWxNOyPld$I3Z zH}~Gp$M@r350AM#W?d_PeV%Ll*36w}Fbdp|mvIbKn^n4iO#-hj7;f_zMUB^skriUXg&u|MRQ>PxIe4 zK%YJ)aNxh%!@<1+KJWf$1OM*c`OhapGW_2?CWC&rMuba7`27qT09wO&2no0X9}p`s zRU0@sw3fSn@Da3V_`tm3#DxUjIKpowAk}ERjVT|(0hwkM;WE^y^Yn4I7gPJR8KSN?h%*_P(Hp!R3vj0Vqyq((0! zbV5$sxds?w z3$w{G^MPc6>g}@0z4_+q@C*%P?eyK8x4COL*eUMa$a8C)t!twDIw}hPy8xh{0aBO( z49}T4TMLS;%^S-1ewaqz%IB@HVU{yC+p0l#q|Wj7Y`upPXv8$jbi`FE^I*3Y(v>-&x8^3}?9AI;eG^X!N0d_M?A-240ppUC6t z0~-JJ&dW>Q%ZX=p4z8h?BcDctcG2)(D*k(df}jqK_r8`;o#S2;ZKj_MThpe6wVxm2 zDg4q!0-a@NCBCb3<$&TI$6+_5xSY!n=a6f>%jWpkuETP$#F*IA8D>+w9ilxQ+%Xzl zJ7)Dlczi=5Hu*K-^e)}DirQaa>%Kx8vh0{kcM&|IBDcz6r2U+xW)cPY_t^`8mPaTR zqMW}zK*J-bin3fe6sa0UyCQ&>suU%53y+km`8KP6Ln%PzAGLcn@WgM86Y@(kj?`_) zuyI~h>R-#m09#ivQ5fkfcnYPH!-%M0YtkZf>9ErYqogg@xz(PBR2$fK1|yb(4H+A3 zv>y~XDY?!6y+$G^atgi#^Lp<!=e<;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op_step4.png new file mode 100644 index 0000000000000000000000000000000000000000..727e62fdcd32bc7b38a2d3811b1ff3a03904c30a GIT binary patch literal 83076 zcmeFZWmr|~_CCB=E)+zh8>9q88U!SSB}g|&NjK6B(x^y-bcaYvw=`1HAl)h5-S9r_ zb98(5{(XEu{o0LkwmUIqX2-atjnP)Z8&7<@;9AR=HwZrxl0{y-22|GN3+7I6fk-{0jC z9{u+kFs9FI2<)%xA&^(#^X5No@b~7P|9sv`LHK*b6zH$35g{qJetn1bfvX`NFP^)C z4`eG*Ra*$;e)G*=gh;ykL}1+zu@}!@Iw5Q%-ubGoSouMW3MPu=1wjy4L5B&1qgRPy zJ%27FHc#4#a^dG6#eQ{H79$zOu4~}D3$c~Kd1iBSm{`zRqRmL z%wB&Sy0hc$`c^{IdxTH26jaCkAi`%ov1~qua_DOnzL4OI@IZ%%X;cOA|1SO4T0CLn zRI-nl1udx$B_If0H1j_92;SbasL1l&kS&;B;YRvFs5zZOoqnVWu^D!e z-CA=@A3Hvji67KB6?%b<_lmP_BCkR8-(%t-lR46o*CD?j;>`5&dvVLwq4sc?h*=x1 z6SRpmi->~T6~~U^7jV{ncebzAH507`gOPp^|KH;bAwMJ_?vLJ`_^coCv0U#niM z$xHV)kiQc=-s^UqM#3BSnj!NP<1`K=X?4GDduS+^i)083qkWigR_IFRz8 za_H6nry-Gfk$oJ9B5e}FUZl5>{%JPeEQy$L^}oZMI9BXEg(xL; z1nrFRs99|@+3O~D!f!lIJK8;U)Sg=Irv`WLwh+y%euSTW^s>T^gJuUe#@KcI9~*>1 z#ny$V(UZj7F_H3!X43rNVHL*OFiWJ_=>*LxJKEqMt4~f(t?&`*#IR;Ihogf63upfQ z(7vFzeUZCMPa((ELgP2~&<3NXO>-|Fy8#7{QIe)O8(G8_3cJex$Zc3)z#Sg-saM>z}=Nc}*To}Vio)MN~A zHmVP;P3S1t>klqcE4{oge+% zkU5~_(hEFxbTgIX3X%`iXgy2BC=-vc~{InbXKkUQ;`F&FN|x)>MI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_M^8yQ2_)QF`tL zE^ZYPw%9o)6h2LxjKlI(yZ zoq15DF{`?!y4jjKEOFoGb_DbI#Ka08cUntncvWVgJtr^kKu?D!`i_TJRybav6zBX; zXUOmS2SZxE_U8nWo;l&M*9rEK`r@(9IW#qMvOL7dF2IZpcf)z1ypd&*?w`X;7NzQ|KJVzy*j`kp;};&tSqQcLKWM>q7YJT)P(&pbk3f{uw)Dnzk{HGI}PDh7U61i z_CD@wf1J|*XJ32uI@^Cnn8%3kvQEXkVV8pz(x$1#Z@iRIr5G9*NQfWc1q(?B2qYY7 zh5>Z}m3syam9QP_re4#J`aB1G9+LlKfg6$BflDmgZ7ue@@T6r#)$(l?1WFt2;~VO# zwi1uUx+jB3<*3)L1^=pG=t;fCu0&x$VC!&R!qDfAP za;z3j)xO%Y2*7BkAiTisa3 z(-~J^s^at8zCrQpDo1PS?-wnSR=J1|;s&qIGn3?Mrns+L*P1G1rvu`Fp;uw{{45CQ)l^_2-Ry*)w2EZJyj$g()P*rh3gMF!AM zrxHkr4Iwg-*?;HddM|gE65@S1n$%wFLVoTk!9D6u3OqpGBJ#`>GY{ zpgP(NI10Ho3rtXDD+YK^S|diSW5zFmPK5&urfZZq$lgd-1>@z> zhA_lui>mKpdq|3LcwFs-RO$>BRgnR-Cqd9=BZy7$X;uI(U@uo9t57E{q~g};|2B{o z#Mw^pYKWT~3&nj!AEgLp-UZ2A9;SQ8BpC={Q$R=aD0X<4LAZgiu7@>cLF>oW{@ZxG zq6`R3?dil@VV(bQb-*}+bn&6g``m)T0`j>p Q$H1S8qJ~0|-2Es22La{Qp#T5? literal 0 HcmV?d00001 diff --git a/chapter_heap/heap.assets/heap_pop_step7.png b/chapter_heap/heap.assets/heap_pop_step7.png new file mode 100644 index 0000000000000000000000000000000000000000..24f81b6faa0179f223bd6688b0df864a4be5d505 GIT binary patch literal 94815 zcmeEuWmr^e+x9SoAc%y7w6xOQp>!)qH%NCkGJteRH%Ll%x3qM3NOyOB3-|Nvt&jWn z_v_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|#!As!W4Y$T(Jm~oIr-!#JyyGT!UHg!voqeF zUJ)5@x-M$tMpcRoRQt7p{<;}lg0x7S=e=RGrsp0^Kae&}Po})Ss?&{C6Wit5=@uaZ z{x$=@=K`T=cvpv`MI(|Wgy+jFdp3}{(3)5f_8yEe|sqjB}o9+}fo z(`w!SxtayuUZs^OnqqB=U~VWQCD5)RPuIn}N^@EA|CZ37zxMG_pHZ*I;ku68oNJ;a zEo-UXqdauPM^HFPi zz?-HrcYMdk#|@g?)df*Ag=?xK>eFyFhJe6-k4g{u-M%zi6RUn9E2SDqF2DGRo;~OE zD=QN-Gk}+l({!Gpc_MEOYr-;cVoli)8?Y?y*>*bPX3TG^{P(566f!)^y(uZGj7`kL z!%N+WB z*mYf(S4=y@=I|@M`djE4dyw~;%-6g9LhG56xOo9R`W|`NPkS_d{%5JhJsNz~@Bcav zc1teuhlpsjzpJb3ZL@nkBrR$pA|k7+tH8hn)sAJ~7sO~YyEHh|-;f@2_@ArXXZ$j% zJ;`fQCl4m>r}VPkj{opc=@NOsZL*E`WYWdQ=W=PuUlDU*4BxG&AToaMszA#D+=d0OjL4AHm#_oErd@dbv|-(TkOKm>hdG}1XZ zIM7FUPwRRy;*2nywousO*o|dkbkdX5a$=q zo*jymjR!cD8x2iO3j0k!6O7(>gX}nH&VII8PhWp`%Obouo&aT9l=mX6`oHn_uSjf2 z<~Q^@(YGtHfwr+L@t1dswY9aEmsh0a+MX{?<6J02_22hSM0`dVfQXqZS-&xY1N_KJ MDZVU`H2m=Y098gfcK`qY literal 0 HcmV?d00001 diff --git a/chapter_heap/heap.assets/heap_pop_step9.png b/chapter_heap/heap.assets/heap_pop_step9.png new file mode 100644 index 0000000000000000000000000000000000000000..d11f55435a2652b941c58d3c921d2a73cd51689c GIT binary patch literal 97065 zcmeFZWmpw!xIYYwMJyGhOHdkV1nHCx0TBeGk(TZ*NokSp?oR1NcT0D7cfW(@?7iK` z{rUa$$Kjgg#mubxxjTN(e0?V^iu?%w5ey6rvbd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fzSt3Kv=q-c1~AhAxyqo+Z9ypsM~m%uBJxUGV0 z2-^4Fm*kTJ(Ryzd;o;$N>J*K2%>@$p1_Tw|-Q8@%4_Rx8l!=3YAE{!?dc*V%TaV42 z51dS6Re-;Cqfj+gx=8P#xis2zqKdjeFG z*-Q)&WG4zM5-9`075F|uE0h|DP0Y^9YG`bH&X{u$svxEk3*eg68bc-O zkr(W_pfhF#PtFk$ZvV<>jf* zYrtVCvPy#YxB3{E-P{znf3uOu7ksV!=6%`n5yUf4_Wa2aR`$F7W4#k$X^}cQI(AYN zZ#8i-fsuCqRN_(FxH{S|y8`$UF)g64E~pMls*@s9Hbg{4Wg>XeiZ1cv!8-q(F84!M zKy=V`)pIY&li}N*Mwr;R`OD;h(^ZBrMk`w2t7nzBr{oO6U@)+x1$Zo(@uac_6$P<8 ii~VKq`__GB+2yY_JHnSIJH2QS@MmIViKQFhqy7s5&n&_K literal 0 HcmV?d00001 diff --git a/chapter_heap/heap/index.html b/chapter_heap/heap/index.html index c41fd1c37..c71d505b5 100644 --- a/chapter_heap/heap/index.html +++ b/chapter_heap/heap/index.html @@ -1805,24 +1805,24 @@

值得说明的是,多数编程语言提供的是「优先队列 Priority Queue」,其是一种抽象数据结构,定义为具有出队优先级的队列

而恰好,堆的定义与优先队列的操作逻辑完全吻合,大顶堆就是一个元素从大到小出队的优先队列。从使用角度看,我们可以将「优先队列」和「堆」理解为等价的数据结构。因此,本文与代码对两者不做特别区分,统一使用「堆」来命名。

-

堆的常用操作见下表(方法命名以 Java 为例)。

+

堆的常用操作见下表,方法名需根据编程语言确定。

- + - + - + @@ -1859,11 +1859,11 @@ Queue<Integer> maxHeap = new PriorityQueue<>((a, b) -> b - a);/* 元素入堆 */ -maxHeap.add(1); -maxHeap.add(3); -maxHeap.add(2); -maxHeap.add(5); -maxHeap.add(4); +maxHeap.offer(1); +maxHeap.offer(3); +maxHeap.offer(2); +maxHeap.offer(5); +maxHeap.offer(4);/* 获取堆顶元素 */int peek = maxHeap.peek(); // 5 @@ -2021,11 +2021,11 @@ /* 堆顶元素出堆 */ // 调用 heap.Interface 的方法,来移除元素 - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) + heap.Pop(maxHeap) // 5 + heap.Pop(maxHeap) // 4 + heap.Pop(maxHeap) // 3 + heap.Pop(maxHeap) // 2 + heap.Pop(maxHeap) // 1 /* 获取堆大小 */ size := len(*maxHeap) @@ -2038,11 +2038,11 @@
-
heap.js
// JavaScript 未提供内置 heap 类
+
heap.js
// JavaScript 未提供内置 Heap 类
 
-
heap.ts
// TypeScript 未提供内置堆 Heap 类
+
heap.ts
// TypeScript 未提供内置 Heap 类
 
@@ -2085,7 +2085,7 @@
-
heap.swift
// Swift 未提供内置 heap 类
+
heap.swift
// Swift 未提供内置 Heap 类
 
@@ -2617,34 +2617,34 @@
-

堆顶元素出堆步骤

+

堆顶元素出堆步骤

-

heap_poll_step2

+

heap_pop_step2

-

heap_poll_step3

+

heap_pop_step3

-

heap_poll_step4

+

heap_pop_step4

-

heap_poll_step5

+

heap_pop_step5

-

heap_poll_step6

+

heap_pop_step6

-

heap_poll_step7

+

heap_pop_step7

-

heap_poll_step8

+

heap_pop_step8

-

heap_poll_step9

+

heap_pop_step9

-

heap_poll_step10

+

heap_pop_step10

@@ -2653,7 +2653,7 @@
my_heap.java
/* 元素出堆 */
-int poll() {
+int pop() {
     // 判空处理
     if (isEmpty())
         throw new EmptyStackException();
@@ -2688,7 +2688,7 @@
 
my_heap.cpp
/* 元素出堆 */
-void poll() {
+void pop() {
     // 判空处理
     if (empty()) {
         throw out_of_range("堆为空");
@@ -2722,7 +2722,7 @@
 
-
my_heap.py
def poll(self) -> int:
+
my_heap.py
def pop(self) -> int:
     """ 元素出堆 """
     # 判空处理
     assert not self.is_empty()
@@ -2755,7 +2755,7 @@
 
my_heap.go
/* 元素出堆 */
-func (h *maxHeap) poll() any {
+func (h *maxHeap) pop() any {
     // 判空处理
     if h.isEmpty() {
         fmt.Println("error")
@@ -2798,7 +2798,7 @@
 
my_heap.js
/* 元素出堆 */
-poll() {
+pop() {
     // 判空处理
     if (this.isEmpty()) throw new Error("堆为空");
     // 交换根结点与最右叶结点(即交换首元素与尾元素)
@@ -2832,7 +2832,7 @@
 
my_heap.ts
/* 元素出堆 */
-poll(): number {
+pop(): number {
     // 判空处理
     if (this.isEmpty()) throw new RangeError('Heap is empty.');
     // 交换根结点与最右叶结点(即交换首元素与尾元素)
@@ -2865,14 +2865,14 @@
 
-
my_heap.c
[class]{maxHeap}-[func]{poll}
+
my_heap.c
[class]{maxHeap}-[func]{pop}
 
 [class]{maxHeap}-[func]{siftDown}
 
my_heap.cs
/* 元素出堆 */
-int poll()
+int pop()
 {
     // 判空处理
     if (isEmpty())
@@ -2911,7 +2911,7 @@
 
my_heap.swift
/* 元素出堆 */
-func poll() -> Int {
+func pop() -> Int {
     // 判空处理
     if isEmpty() {
         fatalError("堆为空")
@@ -2954,7 +2954,7 @@
 
my_heap.zig
// 元素出堆
-fn poll(self: *Self) !T {
+fn pop(self: *Self) !T {
     // 判断处理
     if (self.isEmpty()) unreachable;
     // 交换根结点与最右叶结点(即交换首元素与尾元素)
diff --git a/chapter_stack_and_queue/deque/index.html b/chapter_stack_and_queue/deque/index.html
index cb7712472..d57ed6617 100644
--- a/chapter_stack_and_queue/deque/index.html
+++ b/chapter_stack_and_queue/deque/index.html
@@ -2934,7 +2934,7 @@
 
         front: ?*ListNode(T) = null,                    // 头结点 front
         rear: ?*ListNode(T) = null,                     // 尾结点 rear
-        deqSize: usize = 0,                             // 双向队列的长度
+        que_size: usize = 0,                             // 双向队列的长度
         mem_arena: ?std.heap.ArenaAllocator = null,
         mem_allocator: std.mem.Allocator = undefined,   // 内存分配器
 
@@ -2946,7 +2946,7 @@
             }
             self.front = null;
             self.rear = null;
-            self.deqSize = 0;
+            self.que_size = 0;
         }
 
         // 析构方法(释放内存)
@@ -2957,7 +2957,7 @@
 
         // 获取双向队列的长度
         pub fn size(self: *Self) usize {
-            return self.deqSize;
+            return self.que_size;
         }
 
         // 判断双向队列是否为空
@@ -2966,7 +2966,7 @@
         }
 
         // 入队操作
-        pub fn push(self: *Self, num: T, isFront: bool) !void {
+        pub fn push(self: *Self, num: T, is_front: bool) !void {
             var node = try self.mem_allocator.create(ListNode(T));
             node.init(num);
             // 若链表为空,则令 front, rear 都指向 node
@@ -2974,7 +2974,7 @@
                 self.front = node;
                 self.rear = node;
             // 队首入队操作
-            } else if (isFront) {
+            } else if (is_front) {
                 // 将 node 添加至链表头部
                 self.front.?.prev = node;
                 node.next = self.front;
@@ -2986,7 +2986,7 @@
                 node.prev = self.rear;
                 self.rear = node;   // 更新尾结点
             }
-            self.deqSize += 1;      // 更新队列长度
+            self.que_size += 1;      // 更新队列长度
         } 
 
         // 队首入队
@@ -3000,11 +3000,11 @@
         } 
 
         // 出队操作
-        pub fn pop(self: *Self, isFront: bool) T {
+        pub fn pop(self: *Self, is_front: bool) T {
             if (self.isEmpty()) @panic("双向队列为空");
             var val: T = undefined;
             // 队首出队操作
-            if (isFront) {
+            if (is_front) {
                 val = self.front.?.val;     // 暂存头结点值
                 // 删除头结点
                 var fNext = self.front.?.next;
@@ -3024,7 +3024,7 @@
                 }
                 self.rear = rPrev;          // 更新尾结点
             }
-            self.deqSize -= 1;              // 更新队列长度
+            self.que_size -= 1;              // 更新队列长度
             return val;
         } 
 
@@ -3050,7 +3050,7 @@
             return self.rear.?.val;
         }
 
-        // 将链表转换为数组
+        // 返回数组用于打印
         pub fn toArray(self: *Self) ![]T {
             var node = self.front;
             var res = try self.mem_allocator.alloc(T, self.size());
@@ -3062,21 +3062,8 @@
             }
             return res;
         }
-
-        // 打印双向队列
-        pub fn print(self: *Self) !void {
-            var nums = try self.toArray();
-            std.debug.print("[", .{});
-            if (nums.len > 0) {
-                for (nums) |num, j| {
-                    std.debug.print("{}{s}", .{num, if (j == nums.len - 1) "]" else " <-> " });
-                }
-            } else {
-                std.debug.print("]", .{});
-            }
-        }
-    };
-}
+    };
+}
 
diff --git a/chapter_stack_and_queue/queue/index.html b/chapter_stack_and_queue/queue/index.html index db888ffe0..18ee4d0bc 100644 --- a/chapter_stack_and_queue/queue/index.html +++ b/chapter_stack_and_queue/queue/index.html @@ -2577,7 +2577,7 @@ front: ?*inc.ListNode(T) = null, // 头结点 front rear: ?*inc.ListNode(T) = null, // 尾结点 rear - queSize: usize = 0, // 队列的长度 + que_size: usize = 0, // 队列的长度 mem_arena: ?std.heap.ArenaAllocator = null, mem_allocator: std.mem.Allocator = undefined, // 内存分配器 @@ -2589,7 +2589,7 @@ } self.front = null; self.rear = null; - self.queSize = 0; + self.que_size = 0; } // 析构方法(释放内存) @@ -2600,7 +2600,7 @@ // 获取队列的长度 pub fn size(self: *Self) usize { - return self.queSize; + return self.que_size; } // 判断队列是否为空 @@ -2628,7 +2628,7 @@ self.rear.?.next = node; self.rear = node; } - self.queSize += 1; + self.que_size += 1; } // 出队 @@ -2636,7 +2636,7 @@ var num = self.peek(); // 删除头结点 self.front = self.front.?.next; - self.queSize -= 1; + self.que_size -= 1; return num; } diff --git a/chapter_stack_and_queue/stack/index.html b/chapter_stack_and_queue/stack/index.html index 9511c7fc5..c3cf3ec8f 100644 --- a/chapter_stack_and_queue/stack/index.html +++ b/chapter_stack_and_queue/stack/index.html @@ -2554,8 +2554,8 @@ return struct { const Self = @This(); - stackTop: ?*inc.ListNode(T) = null, // 将头结点作为栈顶 - stkSize: usize = 0, // 栈的长度 + stack_top: ?*inc.ListNode(T) = null, // 将头结点作为栈顶 + stk_size: usize = 0, // 栈的长度 mem_arena: ?std.heap.ArenaAllocator = null, mem_allocator: std.mem.Allocator = undefined, // 内存分配器 @@ -2565,8 +2565,8 @@ self.mem_arena = std.heap.ArenaAllocator.init(allocator); self.mem_allocator = self.mem_arena.?.allocator(); } - self.stackTop = null; - self.stkSize = 0; + self.stack_top = null; + self.stk_size = 0; } // 析构方法(释放内存) @@ -2577,7 +2577,7 @@ // 获取栈的长度 pub fn size(self: *Self) usize { - return self.stkSize; + return self.stk_size; } // 判断栈是否为空 @@ -2586,31 +2586,31 @@ } // 访问栈顶元素 - pub fn top(self: *Self) T { + pub fn peek(self: *Self) T { if (self.size() == 0) @panic("栈为空"); - return self.stackTop.?.val; + return self.stack_top.?.val; } // 入栈 pub fn push(self: *Self, num: T) !void { var node = try self.mem_allocator.create(inc.ListNode(T)); node.init(num); - node.next = self.stackTop; - self.stackTop = node; - self.stkSize += 1; + node.next = self.stack_top; + self.stack_top = node; + self.stk_size += 1; } // 出栈 pub fn pop(self: *Self) T { - var num = self.top(); - self.stackTop = self.stackTop.?.next; - self.stkSize -= 1; + var num = self.peek(); + self.stack_top = self.stack_top.?.next; + self.stk_size -= 1; return num; } // 将栈转换为数组 pub fn toArray(self: *Self) ![]T { - var node = self.stackTop; + var node = self.stack_top; var res = try self.mem_allocator.alloc(T, self.size()); std.mem.set(T, res, @as(T, 0)); var i: usize = 0; diff --git a/chapter_tree/binary_tree_traversal/index.html b/chapter_tree/binary_tree_traversal/index.html index 2b106b8f2..63da6a7ff 100644 --- a/chapter_tree/binary_tree_traversal/index.html +++ b/chapter_tree/binary_tree_traversal/index.html @@ -1851,7 +1851,7 @@ // 初始化一个切片,用于保存遍历序列 nums := make([]int, 0) for queue.Len() > 0 { - // poll + // 队列出队 node := queue.Remove(queue.Front()).(*TreeNode) // 保存结点值 nums = append(nums, node.Val) diff --git a/search/search_index.json b/search/search_index.json index 1e3655bb1..b636f4e69 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["ja"],"separator":"[\\s\\-\uff0c\u3002]+","pipeline":["stemmer"]},"docs":[{"location":"","title":"Home","text":"

\u300a Hello \u7b97\u6cd5 \u300b

\u52a8\u753b\u56fe\u89e3\u3001\u80fd\u8fd0\u884c\u3001\u53ef\u63d0\u95ee\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5feb\u901f\u5165\u95e8\u6559\u7a0b

@Krahets

\u63a8\u8350\u8bed

Quote

\u201c\u4e00\u672c\u901a\u4fd7\u6613\u61c2\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5165\u95e8\u4e66\uff0c\u5f15\u5bfc\u8bfb\u8005\u624b\u8111\u5e76\u7528\u5730\u5b66\u4e60\uff0c\u5f3a\u70c8\u63a8\u8350\u7b97\u6cd5\u521d\u5b66\u8005\u9605\u8bfb\u3002\u201d

\u2014\u2014 \u9093\u4fca\u8f89\uff0c\u6e05\u534e\u5927\u5b66\u8ba1\u7b97\u673a\u7cfb\u6559\u6388

Quote

\u201c\u5982\u679c\u6211\u5f53\u5e74\u5b66\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u65f6\u5019\u6709\u300aHello \u7b97\u6cd5\u300b\uff0c\u5b66\u8d77\u6765\u5e94\u8be5\u4f1a\u7b80\u5355 10 \u500d\uff01\u201d

\u2014\u2014 \u674e\u6c90\uff0c\u4e9a\u9a6c\u900a\u8d44\u6df1\u9996\u5e2d\u79d1\u5b66\u5bb6

\u300c\u5168\u4e66\u52a8\u753b\u56fe\u89e3\u300d

\u5185\u5bb9\u6e05\u6670\u6613\u61c2\u3001\u5b66\u4e60\u66f2\u7ebf\u5e73\u6ed1\u7535\u8111\u3001\u5e73\u677f\u3001\u624b\u673a\u5168\u7ec8\u7aef\u9605\u8bfb

\"A picture is worth a thousand words.\"

\u201c\u4e00\u56fe\u80dc\u5343\u8a00\u201d

\u300c\u4ee3\u7801\u4e00\u952e\u8fd0\u884c\u300d

\u63d0\u4f9b\u5404\u4e2a\u7b97\u6cd5\u4e0e\u6570\u636e\u7ed3\u6784\u7684\u7b80\u6d01\u5b9e\u73b0\u4e0e\u6d4b\u8bd5\u6837\u4f8b\uff0c\u7686\u53ef\u76f4\u63a5\u8fd0\u884c\u652f\u6301 Java, C++, Python, Go, JS, TS, C#, Swift, Zig \u7b49\u8bed\u8a00

\"Talk is cheap. Show me the code.\"

\u201c\u5c11\u5439\u725b\uff0c\u770b\u4ee3\u7801\u201d

\u300c\u53ef\u8ba8\u8bba\u4e0e\u63d0\u95ee\u300d

\u9f13\u52b1\u5c0f\u4f19\u4f34\u4eec\u4e92\u5e2e\u4e92\u52a9\u3001\u5171\u540c\u6210\u957f\u63d0\u95ee\u4e0e\u8bc4\u8bba\u4e00\u822c\u80fd\u5728\u4e24\u65e5\u5185\u5f97\u5230\u56de\u590d

\u201c\u8ffd\u98ce\u8d76\u6708\u83ab\u505c\u7559\uff0c\u5e73\u829c\u5c3d\u5904\u662f\u6625\u5c71\u201d

\u4e00\u8d77\u52a0\u6cb9\uff01

\u5e8f

\u4e24\u5e74\u524d\uff0c\u6211\u5728\u529b\u6263\u4e0a\u5206\u4eab\u4e86\u300a\u5251\u6307 Offer\u300b\u7cfb\u5217\u9898\u89e3\uff0c\u53d7\u5230\u4e86\u5f88\u591a\u5c0f\u4f19\u4f34\u7684\u559c\u7231\u4e0e\u652f\u6301\u3002\u5728\u6b64\u671f\u95f4\uff0c\u6211\u4e5f\u56de\u590d\u4e86\u8bb8\u591a\u8bfb\u8005\u7684\u8bc4\u8bba\u95ee\u9898\uff0c\u9047\u5230\u6700\u591a\u7684\u95ee\u9898\u662f\u201c\u5982\u4f55\u5165\u95e8\u5b66\u4e60\u7b97\u6cd5\u201d\u3002\u6211\u6e10\u6e10\u4e5f\u5bf9\u8fd9\u4e2a\u95ee\u9898\u597d\u5947\u4e86\u8d77\u6765\u3002

\u4e24\u773c\u4e00\u62b9\u9ed1\u5730\u5237\u9898\u5e94\u8be5\u662f\u6700\u53d7\u6b22\u8fce\u7684\u65b9\u5f0f\uff0c\u7b80\u5355\u7c97\u66b4\u4e14\u6709\u6548\u3002\u7136\u800c\uff0c\u5237\u9898\u5c31\u5982\u540c\u73a9\u201c\u626b\u96f7\u201d\u6e38\u620f\uff0c\u81ea\u5b66\u80fd\u529b\u5f3a\u7684\u540c\u5b66\u80fd\u591f\u987a\u5229\u5730\u5c06\u5730\u96f7\u9010\u4e2a\u6392\u6389\uff0c\u800c\u57fa\u7840\u4e0d\u8db3\u7684\u540c\u5b66\u5f88\u53ef\u80fd\u88ab\u70b8\u7684\u6ee1\u5934\u662f\u5305\uff0c\u5e76\u5728\u53d7\u632b\u4e2d\u6b65\u6b65\u9000\u7f29\u3002\u901a\u8bfb\u6559\u6750\u4e66\u7c4d\u4e5f\u662f\u5e38\u7528\u65b9\u6cd5\uff0c\u4f46\u5bf9\u4e8e\u9762\u5411\u6c42\u804c\u7684\u540c\u5b66\u6765\u8bf4\uff0c\u6bd5\u4e1a\u5b63\u3001\u6295\u9012\u7b80\u5386\u3001\u5e94\u4ed8\u7b14\u9762\u8bd5\u5df2\u7ecf\u5360\u7528\u5927\u90e8\u5206\u7cbe\u529b\uff0c\u539a\u91cd\u7684\u4e66\u672c\u4e5f\u56e0\u6b64\u6210\u4e3a\u5de8\u5927\u7684\u6311\u6218\u3002

\u5982\u679c\u4f60\u4e5f\u6709\u4e0a\u8ff0\u70e6\u607c\uff0c\u90a3\u4e48\u5f88\u5e78\u8fd0\u8fd9\u672c\u4e66\u627e\u5230\u4e86\u4f60\u3002\u672c\u4e66\u662f\u6211\u5bf9\u4e8e\u8be5\u95ee\u9898\u7ed9\u51fa\u7684\u7b54\u6848\uff0c\u867d\u7136\u4e0d\u4e00\u5b9a\u6b63\u786e\uff0c\u4f46\u81f3\u5c11\u4ee3\u8868\u4e00\u6b21\u79ef\u6781\u7684\u5c1d\u8bd5\u3002\u8fd9\u672c\u4e66\u867d\u7136\u4e0d\u8db3\u4ee5\u8ba9\u4f60\u76f4\u63a5\u62ff\u5230 Offer \uff0c\u4f46\u4f1a\u5f15\u5bfc\u4f60\u63a2\u7d22\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u201c\u77e5\u8bc6\u5730\u56fe\u201d\uff0c\u5e26\u4f60\u4e86\u89e3\u4e0d\u540c\u201c\u5730\u96f7\u201d\u7684\u5f62\u72b6\u5927\u5c0f\u548c\u5206\u5e03\u4f4d\u7f6e\uff0c\u8ba9\u4f60\u638c\u63e1\u5404\u79cd\u201c\u6392\u96f7\u65b9\u6cd5\u201d\u3002\u6709\u4e86\u8fd9\u4e9b\u672c\u9886\uff0c\u76f8\u4fe1\u4f60\u53ef\u4ee5\u66f4\u52a0\u5f97\u5fc3\u5e94\u624b\u5730\u5237\u9898\u4e0e\u9605\u8bfb\u6587\u732e\uff0c\u9010\u6b65\u642d\u5efa\u8d77\u5b8c\u6574\u7684\u77e5\u8bc6\u4f53\u7cfb\u3002

\u4f5c\u8005\u7b80\u4ecb

\u9773\u5b87\u680b (Krahets)\uff0c\u5927\u5382\u9ad8\u7ea7\u7b97\u6cd5\u5de5\u7a0b\u5e08\uff0c\u4e0a\u6d77\u4ea4\u901a\u5927\u5b66\u7855\u58eb\u3002\u529b\u6263\uff08LeetCode\uff09\u5168\u7f51\u9605\u8bfb\u91cf\u6700\u9ad8\u535a\u4e3b\uff0c\u5176 LeetBook\u300a\u56fe\u89e3\u7b97\u6cd5\u6570\u636e\u7ed3\u6784\u300b\u5df2\u88ab\u8ba2\u9605 22 \u4e07\u672c\u3002

\u81f4\u8c22

\u672c\u4e66\u5728\u5f00\u6e90\u793e\u533a\u7684\u7fa4\u7b56\u7fa4\u529b\u4e0b\u9010\u6b65\u6210\u957f\uff0c\u611f\u8c22\u6bcf\u4e00\u4f4d\u64b0\u7a3f\u4eba\uff0c\u662f\u4ed6\u4eec\u7684\u65e0\u79c1\u5949\u732e\u8ba9\u8fd9\u672c\u4e66\u53d8\u5f97\u66f4\u597d\uff0c\u4ed6\u4eec\u662f\uff08\u6309\u7167 GitHub \u81ea\u52a8\u751f\u6210\u7684\u987a\u5e8f\uff09\uff1a

\u672c\u4e66\u7684\u4ee3\u7801\u5ba1\u9605\u5de5\u4f5c\u7531 justin\u2010tse, krahets, nuomi1, Reanon, sjinzh \u5b8c\u6210\uff0c\u611f\u8c22\u4ed6\u4eec\u7684\u8f9b\u52e4\u4ed8\u51fa\uff01

justin-tseJS / TS krahetsJava / Python nuomi1Swift ReanonGo / C sjinzhRust / Zig"},{"location":"chapter_appendix/contribution/","title":"12.2. \u00a0 \u4e00\u8d77\u53c2\u4e0e\u521b\u4f5c","text":"

\u5f00\u6e90\u7684\u9b45\u529b

\u7eb8\u8d28\u4e66\u7c4d\u7684\u4e24\u6b21\u5370\u5237\u7684\u95f4\u9694\u65f6\u95f4\u5f80\u5f80\u9700\u8981\u6570\u5e74\uff0c\u5185\u5bb9\u66f4\u65b0\u975e\u5e38\u4e0d\u65b9\u4fbf\u3002\u4f46\u5728\u672c\u5f00\u6e90 HTML \u4e66\u4e2d\uff0c\u5185\u5bb9\u66f4\u8fed\u7684\u65f6\u95f4\u88ab\u7f29\u77ed\u81f3\u6570\u65e5\u751a\u81f3\u51e0\u4e2a\u5c0f\u65f6\u3002

\u7531\u4e8e\u4f5c\u8005\u6c34\u5e73\u6709\u9650\uff0c\u4e66\u4e2d\u5185\u5bb9\u96be\u514d\u758f\u6f0f\u8c2c\u8bef\uff0c\u8bf7\u60a8\u8c05\u89e3\u3002\u5982\u679c\u53d1\u73b0\u7b14\u8bef\u3001\u65e0\u6548\u94fe\u63a5\u3001\u5185\u5bb9\u7f3a\u5931\u3001\u6587\u5b57\u6b67\u4e49\u3001\u89e3\u91ca\u4e0d\u6e05\u6670\u3001\u884c\u6587\u7ed3\u6784\u4e0d\u5408\u7406\u7b49\u95ee\u9898\uff0c\u8bf7\u60a8\u5e2e\u5fd9\u4fee\u6b63\uff0c\u4ee5\u5e2e\u52a9\u5176\u4ed6\u8bfb\u8005\u83b7\u53d6\u66f4\u4f18\u8d28\u7684\u5b66\u4e60\u5185\u5bb9\u3002\u6240\u6709\u64b0\u7a3f\u4eba\u5c06\u88ab\u5c55\u793a\u5728\u4ed3\u5e93\u4e0e\u7f51\u7ad9\u4e3b\u9875\uff0c\u4ee5\u611f\u8c22\u4ed6\u4eec\u5bf9\u5f00\u6e90\u793e\u533a\u7684\u65e0\u79c1\u5949\u732e\uff01

"},{"location":"chapter_appendix/contribution/#1221","title":"12.2.1. \u00a0 \u5185\u5bb9\u5fae\u8c03","text":"

\u6bcf\u4e2a\u9875\u9762\u7684\u53f3\u4e0a\u89d2\u90fd\u6709\u4e00\u4e2a\u300c\u7f16\u8f91\u300d\u56fe\u6807\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u4fee\u6539\u6587\u5b57\u6216\u4ee3\u7801\uff1a

  1. \u70b9\u51fb\u7f16\u8f91\u6309\u94ae\uff0c\u5982\u679c\u9047\u5230\u63d0\u793a\u201c\u9700\u8981 Fork \u6b64\u4ed3\u5e93\u201d\uff0c\u8bf7\u901a\u8fc7\uff1b
  2. \u4fee\u6539 Markdown \u6e90\u6587\u4ef6\u5185\u5bb9\uff0c\u5e76\u68c0\u67e5\u5185\u5bb9\u6b63\u786e\u6027\uff0c\u5c3d\u91cf\u4fdd\u6301\u6392\u7248\u683c\u5f0f\u7edf\u4e00\uff1b
  3. \u5728\u9875\u9762\u5e95\u90e8\u586b\u5199\u66f4\u6539\u8bf4\u660e\uff0c\u7136\u540e\u5355\u51fb\u201cPropose file change\u201d\u6309\u94ae\uff1b\u9875\u9762\u8df3\u8f6c\u540e\uff0c\u70b9\u51fb\u201cCreate pull request\u201d\u6309\u94ae\u53d1\u8d77\u62c9\u53d6\u8bf7\u6c42\u5373\u53ef\u3002

Fig. \u9875\u9762\u7f16\u8f91\u6309\u952e

\u56fe\u7247\u65e0\u6cd5\u76f4\u63a5\u4fee\u6539\uff0c\u9700\u8981\u901a\u8fc7\u65b0\u5efa Issue \u6216\u8bc4\u8bba\u7559\u8a00\u6765\u63cf\u8ff0\u56fe\u7247\u95ee\u9898\uff0c\u6211\u4f1a\u7b2c\u4e00\u65f6\u95f4\u91cd\u65b0\u753b\u56fe\u5e76\u66ff\u6362\u56fe\u7247\u3002

"},{"location":"chapter_appendix/contribution/#1222","title":"12.2.2. \u00a0 \u5185\u5bb9\u521b\u4f5c","text":"

\u5982\u679c\u60a8\u60f3\u8981\u53c2\u4e0e\u672c\u5f00\u6e90\u9879\u76ee\uff0c\u5305\u62ec\u7ffb\u8bd1\u4ee3\u7801\u81f3\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u3001\u62d3\u5c55\u6587\u7ae0\u5185\u5bb9\u7b49\uff0c\u90a3\u4e48\u9700\u8981\u5b9e\u65bd Pull Request \u5de5\u4f5c\u6d41\u7a0b\uff1a

  1. \u767b\u5f55 GitHub \uff0c\u5e76 Fork \u672c\u4ed3\u5e93 \u81f3\u4e2a\u4eba\u8d26\u53f7\uff1b
  2. \u8fdb\u5165 Fork \u4ed3\u5e93\u7f51\u9875\uff0c\u4f7f\u7528 git clone \u514b\u9686\u8be5\u4ed3\u5e93\u81f3\u672c\u5730\uff1b
  3. \u5728\u672c\u5730\u8fdb\u884c\u5185\u5bb9\u521b\u4f5c\uff0c\u5e76\u901a\u8fc7\u8fd0\u884c\u6d4b\u8bd5\u6765\u9a8c\u8bc1\u4ee3\u7801\u6b63\u786e\u6027\uff1b
  4. \u5c06\u672c\u5730\u66f4\u6539 Commit \uff0c\u5e76 Push \u81f3\u8fdc\u7a0b\u4ed3\u5e93\uff1b
  5. \u5237\u65b0\u4ed3\u5e93\u7f51\u9875\uff0c\u70b9\u51fb\u201cCreate pull request\u201d\u6309\u94ae\u53d1\u8d77\u62c9\u53d6\u8bf7\u6c42\u5373\u53ef\uff1b
"},{"location":"chapter_appendix/contribution/#1223-docker","title":"12.2.3. \u00a0 Docker \u90e8\u7f72","text":"

\u4f60\u53ef\u4ee5\u4f7f\u7528 Docker \u6765\u90e8\u7f72\u672c\u9879\u76ee\u3002\u7a0d\u7b49\u7247\u523b\uff0c\u5373\u53ef\u4f7f\u7528\u6d4f\u89c8\u5668\u6253\u5f00 http://localhost:8000 \u8bbf\u95ee\u672c\u9879\u76ee\u3002

git clone https://github.com/krahets/hello-algo.git\ncd hello-algo\ndocker-compose up -d\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u5220\u9664\u90e8\u7f72\u3002

docker-compose down\n
"},{"location":"chapter_appendix/installation/","title":"12.1. \u00a0 \u7f16\u7a0b\u73af\u5883\u5b89\u88c5","text":""},{"location":"chapter_appendix/installation/#1211-vscode","title":"12.1.1. \u00a0 \u5b89\u88c5 VSCode","text":"

\u672c\u4e66\u63a8\u8350\u4f7f\u7528\u5f00\u6e90\u8f7b\u91cf\u7684 VSCode \u4f5c\u4e3a\u672c\u5730 IDE \uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5 VSCode \u3002

"},{"location":"chapter_appendix/installation/#1212-java","title":"12.1.2. \u00a0 Java \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 OpenJDK\uff08\u7248\u672c\u9700\u6ee1\u8db3 > JDK 9\uff09\u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 java \uff0c\u5b89\u88c5 Java Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1213-cc","title":"12.1.3. \u00a0 C/C++ \u73af\u5883","text":"
  1. Windows \u7cfb\u7edf\u9700\u8981\u5b89\u88c5 MinGW\uff08\u914d\u7f6e\u6559\u7a0b\uff09\uff0cMacOS \u81ea\u5e26 Clang \u65e0\u9700\u5b89\u88c5\u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 c++ \uff0c\u5b89\u88c5 C/C++ Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1214-python","title":"12.1.4. \u00a0 Python \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Miniconda3 \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 python \uff0c\u5b89\u88c5 Python Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1215-go","title":"12.1.5. \u00a0 Go \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 go \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 go \uff0c\u5b89\u88c5 Go \u3002
  3. \u5feb\u6377\u952e Ctrl + Shift + P \u547c\u51fa\u547d\u4ee4\u680f\uff0c\u8f93\u5165 go \uff0c\u9009\u62e9 Go: Install/Update Tools \uff0c\u5168\u90e8\u52fe\u9009\u5e76\u5b89\u88c5\u5373\u53ef\u3002
"},{"location":"chapter_appendix/installation/#1216-javascript","title":"12.1.6. \u00a0 JavaScript \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 node.js \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 javascript \uff0c\u5b89\u88c5 JavaScript (ES6) code snippets \u3002
"},{"location":"chapter_appendix/installation/#1217-c","title":"12.1.7. \u00a0 C# \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 .Net 6.0 \uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 c# \uff0c\u5b89\u88c5 c# \u3002
"},{"location":"chapter_appendix/installation/#1218-swift","title":"12.1.8. \u00a0 Swift \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Swift\uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 swift\uff0c\u5b89\u88c5 Swift for Visual Studio Code\u3002
"},{"location":"chapter_appendix/installation/#1219-rust","title":"12.1.9. \u00a0 Rust \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Rust\uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 rust\uff0c\u5b89\u88c5 rust-analyzer\u3002
"},{"location":"chapter_array_and_linkedlist/array/","title":"4.1. \u00a0 \u6570\u7ec4","text":"

\u300c\u6570\u7ec4 Array\u300d\u662f\u4e00\u79cd\u5c06 \u76f8\u540c\u7c7b\u578b\u5143\u7d20 \u5b58\u50a8\u5728 \u8fde\u7eed\u5185\u5b58\u7a7a\u95f4 \u7684\u6570\u636e\u7ed3\u6784\uff0c\u5c06\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u4f4d\u7f6e\u79f0\u4e3a\u5143\u7d20\u7684\u300c\u7d22\u5f15 Index\u300d\u3002

Fig. \u6570\u7ec4\u5b9a\u4e49\u4e0e\u5b58\u50a8\u65b9\u5f0f

Note

\u89c2\u5bdf\u4e0a\u56fe\uff0c\u6211\u4eec\u53d1\u73b0 \u6570\u7ec4\u9996\u5143\u7d20\u7684\u7d22\u5f15\u4e3a \\(0\\) \u3002\u4f60\u53ef\u80fd\u4f1a\u60f3\uff0c\u8fd9\u5e76\u4e0d\u7b26\u5408\u65e5\u5e38\u4e60\u60ef\uff0c\u9996\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\u4e3a\u4ec0\u4e48\u4e0d\u662f \\(1\\) \u5462\uff0c\u8fd9\u4e0d\u662f\u66f4\u52a0\u81ea\u7136\u5417\uff1f\u6211\u8ba4\u540c\u4f60\u7684\u60f3\u6cd5\uff0c\u4f46\u8bf7\u5148\u8bb0\u4f4f\u8fd9\u4e2a\u8bbe\u5b9a\uff0c\u540e\u9762\u8bb2\u5185\u5b58\u5730\u5740\u8ba1\u7b97\u65f6\uff0c\u6211\u4f1a\u5c1d\u8bd5\u89e3\u7b54\u8fd9\u4e2a\u95ee\u9898\u3002

\u6570\u7ec4\u521d\u59cb\u5316\u3002\u4e00\u822c\u4f1a\u7528\u5230\u65e0\u521d\u59cb\u503c\u3001\u7ed9\u5b9a\u521d\u59cb\u503c\u4e24\u79cd\u5199\u6cd5\uff0c\u53ef\u6839\u636e\u9700\u6c42\u9009\u53d6\u3002\u5728\u4e0d\u7ed9\u5b9a\u521d\u59cb\u503c\u7684\u60c5\u51b5\u4e0b\uff0c\u4e00\u822c\u6240\u6709\u5143\u7d20\u4f1a\u88ab\u521d\u59cb\u5316\u4e3a\u9ed8\u8ba4\u503c \\(0\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nint[] arr = new int[5]; // { 0, 0, 0, 0, 0 }\nint[] nums = { 1, 3, 2, 5, 4 };\n
array.cpp
/* \u521d\u59cb\u5316\u6570\u7ec4 */\n// \u5b58\u50a8\u5728\u6808\u4e0a\nint arr[5];\nint nums[5] { 1, 3, 2, 5, 4 };\n// \u5b58\u50a8\u5728\u5806\u4e0a\nint* arr1 = new int[5];\nint* nums1 = new int[5] { 1, 3, 2, 5, 4 };\n
array.py
\"\"\" \u521d\u59cb\u5316\u6570\u7ec4 \"\"\"\narr: List[int] = [0] * 5  # [ 0, 0, 0, 0, 0 ]\nnums: List[int] = [1, 3, 2, 5, 4]  \n
array.go
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nvar arr [5]int\n// \u5728 Go \u4e2d\uff0c\u6307\u5b9a\u957f\u5ea6\u65f6\uff08[5]int\uff09\u4e3a\u6570\u7ec4\uff0c\u4e0d\u6307\u5b9a\u957f\u5ea6\u65f6\uff08[]int\uff09\u4e3a\u5207\u7247\n// \u7531\u4e8e Go \u7684\u6570\u7ec4\u88ab\u8bbe\u8ba1\u4e3a\u5728\u7f16\u8bd1\u671f\u786e\u5b9a\u957f\u5ea6\uff0c\u56e0\u6b64\u53ea\u80fd\u4f7f\u7528\u5e38\u91cf\u6765\u6307\u5b9a\u957f\u5ea6\n// \u4e3a\u4e86\u65b9\u4fbf\u5b9e\u73b0\u6269\u5bb9 extend() \u65b9\u6cd5\uff0c\u4ee5\u4e0b\u5c06\u5207\u7247\uff08Slice\uff09\u770b\u4f5c\u6570\u7ec4\uff08Array\uff09\nnums := []int{1, 3, 2, 5, 4}\n
array.js
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nvar arr = new Array(5).fill(0);\nvar nums = [1, 3, 2, 5, 4];\n
array.ts
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nlet arr: number[] = new Array(5).fill(0);\nlet nums: number[] = [1, 3, 2, 5, 4];\n
array.c
int arr[5] = { 0 }; // { 0, 0, 0, 0, 0 }\nint nums[5] = { 1, 3, 2, 5, 4 };\n
array.cs
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nint[] arr = new int[5]; // { 0, 0, 0, 0, 0 }\nint[] nums = { 1, 3, 2, 5, 4 };\n
array.swift
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nlet arr = Array(repeating: 0, count: 5) // [0, 0, 0, 0, 0]\nlet nums = [1, 3, 2, 5, 4]\n
array.zig
// \u521d\u59cb\u5316\u6570\u7ec4\nvar arr = [_]i32{0} ** 5; // { 0, 0, 0, 0, 0 }\nvar nums = [_]i32{ 1, 3, 2, 5, 4 };\n
"},{"location":"chapter_array_and_linkedlist/array/#411","title":"4.1.1. \u00a0 \u6570\u7ec4\u4f18\u70b9","text":"

\u5728\u6570\u7ec4\u4e2d\u8bbf\u95ee\u5143\u7d20\u975e\u5e38\u9ad8\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u5728\u6570\u7ec4\u4e2d\uff0c\u8ba1\u7b97\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\u975e\u5e38\u5bb9\u6613\u3002\u7ed9\u5b9a\u6570\u7ec4\u9996\u4e2a\u5143\u7d20\u7684\u5730\u5740\u3001\u548c\u4e00\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u5229\u7528\u4ee5\u4e0b\u516c\u5f0f\u53ef\u4ee5\u76f4\u63a5\u8ba1\u7b97\u5f97\u5230\u8be5\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\uff0c\u4ece\u800c\u76f4\u63a5\u8bbf\u95ee\u6b64\u5143\u7d20\u3002

Fig. \u6570\u7ec4\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\u8ba1\u7b97

# \u5143\u7d20\u5185\u5b58\u5730\u5740 = \u6570\u7ec4\u5185\u5b58\u5730\u5740 + \u5143\u7d20\u957f\u5ea6 * \u5143\u7d20\u7d22\u5f15\nelementAddr = firtstElementAddr + elementLength * elementIndex\n

\u4e3a\u4ec0\u4e48\u6570\u7ec4\u5143\u7d20\u7d22\u5f15\u4ece 0 \u5f00\u59cb\u7f16\u53f7\uff1f \u6839\u636e\u5730\u5740\u8ba1\u7b97\u516c\u5f0f\uff0c\u7d22\u5f15\u672c\u8d28\u4e0a\u8868\u793a\u7684\u662f\u5185\u5b58\u5730\u5740\u504f\u79fb\u91cf\uff0c\u9996\u4e2a\u5143\u7d20\u7684\u5730\u5740\u504f\u79fb\u91cf\u662f \\(0\\) \uff0c\u90a3\u4e48\u7d22\u5f15\u662f \\(0\\) \u4e5f\u5c31\u5f88\u81ea\u7136\u4e86\u3002

\u8bbf\u95ee\u5143\u7d20\u7684\u9ad8\u6548\u6027\u5e26\u6765\u4e86\u8bb8\u591a\u4fbf\u5229\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u5185\u968f\u673a\u83b7\u53d6\u4e00\u4e2a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int[] nums) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = ThreadLocalRandom.current().\nnextInt(0, nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.cpp
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int* nums, int size) {\n// \u5728\u533a\u95f4 [0, size) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = rand() % size;\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.py
def random_access(nums: List[int]) -> int:\n\"\"\" \u968f\u673a\u8bbf\u95ee\u5143\u7d20 \"\"\"\n# \u5728\u533a\u95f4 [0, len(nums)-1] \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nrandom_index = random.randint(0, len(nums) - 1)\n# \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nrandom_num = nums[random_index]\nreturn random_num\n
array.go
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunc randomAccess(nums []int) (randomNum int) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nrandomIndex := rand.Intn(len(nums))\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nrandomNum = nums[randomIndex]\nreturn\n}\n
array.js
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunction randomAccess(nums) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nconst random_index = Math.floor(Math.random() * nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nconst random_num = nums[random_index];\nreturn random_num;\n}\n
array.ts
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunction randomAccess(nums: number[]): number {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nconst random_index = Math.floor(Math.random() * nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nconst random_num = nums[random_index];\nreturn random_num;\n}\n
array.c
[class]{}-[func]{randomAccess}\n
array.cs
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int[] nums)\n{\nRandom random = new();\n// \u5728\u533a\u95f4 [0, nums.Length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = random.Next(nums.Length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.swift
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunc randomAccess(nums: [Int]) -> Int {\n// \u5728\u533a\u95f4 [0, nums.count) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nlet randomIndex = nums.indices.randomElement()!\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nlet randomNum = nums[randomIndex]\nreturn randomNum\n}\n
array.zig
// \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20\nfn randomAccess(nums: []i32) i32 {\n// \u5728\u533a\u95f4 [0, nums.len) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6574\u6570\nvar randomIndex = std.crypto.random.intRangeLessThan(usize, 0, nums.len);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nvar randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
"},{"location":"chapter_array_and_linkedlist/array/#412","title":"4.1.2. \u00a0 \u6570\u7ec4\u7f3a\u70b9","text":"

\u6570\u7ec4\u5728\u521d\u59cb\u5316\u540e\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u7531\u4e8e\u7cfb\u7edf\u65e0\u6cd5\u4fdd\u8bc1\u6570\u7ec4\u4e4b\u540e\u7684\u5185\u5b58\u7a7a\u95f4\u662f\u53ef\u7528\u7684\uff0c\u56e0\u6b64\u6570\u7ec4\u957f\u5ea6\u65e0\u6cd5\u6269\u5c55\u3002\u800c\u82e5\u5e0c\u671b\u6269\u5bb9\u6570\u7ec4\uff0c\u5219\u9700\u65b0\u5efa\u4e00\u4e2a\u6570\u7ec4\uff0c\u7136\u540e\u628a\u539f\u6570\u7ec4\u5143\u7d20\u4f9d\u6b21\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\uff0c\u5728\u6570\u7ec4\u5f88\u5927\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd9\u662f\u975e\u5e38\u8017\u65f6\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint[] extend(int[] nums, int enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint[] res = new int[nums.length + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.cpp
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint* extend(int* nums, int size, int enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint* res = new int[size + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < size; i++) {\nres[i] = nums[i];\n}\n// \u91ca\u653e\u5185\u5b58\ndelete[] nums;\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.py
def extend(nums: List[int], enlarge: int) -> List[int]:\n\"\"\" \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 \"\"\"\n# \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nres = [0] * (len(nums) + enlarge)\n# \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i in range(len(nums)):\nres[i] = nums[i]\n# \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n
array.go
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nfunc extend(nums []int, enlarge int) []int {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nres := make([]int, len(nums)+enlarge)\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i, num := range nums {\nres[i] = num\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n}\n
array.js
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\n// \u8bf7\u6ce8\u610f\uff0cJavaScript \u7684 Array \u662f\u52a8\u6001\u6570\u7ec4\uff0c\u53ef\u4ee5\u76f4\u63a5\u6269\u5c55\n// \u4e3a\u4e86\u65b9\u4fbf\u5b66\u4e60\uff0c\u672c\u51fd\u6570\u5c06 Array \u770b\u4f5c\u662f\u957f\u5ea6\u4e0d\u53ef\u53d8\u7684\u6570\u7ec4\nfunction extend(nums, enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nconst res = new Array(nums.length + enlarge).fill(0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.ts
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\n// \u8bf7\u6ce8\u610f\uff0cTypeScript \u7684 Array \u662f\u52a8\u6001\u6570\u7ec4\uff0c\u53ef\u4ee5\u76f4\u63a5\u6269\u5c55\n// \u4e3a\u4e86\u65b9\u4fbf\u5b66\u4e60\uff0c\u672c\u51fd\u6570\u5c06 Array \u770b\u4f5c\u662f\u957f\u5ea6\u4e0d\u53ef\u53d8\u7684\u6570\u7ec4\nfunction extend(nums: number[], enlarge: number): number[] {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nconst res = new Array(nums.length + enlarge).fill(0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.c
[class]{}-[func]{extend}\n
array.cs
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint[] extend(int[] nums, int enlarge)\n{\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint[] res = new int[nums.Length + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.swift
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nfunc extend(nums: [Int], enlarge: Int) -> [Int] {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nvar res = Array(repeating: 0, count: nums.count + enlarge)\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i in nums.indices {\nres[i] = nums[i]\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n}\n
array.zig
// \u6269\u5c55\u6570\u7ec4\u957f\u5ea6\nfn extend(mem_allocator: std.mem.Allocator, nums: []i32, enlarge: usize) ![]i32 {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nvar res = try mem_allocator.alloc(i32, nums.len + enlarge);\nstd.mem.set(i32, res, 0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nstd.mem.copy(i32, res, nums);\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n

\u6570\u7ec4\u4e2d\u63d2\u5165\u6216\u5220\u9664\u5143\u7d20\u6548\u7387\u4f4e\u4e0b\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u5728\u6570\u7ec4\u4e2d\u95f4\u63d2\u5165\u4e00\u4e2a\u5143\u7d20\uff0c\u7531\u4e8e\u6570\u7ec4\u5143\u7d20\u5728\u5185\u5b58\u4e2d\u662f\u201c\u7d27\u6328\u7740\u7684\u201d\uff0c\u5b83\u4eec\u4e4b\u95f4\u6ca1\u6709\u7a7a\u95f4\u518d\u653e\u4efb\u4f55\u6570\u636e\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u4e0d\u5f97\u4e0d\u5c06\u6b64\u7d22\u5f15\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u7136\u540e\u518d\u628a\u5143\u7d20\u8d4b\u503c\u7ed9\u8be5\u7d22\u5f15\u3002

Fig. \u6570\u7ec4\u63d2\u5165\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#Swift array.java
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int[] nums, int num, int index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.cpp
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int* nums, int size, int num, int index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = size - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.py
def insert(nums: List[int], num: int, index: int) -> None:\n\"\"\" \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num \"\"\"\n# \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i in range(len(nums) - 1, index, -1):\nnums[i] = nums[i - 1]\n# \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n
array.go
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunc insert(nums []int, num int, index int) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i := len(nums) - 1; i > index; i-- {\nnums[i] = nums[i-1]\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n}\n
array.js
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunction insert(nums, num, index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.ts
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunction insert(nums: number[], num: number, index: number): void {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.c
[class]{}-[func]{insert}\n
array.cs
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int[] nums, int num, int index)\n{\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = nums.Length - 1; i > index; i--)\n{\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.swift
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunc insert(nums: inout [Int], num: Int, index: Int) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i in sequence(first: nums.count - 1, next: { $0 > index + 1 ? $0 - 1 : nil }) {\nnums[i] = nums[i - 1]\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n}\n

\u5220\u9664\u5143\u7d20\u4e5f\u662f\u7c7b\u4f3c\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u5220\u9664\u7d22\u5f15 \\(i\\) \u5904\u7684\u5143\u7d20\uff0c\u5219\u9700\u8981\u628a\u7d22\u5f15 \\(i\\) \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5220\u9664\u5143\u7d20\u540e\uff0c\u539f\u5148\u672b\u5c3e\u7684\u5143\u7d20\u53d8\u5f97\u201c\u65e0\u610f\u4e49\u201d\u4e86\uff0c\u6211\u4eec\u65e0\u9700\u7279\u610f\u53bb\u4fee\u6539\u5b83\u3002

Fig. \u6570\u7ec4\u5220\u9664\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int[] nums, int index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.cpp
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int* nums, int size, int index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < size - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.py
def remove(nums: List[int], index: int) -> None:\n\"\"\" \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 \"\"\"\n# \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i in range(index, len(nums) - 1):\nnums[i] = nums[i + 1]\n
array.go
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunc remove(nums []int, index int) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i := index; i < len(nums)-1; i++ {\nnums[i] = nums[i+1]\n}\n}\n
array.js
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunction remove(nums, index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.ts
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunction remove(nums: number[], index: number): void {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.c
[class]{}-[func]{removeItem}\n
array.cs
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int[] nums, int index)\n{\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < nums.Length - 1; i++)\n{\nnums[i] = nums[i + 1];\n}\n}\n
array.swift
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunc remove(nums: inout [Int], index: Int) {\nlet count = nums.count\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i in sequence(first: index, next: { $0 < count - 1 - 1 ? $0 + 1 : nil }) {\nnums[i] = nums[i + 1]\n}\n}\n
array.zig
// \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20\nfn remove(nums: []i32, index: usize) void {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nvar i = index;\nwhile (i < nums.len - 1) : (i += 1) {\nnums[i] = nums[i + 1];\n}\n}\n

\u603b\u7ed3\u6765\u770b\uff0c\u6570\u7ec4\u7684\u63d2\u5165\u4e0e\u5220\u9664\u64cd\u4f5c\u6709\u4ee5\u4e0b\u7f3a\u70b9\uff1a

  • \u65f6\u95f4\u590d\u6742\u5ea6\u9ad8\uff1a\u6570\u7ec4\u7684\u63d2\u5165\u548c\u5220\u9664\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u4e3a \\(O(N)\\) \uff0c\u5176\u4e2d \\(N\\) \u4e3a\u6570\u7ec4\u957f\u5ea6\u3002
  • \u4e22\u5931\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u7684\u957f\u5ea6\u4e0d\u53ef\u53d8\uff0c\u56e0\u6b64\u5728\u63d2\u5165\u5143\u7d20\u540e\uff0c\u8d85\u51fa\u6570\u7ec4\u957f\u5ea6\u8303\u56f4\u7684\u5143\u7d20\u4f1a\u88ab\u4e22\u5931\u3002
  • \u5185\u5b58\u6d6a\u8d39\uff1a\u6211\u4eec\u4e00\u822c\u4f1a\u521d\u59cb\u5316\u4e00\u4e2a\u6bd4\u8f83\u957f\u7684\u6570\u7ec4\uff0c\u53ea\u7528\u524d\u9762\u4e00\u90e8\u5206\uff0c\u8fd9\u6837\u5728\u63d2\u5165\u6570\u636e\u65f6\uff0c\u4e22\u5931\u7684\u672b\u5c3e\u5143\u7d20\u90fd\u662f\u6211\u4eec\u4e0d\u5173\u5fc3\u7684\uff0c\u4f46\u8fd9\u6837\u505a\u540c\u65f6\u4e5f\u4f1a\u9020\u6210\u5185\u5b58\u7a7a\u95f4\u7684\u6d6a\u8d39\u3002
"},{"location":"chapter_array_and_linkedlist/array/#413","title":"4.1.3. \u00a0 \u6570\u7ec4\u5e38\u7528\u64cd\u4f5c","text":"

\u6570\u7ec4\u904d\u5386\u3002\u4ee5\u4e0b\u4ecb\u7ecd\u4e24\u79cd\u5e38\u7528\u7684\u904d\u5386\u65b9\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int[] nums) {\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (int num : nums) {\ncount++;\n}\n}\n
array.cpp
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int* nums, int size) {\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < size; i++) {\ncount++;\n}\n}\n
array.py
def traverse(nums: List[int]) -> None:\n\"\"\" \u904d\u5386\u6570\u7ec4 \"\"\"\ncount = 0\n# \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor i in range(len(nums)):\ncount += 1\n# \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor num in nums:\ncount += 1\n
array.go
/* \u904d\u5386\u6570\u7ec4 */\nfunc traverse(nums []int) {\ncount := 0\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor i := 0; i < len(nums); i++ {\ncount++\n}\ncount = 0\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor range nums {\ncount++\n}\n}\n
array.js
/* \u904d\u5386\u6570\u7ec4 */\nfunction traverse(nums) {\nlet count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (let num of nums) {\ncount += 1;\n}\n}\n
array.ts
/* \u904d\u5386\u6570\u7ec4 */\nfunction traverse(nums: number[]): void {\nlet count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (let num of nums) {\ncount += 1;\n}\n}\n
array.c
[class]{}-[func]{traverse}\n
array.cs
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int[] nums)\n{\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nforeach (int num in nums)\n{\ncount++;\n}\n}\n
array.swift
/* \u904d\u5386\u6570\u7ec4 */\nfunc traverse(nums: [Int]) {\nvar count = 0\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor _ in nums.indices {\ncount += 1\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor _ in nums {\ncount += 1\n}\n}\n
array.zig
// \u904d\u5386\u6570\u7ec4\nfn traverse(nums: []i32) void {\nvar count: i32 = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nvar i: i32 = 0;\nwhile (i < nums.len) : (i += 1) {\ncount += 1;\n}\ncount = 0;\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (nums) |_| {\ncount += 1;\n}\n}\n

\u6570\u7ec4\u67e5\u627e\u3002\u901a\u8fc7\u904d\u5386\u6570\u7ec4\uff0c\u67e5\u627e\u6570\u7ec4\u5185\u7684\u6307\u5b9a\u5143\u7d20\uff0c\u5e76\u8f93\u51fa\u5bf9\u5e94\u7d22\u5f15\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int[] nums, int target) {\nfor (int i = 0; i < nums.length; i++) {\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.cpp
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int* nums, int size, int target) {\nfor (int i = 0; i < size; i++) {\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.py
def find(nums: List[int], target: int) -> int:\n\"\"\" \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 \"\"\"\nfor i in range(len(nums)):\nif nums[i] == target:\nreturn i\nreturn -1\n
array.go
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunc find(nums []int, target int) (index int) {\nindex = -1\nfor i := 0; i < len(nums); i++ {\nif nums[i] == target {\nindex = i\nbreak\n}\n}\nreturn\n}\n
array.js
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunction find(nums, target) {\nfor (let i = 0; i < nums.length; i++) {\nif (nums[i] == target) return i;\n}\nreturn -1;\n}\n
array.ts
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunction find(nums: number[], target: number): number {\nfor (let i = 0; i < nums.length; i++) {\nif (nums[i] === target) {\nreturn i;\n}\n}\nreturn -1;\n}\n
array.c
[class]{}-[func]{find}\n
array.cs
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int[] nums, int target)\n{\nfor (int i = 0; i < nums.Length; i++)\n{\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.swift
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunc find(nums: [Int], target: Int) -> Int {\nfor i in nums.indices {\nif nums[i] == target {\nreturn i\n}\n}\nreturn -1\n}\n
array.zig
// \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20\nfn find(nums: []i32, target: i32) i32 {\nfor (nums) |num, i| {\nif (num == target) return @intCast(i32, i);\n}\nreturn -1;\n}\n
"},{"location":"chapter_array_and_linkedlist/array/#414","title":"4.1.4. \u00a0 \u6570\u7ec4\u5178\u578b\u5e94\u7528","text":"

\u968f\u673a\u8bbf\u95ee\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u968f\u673a\u62bd\u53d6\u4e00\u4e9b\u6837\u672c\uff0c\u90a3\u4e48\u53ef\u4ee5\u7528\u6570\u7ec4\u5b58\u50a8\uff0c\u5e76\u751f\u6210\u4e00\u4e2a\u968f\u673a\u5e8f\u5217\uff0c\u6839\u636e\u7d22\u5f15\u5b9e\u73b0\u6837\u672c\u7684\u968f\u673a\u62bd\u53d6\u3002

\u4e8c\u5206\u67e5\u627e\u3002\u4f8b\u5982\u524d\u6587\u67e5\u5b57\u5178\u7684\u4f8b\u5b50\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u5178\u4e2d\u7684\u6240\u6709\u5b57\u6309\u7167\u62fc\u97f3\u987a\u5e8f\u5b58\u50a8\u5728\u6570\u7ec4\u4e2d\uff0c\u7136\u540e\u4f7f\u7528\u4e0e\u65e5\u5e38\u67e5\u7eb8\u8d28\u5b57\u5178\u76f8\u540c\u7684\u201c\u7ffb\u5f00\u4e2d\u95f4\uff0c\u6392\u9664\u4e00\u534a\u201d\u7684\u65b9\u5f0f\uff0c\u6765\u5b9e\u73b0\u4e00\u4e2a\u67e5\u7535\u5b50\u5b57\u5178\u7684\u7b97\u6cd5\u3002

\u6df1\u5ea6\u5b66\u4e60\u3002\u795e\u7ecf\u7f51\u7edc\u4e2d\u5927\u91cf\u4f7f\u7528\u4e86\u5411\u91cf\u3001\u77e9\u9635\u3001\u5f20\u91cf\u4e4b\u95f4\u7684\u7ebf\u6027\u4ee3\u6570\u8fd0\u7b97\uff0c\u8fd9\u4e9b\u6570\u636e\u90fd\u662f\u4ee5\u6570\u7ec4\u7684\u5f62\u5f0f\u6784\u5efa\u7684\u3002\u6570\u7ec4\u662f\u795e\u7ecf\u7f51\u7edc\u7f16\u7a0b\u4e2d\u6700\u5e38\u4f7f\u7528\u7684\u6570\u636e\u7ed3\u6784\u3002

"},{"location":"chapter_array_and_linkedlist/linked_list/","title":"4.2. \u00a0 \u94fe\u8868","text":"

\u5f15\u8a00

\u5185\u5b58\u7a7a\u95f4\u662f\u6240\u6709\u7a0b\u5e8f\u7684\u516c\u5171\u8d44\u6e90\uff0c\u6392\u9664\u5df2\u5360\u7528\u7684\u5185\u5b58\uff0c\u7a7a\u95f2\u5185\u5b58\u5f80\u5f80\u662f\u6563\u843d\u5728\u5185\u5b58\u5404\u5904\u7684\u3002\u6211\u4eec\u77e5\u9053\uff0c\u5b58\u50a8\u6570\u7ec4\u9700\u8981\u5185\u5b58\u7a7a\u95f4\u8fde\u7eed\uff0c\u5f53\u6211\u4eec\u9700\u8981\u7533\u8bf7\u4e00\u4e2a\u5f88\u5927\u7684\u6570\u7ec4\u65f6\uff0c\u7cfb\u7edf\u4e0d\u4e00\u5b9a\u5b58\u5728\u8fd9\u4e48\u5927\u7684\u8fde\u7eed\u5185\u5b58\u7a7a\u95f4\u3002\u800c\u94fe\u8868\u5219\u66f4\u52a0\u7075\u6d3b\uff0c\u4e0d\u9700\u8981\u5185\u5b58\u662f\u8fde\u7eed\u7684\uff0c\u53ea\u8981\u5269\u4f59\u5185\u5b58\u7a7a\u95f4\u5927\u5c0f\u591f\u7528\u5373\u53ef\u3002

\u300c\u94fe\u8868 Linked List\u300d\u662f\u4e00\u79cd\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u5355\u72ec\u7684\u5bf9\u8c61\uff0c\u5404\u4e2a\u5143\u7d20\uff08\u4e00\u822c\u79f0\u4e3a\u7ed3\u70b9\uff09\u4e4b\u95f4\u901a\u8fc7\u6307\u9488\u8fde\u63a5\u3002\u7531\u4e8e\u7ed3\u70b9\u4e2d\u8bb0\u5f55\u4e86\u8fde\u63a5\u5173\u7cfb\uff0c\u56e0\u6b64\u94fe\u8868\u7684\u5b58\u50a8\u65b9\u5f0f\u76f8\u6bd4\u4e8e\u6570\u7ec4\u66f4\u52a0\u7075\u6d3b\uff0c\u7cfb\u7edf\u4e0d\u5fc5\u4fdd\u8bc1\u5185\u5b58\u5730\u5740\u7684\u8fde\u7eed\u6027\u3002

\u94fe\u8868\u7684\u300c\u7ed3\u70b9 Node\u300d\u5305\u542b\u4e24\u9879\u6570\u636e\uff0c\u4e00\u662f\u7ed3\u70b9\u300c\u503c Value\u300d\uff0c\u4e8c\u662f\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u300c\u6307\u9488 Pointer\u300d\uff08\u6216\u79f0\u300c\u5f15\u7528 Reference\u300d\uff09\u3002

Fig. \u94fe\u8868\u5b9a\u4e49\u4e0e\u5b58\u50a8\u65b9\u5f0f

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) { val = x; }  // \u6784\u9020\u51fd\u6570\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;         // \u7ed3\u70b9\u503c\nListNode *next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) : val(x), next(nullptr) {}  // \u6784\u9020\u51fd\u6570\n};\n
\"\"\" \u94fe\u8868\u7ed3\u70b9\u7c7b \"\"\" \nclass ListNode:\ndef __init__(self, val: int):\nself.val: int = val                  # \u7ed3\u70b9\u503c\nself.next: Optional[ListNode] = None # \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype ListNode struct {\nVal  int       // \u7ed3\u70b9\u503c\nNext *ListNode // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n// NewListNode \u6784\u9020\u51fd\u6570\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u94fe\u8868\nfunc NewListNode(val int) *ListNode {\nreturn &ListNode{\nVal:  val,\nNext: nil,\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval;\nnext;\nconstructor(val, next) {\nthis.val = (val === undefined ? 0 : val);       // \u7ed3\u70b9\u503c\nthis.next = (next === undefined ? null : next); // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval: number;\nnext: ListNode | null;\nconstructor(val?: number, next?: ListNode | null) {\nthis.val = val === undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next === undefined ? null : next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;               // \u7ed3\u70b9\u503c\nstruct ListNode *next; // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n};\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode\n{\nint val;         // \u7ed3\u70b9\u503c\nListNode next;   // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\nListNode(int x) => val = x;  //\u6784\u9020\u51fd\u6570\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\ninit(x: Int) { // \u6784\u9020\u51fd\u6570\nval = x\n}\n}\n
// \u94fe\u8868\u7ed3\u70b9\u7c7b\npub fn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = 0, // \u7ed3\u70b9\u503c\nnext: ?*Self = null, // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n// \u6784\u9020\u51fd\u6570\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\n}\n};\n}\n

\u5c3e\u7ed3\u70b9\u6307\u5411\u4ec0\u4e48\uff1f \u6211\u4eec\u4e00\u822c\u5c06\u94fe\u8868\u7684\u6700\u540e\u4e00\u4e2a\u7ed3\u70b9\u79f0\u4e3a\u300c\u5c3e\u7ed3\u70b9\u300d\uff0c\u5176\u6307\u5411\u7684\u662f\u300c\u7a7a\u300d\uff0c\u5728 Java / C++ / Python \u4e2d\u5206\u522b\u8bb0\u4e3a null / nullptr / None \u3002\u5728\u4e0d\u5f15\u8d77\u6b67\u4e49\u4e0b\uff0c\u672c\u4e66\u90fd\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u3002

\u94fe\u8868\u521d\u59cb\u5316\u65b9\u6cd5\u3002\u5efa\u7acb\u94fe\u8868\u5206\u4e3a\u4e24\u6b65\uff0c\u7b2c\u4e00\u6b65\u662f\u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\u5bf9\u8c61\uff0c\u7b2c\u4e8c\u6b65\u662f\u6784\u5efa\u5f15\u7528\u6307\u5411\u5173\u7cfb\u3002\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u4ee5\u4ece\u94fe\u8868\u7684\u9996\u4e2a\u7ed3\u70b9\uff08\u5373\u5934\u7ed3\u70b9\uff09\u51fa\u53d1\uff0c\u8bbf\u95ee\u5176\u4f59\u6240\u6709\u7684\u7ed3\u70b9\u3002

Tip

\u6211\u4eec\u901a\u5e38\u5c06\u5934\u7ed3\u70b9\u5f53\u4f5c\u94fe\u8868\u7684\u4ee3\u79f0\uff0c\u4f8b\u5982\u5934\u7ed3\u70b9 head \u548c\u94fe\u8868 head \u5b9e\u9645\u4e0a\u662f\u540c\u4e49\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode n0 = new ListNode(1);\nListNode n1 = new ListNode(3);\nListNode n2 = new ListNode(2);\nListNode n3 = new ListNode(5);\nListNode n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.cpp
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode* n0 = new ListNode(1);\nListNode* n1 = new ListNode(3);\nListNode* n2 = new ListNode(2);\nListNode* n3 = new ListNode(5);\nListNode* n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0->next = n1;\nn1->next = n2;\nn2->next = n3;\nn3->next = n4;\n
linked_list.py
\"\"\" \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 \"\"\"\n# \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nn0 = ListNode(1)\nn1 = ListNode(3)\nn2 = ListNode(2)\nn3 = ListNode(5)\nn4 = ListNode(4)\n# \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1\nn1.next = n2\nn2.next = n3\nn3.next = n4\n
linked_list.go
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nn0 := NewListNode(1)\nn1 := NewListNode(3)\nn2 := NewListNode(2)\nn3 := NewListNode(5)\nn4 := NewListNode(4)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.Next = n1\nn1.Next = n2\nn2.Next = n3\nn3.Next = n4\n
linked_list.js
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nconst n0 = new ListNode(1);\nconst n1 = new ListNode(3);\nconst n2 = new ListNode(2);\nconst n3 = new ListNode(5);\nconst n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.ts
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nconst n0 = new ListNode(1);\nconst n1 = new ListNode(3);\nconst n2 = new ListNode(2);\nconst n3 = new ListNode(5);\nconst n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.c
\n
linked_list.cs
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode n0 = new ListNode(1);\nListNode n1 = new ListNode(3);\nListNode n2 = new ListNode(2);\nListNode n3 = new ListNode(5);\nListNode n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.swift
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nlet n0 = ListNode(x: 1)\nlet n1 = ListNode(x: 3)\nlet n2 = ListNode(x: 2)\nlet n3 = ListNode(x: 5)\nlet n4 = ListNode(x: 4)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1\nn1.next = n2\nn2.next = n3\nn3.next = n4\n
linked_list.zig
// \u521d\u59cb\u5316\u94fe\u8868\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nvar n0 = inc.ListNode(i32){.val = 1};\nvar n1 = inc.ListNode(i32){.val = 3};\nvar n2 = inc.ListNode(i32){.val = 2};\nvar n3 = inc.ListNode(i32){.val = 5};\nvar n4 = inc.ListNode(i32){.val = 4};\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = &n1;\nn1.next = &n2;\nn2.next = &n3;\nn3.next = &n4;\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#421","title":"4.2.1. \u00a0 \u94fe\u8868\u4f18\u70b9","text":"

\u5728\u94fe\u8868\u4e2d\uff0c\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u7684\u64cd\u4f5c\u6548\u7387\u9ad8\u3002\u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u5728\u94fe\u8868\u4e2d\u95f4\u7684\u4e24\u4e2a\u7ed3\u70b9 A , B \u4e4b\u95f4\u63d2\u5165\u4e00\u4e2a\u65b0\u7ed3\u70b9 P \uff0c\u6211\u4eec\u53ea\u9700\u8981\u6539\u53d8\u4e24\u4e2a\u7ed3\u70b9\u6307\u9488\u5373\u53ef\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u76f8\u6bd4\u6570\u7ec4\u7684\u63d2\u5165\u64cd\u4f5c\u9ad8\u6548\u5f88\u591a\u3002

Fig. \u94fe\u8868\u63d2\u5165\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode n0, ListNode P) {\nListNode n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.cpp
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode* n0, ListNode* P) {\nListNode* n1 = n0->next;\nP->next = n1;\nn0->next = P;\n}\n
linked_list.py
def insert(n0: ListNode, P: ListNode) -> None:\n\"\"\" \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P \"\"\"\nn1 = n0.next\nP.next = n1\nn0.next = P\n
linked_list.go
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunc insertNode(n0 *ListNode, P *ListNode) {\nn1 := n0.Next\nP.Next = n1\nn0.Next = P\n}\n
linked_list.js
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunction insert(n0, P) {\nconst n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.ts
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunction insert(n0: ListNode, P: ListNode): void {\nconst n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.c
[class]{}-[func]{insertNode}\n
linked_list.cs
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode n0, ListNode P)\n{\nListNode? n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.swift
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunc insert(n0: ListNode, P: ListNode) {\nlet n1 = n0.next\nP.next = n1\nn0.next = P\n}\n
linked_list.zig
// \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P\nfn insert(n0: ?*inc.ListNode(i32), P: ?*inc.ListNode(i32)) void {\nvar n1 = n0.?.next;\nP.?.next = n1;\nn0.?.next = P;\n}\n

\u5728\u94fe\u8868\u4e2d\u5220\u9664\u7ed3\u70b9\u4e5f\u5f88\u65b9\u4fbf\uff0c\u53ea\u9700\u8981\u6539\u53d8\u4e00\u4e2a\u7ed3\u70b9\u6307\u9488\u5373\u53ef\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u867d\u7136\u5728\u5b8c\u6210\u5220\u9664\u540e\u7ed3\u70b9 P \u4ecd\u7136\u6307\u5411 n1 \uff0c\u4f46\u5b9e\u9645\u4e0a P \u5df2\u7ecf\u4e0d\u5c5e\u4e8e\u6b64\u94fe\u8868\u4e86\uff0c\u56e0\u4e3a\u904d\u5386\u6b64\u94fe\u8868\u662f\u65e0\u6cd5\u8bbf\u95ee\u5230 P \u7684\u3002

Fig. \u94fe\u8868\u5220\u9664\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode n0) {\nif (n0.next == null)\nreturn;\n// n0 -> P -> n1\nListNode P = n0.next;\nListNode n1 = P.next;\nn0.next = n1;\n}\n
linked_list.cpp
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode* n0) {\nif (n0->next == nullptr)\nreturn;\n// n0 -> P -> n1\nListNode* P = n0->next;\nListNode* n1 = P->next;\nn0->next = n1;\n// \u91ca\u653e\u5185\u5b58\ndelete P;\n}\n
linked_list.py
def remove(n0: ListNode) -> None:\n\"\"\" \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 \"\"\"\nif not n0.next:\nreturn\n# n0 -> P -> n1\nP = n0.next\nn1 = P.next\nn0.next = n1\n
linked_list.go
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc removeNode(n0 *ListNode) {\nif n0.Next == nil {\nreturn\n}\n// n0 -> P -> n1\nP := n0.Next\nn1 := P.Next\nn0.Next = n1\n}\n
linked_list.js
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction remove(n0) {\nif (!n0.next)\nreturn;\n// n0 -> P -> n1\nconst P = n0.next;\nconst n1 = P.next;\nn0.next = n1;\n}\n
linked_list.ts
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction remove(n0: ListNode): void {\nif (!n0.next) {\nreturn;\n}\n// n0 -> P -> n1\nconst P = n0.next;\nconst n1 = P.next;\nn0.next = n1;\n}\n
linked_list.c
[class]{}-[func]{removeNode}\n
linked_list.cs
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode n0)\n{\nif (n0.next == null)\nreturn;\n// n0 -> P -> n1\nListNode P = n0.next;\nListNode? n1 = P.next;\nn0.next = n1;\n}\n
linked_list.swift
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc remove(n0: ListNode) {\nif n0.next == nil {\nreturn\n}\n// n0 -> P -> n1\nlet P = n0.next\nlet n1 = P?.next\nn0.next = n1\nP?.next = nil\n}\n
linked_list.zig
// \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9\nfn remove(n0: ?*inc.ListNode(i32)) void {\nif (n0.?.next == null) return;\n// n0 -> P -> n1\nvar P = n0.?.next;\nvar n1 = P.?.next;\nn0.?.next = n1;\n}\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#422","title":"4.2.2. \u00a0 \u94fe\u8868\u7f3a\u70b9","text":"

\u94fe\u8868\u8bbf\u95ee\u7ed3\u70b9\u6548\u7387\u4f4e\u3002\u4e0a\u8282\u63d0\u5230\uff0c\u6570\u7ec4\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u4e0b\u8bbf\u95ee\u4efb\u610f\u5143\u7d20\uff0c\u4f46\u94fe\u8868\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u4efb\u610f\u7ed3\u70b9\u3002\u8fd9\u662f\u56e0\u4e3a\u8ba1\u7b97\u673a\u9700\u8981\u4ece\u5934\u7ed3\u70b9\u51fa\u53d1\uff0c\u4e00\u4e2a\u4e00\u4e2a\u5730\u5411\u540e\u904d\u5386\u5230\u76ee\u6807\u7ed3\u70b9\u3002\u4f8b\u5982\uff0c\u5018\u82e5\u60f3\u8981\u8bbf\u95ee\u94fe\u8868\u7d22\u5f15\u4e3a index \uff08\u5373\u7b2c index + 1 \u4e2a\uff09\u7684\u7ed3\u70b9\uff0c\u90a3\u4e48\u9700\u8981 index \u6b21\u8bbf\u95ee\u64cd\u4f5c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode access(ListNode head, int index) {\nfor (int i = 0; i < index; i++) {\nif (head == null)\nreturn null;\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.cpp
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode* access(ListNode* head, int index) {\nfor (int i = 0; i < index; i++) {\nif (head == nullptr)\nreturn nullptr;\nhead = head->next;\n}\nreturn head;\n}\n
linked_list.py
def access(head: ListNode, index: int) -> Optional[ListNode]:\n\"\"\" \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 \"\"\"\nfor _ in range(index):\nif not head:\nreturn None\nhead = head.next\nreturn head\n
linked_list.go
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunc access(head *ListNode, index int) *ListNode {\nfor i := 0; i < index; i++ {\nif head == nil {\nreturn nil\n}\nhead = head.Next\n}\nreturn head\n}\n
linked_list.js
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunction access(head, index) {\nfor (let i = 0; i < index; i++) {\nif (!head) {\nreturn null;\n}\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.ts
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunction access(head: ListNode | null, index: number): ListNode | null {\nfor (let i = 0; i < index; i++) {\nif (!head) {\nreturn null;\n}\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.c
[class]{}-[func]{access}\n
linked_list.cs
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode? access(ListNode head, int index)\n{\nfor (int i = 0; i < index; i++)\n{\nif (head == null)\nreturn null;\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.swift
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunc access(head: ListNode, index: Int) -> ListNode? {\nvar head: ListNode? = head\nfor _ in 0 ..< index {\nif head == nil {\nreturn nil\n}\nhead = head?.next\n}\nreturn head\n}\n
linked_list.zig
// \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9\nfn access(node: ?*inc.ListNode(i32), index: i32) ?*inc.ListNode(i32) {\nvar head = node;\nvar i: i32 = 0;\nwhile (i < index) : (i += 1) {\nhead = head.?.next;\nif (head == null) return null;\n}\nreturn head;\n}\n

\u94fe\u8868\u7684\u5185\u5b58\u5360\u7528\u591a\u3002\u94fe\u8868\u4ee5\u7ed3\u70b9\u4e3a\u5355\u4f4d\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u9664\u4e86\u4fdd\u5b58\u503c\u5916\uff0c\u8fd8\u9700\u989d\u5916\u4fdd\u5b58\u6307\u9488\uff08\u5f15\u7528\uff09\u3002\u8fd9\u610f\u5473\u7740\u540c\u6837\u6570\u636e\u91cf\u4e0b\uff0c\u94fe\u8868\u6bd4\u6570\u7ec4\u9700\u8981\u5360\u7528\u66f4\u591a\u5185\u5b58\u7a7a\u95f4\u3002

"},{"location":"chapter_array_and_linkedlist/linked_list/#423","title":"4.2.3. \u00a0 \u94fe\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u904d\u5386\u94fe\u8868\u67e5\u627e\u3002\u904d\u5386\u94fe\u8868\uff0c\u67e5\u627e\u94fe\u8868\u5185\u503c\u4e3a target \u7684\u7ed3\u70b9\uff0c\u8f93\u51fa\u7ed3\u70b9\u5728\u94fe\u8868\u4e2d\u7684\u7d22\u5f15\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode head, int target) {\nint index = 0;\nwhile (head != null) {\nif (head.val == target)\nreturn index;\nhead = head.next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.cpp
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode* head, int target) {\nint index = 0;\nwhile (head != nullptr) {\nif (head->val == target)\nreturn index;\nhead = head->next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.py
def find(head: ListNode, target: int) -> int:\n\"\"\" \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 \"\"\"\nindex = 0\nwhile head:\nif head.val == target:\nreturn index\nhead = head.next\nindex += 1\nreturn -1\n
linked_list.go
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc findNode(head *ListNode, target int) int {\nindex := 0\nfor head != nil {\nif head.Val == target {\nreturn index\n}\nhead = head.Next\nindex++\n}\nreturn -1\n}\n
linked_list.js
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction find(head, target) {\nlet index = 0;\nwhile (head !== null) {\nif (head.val === target) {\nreturn index;\n}\nhead = head.next;\nindex += 1;\n}\nreturn -1;\n}\n
linked_list.ts
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction find(head: ListNode | null, target: number): number {\nlet index = 0;\nwhile (head !== null) {\nif (head.val === target) {\nreturn index;\n}\nhead = head.next;\nindex += 1;\n}\nreturn -1;\n}\n
linked_list.c
[class]{}-[func]{findNode}\n
linked_list.cs
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode head, int target)\n{\nint index = 0;\nwhile (head != null)\n{\nif (head.val == target)\nreturn index;\nhead = head.next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.swift
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc find(head: ListNode, target: Int) -> Int {\nvar head: ListNode? = head\nvar index = 0\nwhile head != nil {\nif head?.val == target {\nreturn index\n}\nhead = head?.next\nindex += 1\n}\nreturn -1\n}\n
linked_list.zig
// \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9\nfn find(node: ?*inc.ListNode(i32), target: i32) i32 {\nvar head = node;\nvar index: i32 = 0;\nwhile (head != null) {\nif (head.?.val == target) return index;\nhead = head.?.next;\nindex += 1;\n}\nreturn -1;\n}\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#424","title":"4.2.4. \u00a0 \u5e38\u89c1\u94fe\u8868\u7c7b\u578b","text":"

\u5355\u5411\u94fe\u8868\u3002\u5373\u4e0a\u8ff0\u4ecb\u7ecd\u7684\u666e\u901a\u94fe\u8868\u3002\u5355\u5411\u94fe\u8868\u7684\u7ed3\u70b9\u6709\u300c\u503c\u300d\u548c\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u300c\u6307\u9488\uff08\u5f15\u7528\uff09\u300d\u4e24\u9879\u6570\u636e\u3002\u6211\u4eec\u5c06\u9996\u4e2a\u7ed3\u70b9\u79f0\u4e3a\u5934\u7ed3\u70b9\uff0c\u5c3e\u7ed3\u70b9\u6307\u5411 null \u3002

\u73af\u5f62\u94fe\u8868\u3002\u5982\u679c\u6211\u4eec\u4ee4\u5355\u5411\u94fe\u8868\u7684\u5c3e\u7ed3\u70b9\u6307\u5411\u5934\u7ed3\u70b9\uff08\u5373\u9996\u5c3e\u76f8\u63a5\uff09\uff0c\u5219\u5f97\u5230\u4e00\u4e2a\u73af\u5f62\u94fe\u8868\u3002\u5728\u73af\u5f62\u94fe\u8868\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u4efb\u610f\u7ed3\u70b9\u770b\u4f5c\u662f\u5934\u7ed3\u70b9\u3002

\u53cc\u5411\u94fe\u8868\u3002\u5355\u5411\u94fe\u8868\u4ec5\u8bb0\u5f55\u4e86\u4e00\u4e2a\u65b9\u5411\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\uff0c\u5728\u53cc\u5411\u94fe\u8868\u7684\u7ed3\u70b9\u5b9a\u4e49\u4e2d\uff0c\u540c\u65f6\u6709\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\uff08\u540e\u7ee7\u7ed3\u70b9\uff09\u548c\u4e0a\u4e00\u7ed3\u70b9\uff08\u524d\u9a71\u7ed3\u70b9\uff09\u7684\u300c\u6307\u9488\uff08\u5f15\u7528\uff09\u300d\u3002\u53cc\u5411\u94fe\u8868\u76f8\u5bf9\u4e8e\u5355\u5411\u94fe\u8868\u66f4\u52a0\u7075\u6d3b\uff0c\u5373\u53ef\u4ee5\u671d\u4e24\u4e2a\u65b9\u5411\u904d\u5386\u94fe\u8868\uff0c\u4f46\u4e5f\u9700\u8981\u5360\u7528\u66f4\u591a\u7684\u5185\u5b58\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) { val = x; }  // \u6784\u9020\u51fd\u6570\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;         // \u7ed3\u70b9\u503c\nListNode *next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode *prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) : val(x), next(nullptr), prev(nullptr) {}  // \u6784\u9020\u51fd\u6570\n};\n
\"\"\" \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b \"\"\" \nclass ListNode:\ndef __init__(self, val: int):\nself.val: int = val                   # \u7ed3\u70b9\u503c\nself.next: Optional[ListNode] = None  # \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nself.prev: Optional[ListNode] = None  # \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype DoublyListNode struct {\nVal  int             // \u7ed3\u70b9\u503c\nNext *DoublyListNode // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nPrev *DoublyListNode // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n// NewDoublyListNode \u521d\u59cb\u5316\nfunc NewDoublyListNode(val int) *DoublyListNode {\nreturn &DoublyListNode{\nVal:  val,\nNext: nil,\nPrev: nil,\n}\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval;\nnext;\nprev;\nconstructor(val, next) {\nthis.val = val  ===  undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next  ===  undefined ? null : next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nthis.prev = prev  ===  undefined ? null : prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval: number;\nnext: ListNode | null;\nprev: ListNode | null;\nconstructor(val?: number, next?: ListNode | null, prev?: ListNode | null) {\nthis.val = val  ===  undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next  ===  undefined ? null : next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nthis.prev = prev  ===  undefined ? null : prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n}\n
\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) => val = x;  // \u6784\u9020\u51fd\u6570\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nvar prev: ListNode? // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\ninit(x: Int) { // \u6784\u9020\u51fd\u6570\nval = x\n}\n}\n
// \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b\npub fn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = 0, // \u7ed3\u70b9\u503c\nnext: ?*Self = null, // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nprev: ?*Self = null, // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n// \u6784\u9020\u51fd\u6570\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\nself.prev = null;\n}\n};\n}\n

Fig. \u5e38\u89c1\u94fe\u8868\u79cd\u7c7b

"},{"location":"chapter_array_and_linkedlist/list/","title":"4.3. \u00a0 \u5217\u8868","text":"

\u7531\u4e8e\u957f\u5ea6\u4e0d\u53ef\u53d8\uff0c\u6570\u7ec4\u7684\u5b9e\u7528\u6027\u5927\u5927\u964d\u4f4e\u3002\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e8b\u5148\u5e76\u4e0d\u77e5\u9053\u4f1a\u8f93\u5165\u591a\u5c11\u6570\u636e\uff0c\u8fd9\u5c31\u4e3a\u6570\u7ec4\u957f\u5ea6\u7684\u9009\u62e9\u5e26\u6765\u4e86\u5f88\u5927\u56f0\u96be\u3002\u957f\u5ea6\u9009\u5c0f\u4e86\uff0c\u9700\u8981\u5728\u6dfb\u52a0\u6570\u636e\u4e2d\u9891\u7e41\u5730\u6269\u5bb9\u6570\u7ec4\uff1b\u957f\u5ea6\u9009\u5927\u4e86\uff0c\u53c8\u9020\u6210\u5185\u5b58\u7a7a\u95f4\u7684\u6d6a\u8d39\u3002

\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bde\u751f\u4e86\u4e00\u79cd\u88ab\u79f0\u4e3a\u300c\u5217\u8868 List\u300d\u7684\u6570\u636e\u7ed3\u6784\u3002\u5217\u8868\u53ef\u4ee5\u88ab\u7406\u89e3\u4e3a\u957f\u5ea6\u53ef\u53d8\u7684\u6570\u7ec4\uff0c\u56e0\u6b64\u4e5f\u5e38\u88ab\u79f0\u4e3a\u300c\u52a8\u6001\u6570\u7ec4 Dynamic Array\u300d\u3002\u5217\u8868\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\uff0c\u7ee7\u627f\u4e86\u6570\u7ec4\u7684\u4f18\u70b9\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u5728\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u5b9e\u65f6\u6269\u5bb9\u3002\u5728\u5217\u8868\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u7531\u5730\u6dfb\u52a0\u5143\u7d20\uff0c\u800c\u4e0d\u7528\u62c5\u5fc3\u8d85\u8fc7\u5bb9\u91cf\u9650\u5236\u3002

"},{"location":"chapter_array_and_linkedlist/list/#431","title":"4.3.1. \u00a0 \u5217\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u521d\u59cb\u5316\u5217\u8868\u3002\u6211\u4eec\u901a\u5e38\u4f1a\u4f7f\u7528\u5230\u201c\u65e0\u521d\u59cb\u503c\u201d\u548c\u201c\u6709\u521d\u59cb\u503c\u201d\u7684\u4e24\u79cd\u521d\u59cb\u5316\u65b9\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nList<Integer> list1 = new ArrayList<>();\n// \u6709\u521d\u59cb\u503c\uff08\u6ce8\u610f\u6570\u7ec4\u7684\u5143\u7d20\u7c7b\u578b\u9700\u4e3a int[] \u7684\u5305\u88c5\u7c7b Integer[]\uff09\nInteger[] numbers = new Integer[] { 1, 3, 2, 5, 4 };\nList<Integer> list = new ArrayList<>(Arrays.asList(numbers));\n
list.cpp
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u9700\u6ce8\u610f\uff0cC++ \u4e2d vector \u5373\u662f\u672c\u6587\u63cf\u8ff0\u7684 list\n// \u65e0\u521d\u59cb\u503c\nvector<int> list1;\n// \u6709\u521d\u59cb\u503c\nvector<int> list = { 1, 3, 2, 5, 4 };\n
list.py
\"\"\" \u521d\u59cb\u5316\u5217\u8868 \"\"\"\n# \u65e0\u521d\u59cb\u503c\nlist1: List[int] = []\n# \u6709\u521d\u59cb\u503c\nlist: List[int] = [1, 3, 2, 5, 4]\n
list_test.go
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nlist1 := []int\n// \u6709\u521d\u59cb\u503c\nlist := []int{1, 3, 2, 5, 4}\n
list.js
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nconst list1 = [];\n// \u6709\u521d\u59cb\u503c\nconst list = [1, 3, 2, 5, 4];\n
list.ts
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nconst list1: number[] = [];\n// \u6709\u521d\u59cb\u503c\nconst list: number[] = [1, 3, 2, 5, 4];\n
list.c
\n
list.cs
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nList<int> list1 = new ();\n// \u6709\u521d\u59cb\u503c\nint[] numbers = new int[] { 1, 3, 2, 5, 4 };\nList<int> list = numbers.ToList();\n
list.swift
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nlet list1: [Int] = []\n// \u6709\u521d\u59cb\u503c\nvar list = [1, 3, 2, 5, 4]\n
list.zig
// \u521d\u59cb\u5316\u5217\u8868\nvar list = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer list.deinit();\ntry list.appendSlice(&[_]i32{ 1, 3, 2, 5, 4 });\n

\u8bbf\u95ee\u4e0e\u66f4\u65b0\u5143\u7d20\u3002\u5217\u8868\u7684\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u662f\u6570\u7ec4\uff0c\u56e0\u6b64\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u5185\u8bbf\u95ee\u4e0e\u66f4\u65b0\u5143\u7d20\uff0c\u6548\u7387\u5f88\u9ad8\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list.get(1);  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist.set(1, 0);  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.cpp
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.py
\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\nnum: int = list[1]  # \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n\"\"\" \u66f4\u65b0\u5143\u7d20 \"\"\"\nlist[1] = 0    # \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list_test.go
/* \u8bbf\u95ee\u5143\u7d20 */\nnum := list[1]  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0     // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.js
/* \u8bbf\u95ee\u5143\u7d20 */\nconst num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.ts
/* \u8bbf\u95ee\u5143\u7d20 */\nconst num: number = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.c
\n
list.cs
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.swift
/* \u8bbf\u95ee\u5143\u7d20 */\nlet num = list[1] // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0 // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.zig
// \u8bbf\u95ee\u5143\u7d20\nvar num = list.items[1]; // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n// \u66f4\u65b0\u5143\u7d20\nlist.items[1] = 0; // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0  \n

\u5728\u5217\u8868\u4e2d\u6dfb\u52a0\u3001\u63d2\u5165\u3001\u5220\u9664\u5143\u7d20\u3002\u76f8\u5bf9\u4e8e\u6570\u7ec4\uff0c\u5217\u8868\u53ef\u4ee5\u81ea\u7531\u5730\u6dfb\u52a0\u4e0e\u5220\u9664\u5143\u7d20\u3002\u5728\u5217\u8868\u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u4f46\u662f\u63d2\u5165\u4e0e\u5220\u9664\u5143\u7d20\u7684\u6548\u7387\u4ecd\u4e0e\u6570\u7ec4\u4e00\u6837\u4f4e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u6e05\u7a7a\u5217\u8868 */\nlist.clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.add(1);\nlist.add(3);\nlist.add(2);\nlist.add(5);\nlist.add(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.add(3, 6);  // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.remove(3);  // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.cpp
/* \u6e05\u7a7a\u5217\u8868 */\nlist.clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push_back(1);\nlist.push_back(3);\nlist.push_back(2);\nlist.push_back(5);\nlist.push_back(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.insert(list.begin() + 3, 6);  // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.erase(list.begin() + 3);      // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.py
\"\"\" \u6e05\u7a7a\u5217\u8868 \"\"\"\nlist.clear()\n\"\"\" \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 \"\"\"\nlist.append(1)\nlist.append(3)\nlist.append(2)\nlist.append(5)\nlist.append(4)\n\"\"\" \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 \"\"\"\nlist.insert(3, 6)  # \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n\"\"\" \u5220\u9664\u5143\u7d20 \"\"\"\nlist.pop(3)        # \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list_test.go
/* \u6e05\u7a7a\u5217\u8868 */\nlist = nil\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist = append(list, 1)\nlist = append(list, 3)\nlist = append(list, 2)\nlist = append(list, 5)\nlist = append(list, 4)\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist = append(list[:3], append([]int{6}, list[3:]...)...) // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist = append(list[:3], list[4:]...) // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.js
/* \u6e05\u7a7a\u5217\u8868 */\nlist.length = 0;\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push(1);\nlist.push(3);\nlist.push(2);\nlist.push(5);\nlist.push(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.splice(3, 0, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.splice(3, 1);\n
list.ts
/* \u6e05\u7a7a\u5217\u8868 */\nlist.length = 0;\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push(1);\nlist.push(3);\nlist.push(2);\nlist.push(5);\nlist.push(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.splice(3, 0, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.splice(3, 1);\n
list.c
\n
list.cs
/* \u6e05\u7a7a\u5217\u8868 */\nlist.Clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.Add(1);\nlist.Add(3);\nlist.Add(2);\nlist.Add(5);\nlist.Add(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.Insert(3, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.RemoveAt(3);\n
list.swift
/* \u6e05\u7a7a\u5217\u8868 */\nlist.removeAll()\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.append(1)\nlist.append(3)\nlist.append(2)\nlist.append(5)\nlist.append(4)\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.insert(6, at: 3) // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.remove(at: 3) // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.zig
// \u6e05\u7a7a\u5217\u8868\nlist.clearRetainingCapacity();\n// \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\ntry list.append(1);\ntry list.append(3);\ntry list.append(2);\ntry list.append(5);\ntry list.append(4);\n// \u4e2d\u95f4\u63d2\u5165\u5143\u7d20\ntry list.insert(3, 6); // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n// \u5220\u9664\u5143\u7d20\n_ = list.orderedRemove(3); // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n

\u904d\u5386\u5217\u8868\u3002\u4e0e\u6570\u7ec4\u4e00\u6837\uff0c\u5217\u8868\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u904d\u5386\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 for-each \u76f4\u63a5\u904d\u5386\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.size(); i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (int n : list) {\ncount++;\n}\n
list.cpp
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.size(); i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (int n : list) {\ncount++;\n}\n
list.py
\"\"\" \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 \"\"\"\ncount: int = 0\nfor i in range(len(list)):\ncount += 1\n\"\"\" \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 \"\"\"\ncount: int = 0\nfor n in list:\ncount += 1\n
list_test.go
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\ncount := 0\nfor i := 0; i < len(list); i++ {\ncount++\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0\nfor range list {\ncount++\n}\n
list.js
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nlet count = 0;\nfor (let i = 0; i < list.length; i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (const n of list) {\ncount++;\n}\n
list.ts
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nlet count = 0;\nfor (let i = 0; i < list.length; i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (const n of list) {\ncount++;\n}\n
list.c
\n
list.cs
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.Count(); i++)\n{\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nforeach (int n in list)\n{\ncount++;\n}\n
list.swift
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nvar count = 0\nfor _ in list.indices {\ncount += 1\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0\nfor _ in list {\ncount += 1\n}\n
list.zig
// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868\nvar count: i32 = 0;\nvar i: i32 = 0;\nwhile (i < list.items.len) : (i += 1) {\ncount += 1;\n}\n// \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20\ncount = 0;\nfor (list.items) |_| {\ncount += 1;\n}\n

\u62fc\u63a5\u4e24\u4e2a\u5217\u8868\u3002\u518d\u521b\u5efa\u4e00\u4e2a\u65b0\u5217\u8868 list1 \uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u4e2d\u4e00\u4e2a\u5217\u8868\u62fc\u63a5\u5230\u53e6\u4e00\u4e2a\u7684\u5c3e\u90e8\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nList<Integer> list1 = new ArrayList<>(Arrays.asList(new Integer[] { 6, 8, 7, 10, 9 }));\nlist.addAll(list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.cpp
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nvector<int> list1 = { 6, 8, 7, 10, 9 };\n// \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\nlist.insert(list.end(), list1.begin(), list1.end());\n
list.py
\"\"\" \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 \"\"\"\nlist1: List[int] = [6, 8, 7, 10, 9]\nlist += list1  # \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list_test.go
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nlist1 := []int{6, 8, 7, 10, 9}\nlist = append(list, list1...)  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.js
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nconst list1 = [6, 8, 7, 10, 9];\nlist.push(...list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.ts
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nconst list1: number[] = [6, 8, 7, 10, 9];\nlist.push(...list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.c
\n
list.cs
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nList<int> list1 = new() { 6, 8, 7, 10, 9 };\nlist.AddRange(list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.swift
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nlet list1 = [6, 8, 7, 10, 9]\nlist.append(contentsOf: list1) // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.zig
// \u62fc\u63a5\u4e24\u4e2a\u5217\u8868\nvar list1 = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer list1.deinit();\ntry list1.appendSlice(&[_]i32{ 6, 8, 7, 10, 9 });\ntry list.insertSlice(list.items.len, list1.items); // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n

\u6392\u5e8f\u5217\u8868\u3002\u6392\u5e8f\u4e5f\u662f\u5e38\u7528\u7684\u65b9\u6cd5\u4e4b\u4e00\uff0c\u5b8c\u6210\u5217\u8868\u6392\u5e8f\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528\u5728\u6570\u7ec4\u7c7b\u7b97\u6cd5\u9898\u4e2d\u7ecf\u5e38\u8003\u5bdf\u7684\u300c\u4e8c\u5206\u67e5\u627e\u300d\u548c\u300c\u53cc\u6307\u9488\u300d\u7b97\u6cd5\u4e86\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u6392\u5e8f\u5217\u8868 */\nCollections.sort(list);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.cpp
/* \u6392\u5e8f\u5217\u8868 */\nsort(list.begin(), list.end());  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.py
\"\"\" \u6392\u5e8f\u5217\u8868 \"\"\"\nlist.sort()  # \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list_test.go
/* \u6392\u5e8f\u5217\u8868 */\nsort.Ints(list)  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.js
/* \u6392\u5e8f\u5217\u8868 */  list.sort((a, b) => a - b);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.ts
/* \u6392\u5e8f\u5217\u8868 */\nlist.sort((a, b) => a - b);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.c
\n
list.cs
/* \u6392\u5e8f\u5217\u8868 */\nlist.Sort(); // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.swift
/* \u6392\u5e8f\u5217\u8868 */\nlist.sort() // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.zig
// \u6392\u5e8f\u5217\u8868\nstd.sort.sort(i32, list.items, {}, comptime std.sort.asc(i32));\n
"},{"location":"chapter_array_and_linkedlist/list/#432","title":"4.3.2. \u00a0 \u5217\u8868\u7b80\u6613\u5b9e\u73b0 *","text":"

\u4e3a\u4e86\u5e2e\u52a9\u52a0\u6df1\u5bf9\u5217\u8868\u7684\u7406\u89e3\uff0c\u6211\u4eec\u5728\u6b64\u63d0\u4f9b\u4e00\u4e2a\u5217\u8868\u7684\u7b80\u6613\u7248\u672c\u7684\u5b9e\u73b0\u3002\u9700\u8981\u5173\u6ce8\u4e09\u4e2a\u6838\u5fc3\u70b9\uff1a

  • \u521d\u59cb\u5bb9\u91cf\uff1a\u9009\u53d6\u4e00\u4e2a\u5408\u7406\u7684\u6570\u7ec4\u7684\u521d\u59cb\u5bb9\u91cf initialCapacity \u3002\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9009\u62e9 10 \u4f5c\u4e3a\u521d\u59cb\u5bb9\u91cf\u3002
  • \u6570\u91cf\u8bb0\u5f55\uff1a\u9700\u8981\u58f0\u660e\u4e00\u4e2a\u53d8\u91cf size \uff0c\u7528\u6765\u8bb0\u5f55\u5217\u8868\u5f53\u524d\u6709\u591a\u5c11\u4e2a\u5143\u7d20\uff0c\u5e76\u968f\u7740\u5143\u7d20\u63d2\u5165\u4e0e\u5220\u9664\u5b9e\u65f6\u66f4\u65b0\u3002\u6839\u636e\u6b64\u53d8\u91cf\uff0c\u53ef\u4ee5\u5b9a\u4f4d\u5217\u8868\u7684\u5c3e\u90e8\uff0c\u4ee5\u53ca\u5224\u65ad\u662f\u5426\u9700\u8981\u6269\u5bb9\u3002
  • \u6269\u5bb9\u673a\u5236\uff1a\u63d2\u5165\u5143\u7d20\u6709\u53ef\u80fd\u5bfc\u81f4\u8d85\u51fa\u5217\u8868\u5bb9\u91cf\uff0c\u6b64\u65f6\u9700\u8981\u6269\u5bb9\u5217\u8868\uff0c\u65b9\u6cd5\u662f\u5efa\u7acb\u4e00\u4e2a\u66f4\u5927\u7684\u6570\u7ec4\u6765\u66ff\u6362\u5f53\u524d\u6570\u7ec4\u3002\u9700\u8981\u7ed9\u5b9a\u4e00\u4e2a\u6269\u5bb9\u500d\u6570 extendRatio \uff0c\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u89c4\u5b9a\u6bcf\u6b21\u5c06\u6570\u7ec4\u6269\u5bb9\u81f3\u4e4b\u524d\u7684 2 \u500d\u3002

\u672c\u793a\u4f8b\u662f\u4e3a\u4e86\u5e2e\u52a9\u8bfb\u8005\u5bf9\u5982\u4f55\u5b9e\u73b0\u5217\u8868\u4ea7\u751f\u76f4\u89c2\u7684\u8ba4\u8bc6\u3002\u5b9e\u9645\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u5217\u8868\u7684\u5b9e\u73b0\u8fdc\u6bd4\u4ee5\u4e0b\u4ee3\u7801\u590d\u6742\u4e14\u6807\u51c6\uff0c\u611f\u5174\u8da3\u7684\u8bfb\u8005\u53ef\u4ee5\u67e5\u9605\u6e90\u7801\u5b66\u4e60\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_list.java
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate int[] nums;           // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate int capacity = 10;    // \u5217\u8868\u5bb9\u91cf\nprivate int size = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate int extendRatio = 2;  // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\npublic MyList() {\nnums = new int[capacity];\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic int size() {\nreturn size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic int capacity() {\nreturn capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic int get(int index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic void set(int index, int num) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic void add(int num) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size == capacity())\nextendCapacity();\nnums[size] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic void insert(int index, int num) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size == capacity())\nextendCapacity();\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = size - 1; j >= index; j--) {\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic int remove(int index) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < size - 1; j++) {\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic void extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nnums = Arrays.copyOf(nums, capacity() * extendRatio);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\ncapacity = nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic int[] toArray() {\nint size = size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] nums = new int[size];\nfor (int i = 0; i < size; i++) {\nnums[i] = get(i);\n}\nreturn nums;\n}\n}\n
my_list.cpp
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate:\nint* nums;                // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nint numsCapacity = 10;    // \u5217\u8868\u5bb9\u91cf\nint numsSize = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nint extendRatio = 2;      // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nMyList() {\nnums = new int[numsCapacity];\n}\n/* \u6790\u6784\u65b9\u6cd5 */\n~MyList() {\ndelete[] nums;\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nint size() {\nreturn numsSize;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nint capacity() {\nreturn numsCapacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nint get(int index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nvoid set(int index, int num) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nvoid add(int num) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size() == capacity())\nextendCapacity();\nnums[size()] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nvoid insert(int index, int num) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size() == capacity())\nextendCapacity();\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = size() - 1; j >= index; j--) {\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\nint remove(int index) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < size() - 1; j++) {\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\nvoid extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nint newCapacity = capacity() * extendRatio;\nint* tmp = nums;\nnums = new int[newCapacity];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < size(); i++) {\nnums[i] = tmp[i];\n}\n// \u91ca\u653e\u5185\u5b58\ndelete[] tmp;\nnumsCapacity = newCapacity;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a Vector \u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> vec(size());\nfor (int i = 0; i < size(); i++) {\nvec[i] = nums[i];\n}\nreturn vec;\n}\n};\n
my_list.py
class MyList:\n\"\"\" \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__capacity: int = 10                       # \u5217\u8868\u5bb9\u91cf\nself.__nums: List[int] = [0] * self.__capacity  # \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nself.__size: int = 0                            # \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nself.__extend_ratio: int = 2                    # \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09 \"\"\"\nreturn self.__size\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u5217\u8868\u5bb9\u91cf \"\"\"\nreturn self.__capacity\ndef get(self, index: int) -> int:\n\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\n# \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nreturn self.__nums[index]\ndef set(self, num: int, index: int) -> None:\n\"\"\" \u66f4\u65b0\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nself.__nums[index] = num\ndef add(self, num: int) -> None:\n\"\"\" \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 \"\"\"\n# \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif self.size() == self.capacity():\nself.extend_capacity()\nself.__nums[self.__size] = num\nself.__size += 1\ndef insert(self, num: int, index: int) -> None:\n\"\"\" \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\n# \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif self.__size == self.capacity():\nself.extend_capacity()\n# \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j in range(self.__size - 1, index - 1, -1):\nself.__nums[j + 1] = self.__nums[j]\nself.__nums[index] = num\n# \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.__size += 1\ndef remove(self, index: int) -> int:\n\"\"\" \u5220\u9664\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nnum = self.__nums[index]\n# \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j in range(index, self.__size - 1):\nself.__nums[j] = self.__nums[j + 1]\n# \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.__size -= 1\n# \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\ndef extend_capacity(self) -> None:\n\"\"\" \u5217\u8868\u6269\u5bb9 \"\"\"\n# \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a self.__size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nself.__nums = self.__nums + [0] * self.capacity() * (self.__extend_ratio - 1)\n# \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nself.__capacity = len(self.__nums)\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6709\u6548\u957f\u5ea6\u7684\u5217\u8868 \"\"\"\nreturn self.__nums[:self.__size]\n
my_list.go
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\ntype myList struct {\nnumsCapacity int\nnums         []int\nnumsSize     int\nextendRatio  int\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newMyList() *myList {\nreturn &myList{\nnumsCapacity: 10,              // \u5217\u8868\u5bb9\u91cf\nnums:         make([]int, 10), // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nnumsSize:     0,               // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nextendRatio:  2,               // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n}\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09 */\nfunc (l *myList) size() int {\nreturn l.numsSize\n}\n/*  \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nfunc (l *myList) capacity() int {\nreturn l.numsCapacity\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nfunc (l *myList) get(index int) int {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nreturn l.nums[index]\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nfunc (l *myList) set(num, index int) {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nl.nums[index] = num\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nfunc (l *myList) add(num int) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif l.numsSize == l.numsCapacity {\nl.extendCapacity()\n}\nl.nums[l.numsSize] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize++\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nfunc (l *myList) insert(num, index int) {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif l.numsSize == l.numsCapacity {\nl.extendCapacity()\n}\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j := l.numsSize - 1; j >= index; j-- {\nl.nums[j+1] = l.nums[j]\n}\nl.nums[index] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize++\n}\n/* \u5220\u9664\u5143\u7d20 */\nfunc (l *myList) remove(index int) int {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nnum := l.nums[index]\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j := index; j < l.numsSize-1; j++ {\nl.nums[j] = l.nums[j+1]\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize--\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\n}\n/* \u5217\u8868\u6269\u5bb9 */\nfunc (l *myList) extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a self.__size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nl.nums = append(l.nums, make([]int, l.numsCapacity*(l.extendRatio-1))...)\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nl.numsCapacity = len(l.nums)\n}\n/* \u8fd4\u56de\u6709\u6548\u957f\u5ea6\u7684\u5217\u8868 */\nfunc (l *myList) toArray() []int {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nreturn l.nums[:l.numsSize]\n}\n
my_list.js
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\n#nums = new Array(); // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\n#capacity = 10; // \u5217\u8868\u5bb9\u91cf\n#size = 0; // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\n#extendRatio = 2; // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor() {\nthis.#nums = new Array(this.#capacity);\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nsize() {\nreturn this.#size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\ncapacity() {\nreturn this.#capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nget(index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nreturn this.#nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nset(index, num) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nthis.#nums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nadd(num) {\n// \u5982\u679c\u957f\u5ea6\u7b49\u4e8e\u5bb9\u91cf\uff0c\u5219\u9700\u8981\u6269\u5bb9\nif (this.#size === this.#capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u65b0\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u5c3e\u90e8\nthis.#nums[this.#size] = num;\nthis.#size++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\ninsert(index, num) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (this.#size === this.#capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let j = this.#size - 1; j >= index; j--) {\nthis.#nums[j + 1] = this.#nums[j];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.#nums[index] = num;\nthis.#size++;\n}\n/* \u5220\u9664\u5143\u7d20 */\nremove(index) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nlet num = this.#nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let j = index; j < this.#size - 1; j++) {\nthis.#nums[j] = this.#nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.#size--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\nextendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nthis.#nums = this.#nums.concat(\nnew Array(this.capacity() * (this.#extendRatio - 1))\n);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nthis.#capacity = this.#nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\ntoArray() {\nlet size = this.size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst nums = new Array(size);\nfor (let i = 0; i < size; i++) {\nnums[i] = this.get(i);\n}\nreturn nums;\n}\n}\n
my_list.ts
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate nums: Array<number>; // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate _capacity: number = 10; // \u5217\u8868\u5bb9\u91cf\nprivate _size: number = 0; // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate extendRatio: number = 2; // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor() {\nthis.nums = new Array(this._capacity);\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic size(): number {\nreturn this._size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic capacity(): number {\nreturn this._capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic get(index: number): number {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nreturn this.nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic set(index: number, num: number): void {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nthis.nums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic add(num: number): void {\n// \u5982\u679c\u957f\u5ea6\u7b49\u4e8e\u5bb9\u91cf\uff0c\u5219\u9700\u8981\u6269\u5bb9\nif (this._size === this._capacity)\nthis.extendCapacity();\n// \u5c06\u65b0\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u5c3e\u90e8\nthis.nums[this._size] = num;\nthis._size++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic insert(index: number, num: number): void {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (this._size === this._capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let j = this._size - 1; j >= index; j--) {\nthis.nums[j + 1] = this.nums[j];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.nums[index] = num;\nthis._size++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic remove(index: number): number {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nlet num = this.nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let j = index; j < this._size - 1; j++) {\nthis.nums[j] = this.nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis._size--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic extendCapacity(): void {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nthis.nums = this.nums.concat(\nnew Array(this.capacity() * (this.extendRatio - 1))\n);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nthis._capacity = this.nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic toArray(): number[] {\nlet size = this.size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst nums = new Array(size);\nfor (let i = 0; i < size; i++) {\nnums[i] = this.get(i);\n}\nreturn nums;\n}\n}\n
my_list.c
[class]{myList}-[func]{}\n
my_list.cs
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList\n{\nprivate int[] nums;           // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate int numsCapacity = 10;    // \u5217\u8868\u5bb9\u91cf\nprivate int numsSize = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate int extendRatio = 2;  // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\npublic MyList()\n{\nnums = new int[numsCapacity];\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic int size()\n{\nreturn numsSize;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic int capacity()\n{\nreturn numsCapacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic int get(int index)\n{\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic void set(int index, int num)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic void add(int num)\n{\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (numsSize == numsCapacity)\nextendCapacity();\nnums[numsSize] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic void insert(int index, int num)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (numsSize == numsCapacity)\nextendCapacity();\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = numsSize - 1; j >= index; j--)\n{\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic int remove(int index)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < numsSize - 1; j++)\n{\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic void extendCapacity()\n{\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a numsCapacity * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nSystem.Array.Resize(ref nums, numsCapacity * extendRatio);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nnumsCapacity = nums.Length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic int[] toArray()\n{\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] nums = new int[numsSize];\nfor (int i = 0; i < numsSize; i++)\n{\nnums[i] = get(i);\n}\nreturn nums;\n}\n}\n
my_list.swift
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate var nums: [Int] // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate var _capacity = 10 // \u5217\u8868\u5bb9\u91cf\nprivate var _size = 0 // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate let extendRatio = 2 // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\ninit() {\nnums = Array(repeating: 0, count: _capacity)\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nfunc size() -> Int {\n_size\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nfunc capacity() -> Int {\n_capacity\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nfunc get(index: Int) -> Int {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u9519\u8bef\uff0c\u4e0b\u540c\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nreturn nums[index]\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nfunc set(index: Int, num: Int) {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nnums[index] = num\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nfunc add(num: Int) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif _size == _capacity {\nextendCapacity()\n}\nnums[_size] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size += 1\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nfunc insert(index: Int, num: Int) {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif _size == _capacity {\nextendCapacity()\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j in sequence(first: _size - 1, next: { $0 >= index + 1 ? $0 - 1 : nil }) {\nnums[j + 1] = nums[j]\n}\nnums[index] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size += 1\n}\n/* \u5220\u9664\u5143\u7d20 */\n@discardableResult\nfunc remove(index: Int) -> Int {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nlet num = nums[index]\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j in index ..< (_size - 1) {\nnums[j] = nums[j + 1]\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size -= 1\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\n}\n/* \u5217\u8868\u6269\u5bb9 */\nfunc extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nnums = nums + Array(repeating: 0, count: _capacity * (extendRatio - 1))\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\n_capacity = nums.count\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\nfunc toArray() -> [Int] {\nvar nums = Array(repeating: 0, count: _size)\nfor i in 0 ..< _size {\nnums[i] = get(index: i)\n}\nreturn nums\n}\n}\n
my_list.zig
// \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0\nfn MyList(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nnums: []T = undefined,                        // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nnumsCapacity: usize = 10,                     // \u5217\u8868\u5bb9\u91cf\nnumSize: usize = 0,                           // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nextendRatio: usize = 2,                       // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined, // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u5217\u8868\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.nums = try self.mem_allocator.alloc(T, self.numsCapacity);\nstd.mem.set(T, self.nums, @as(T, 0));\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\npub fn size(self: *Self) usize {\nreturn self.numSize;\n}\n// \u83b7\u53d6\u5217\u8868\u5bb9\u91cf\npub fn capacity(self: *Self) usize {\nreturn self.numsCapacity;\n}\n// \u8bbf\u95ee\u5143\u7d20\npub fn get(self: *Self, index: usize) T {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn self.nums[index];\n}  // \u66f4\u65b0\u5143\u7d20\npub fn set(self: *Self, index: usize, num: T) void {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nself.nums[index] = num;\n}  // \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\npub fn add(self: *Self, num: T) !void {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (self.size() == self.capacity()) try self.extendCapacity();\nself.nums[self.size()] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize += 1;\n}  // \u4e2d\u95f4\u63d2\u5165\u5143\u7d20\npub fn insert(self: *Self, index: usize, num: T) !void {\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (self.size() == self.capacity()) try self.extendCapacity();\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nvar j = self.size() - 1;\nwhile (j >= index) : (j -= 1) {\nself.nums[j + 1] = self.nums[j];\n}\nself.nums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize += 1;\n}\n// \u5220\u9664\u5143\u7d20\npub fn remove(self: *Self, index: usize) T {\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nvar num = self.nums[index];\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nvar j = index;\nwhile (j < self.size() - 1) : (j += 1) {\nself.nums[j] = self.nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize -= 1;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n// \u5217\u8868\u6269\u5bb9\npub fn extendCapacity(self: *Self) !void {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nvar newCapacity = self.capacity() * self.extendRatio;\nvar extend = try self.mem_allocator.alloc(T, newCapacity);\nstd.mem.set(T, extend, @as(T, 0));\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nstd.mem.copy(T, extend, self.nums);\nself.nums = extend;\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nself.numsCapacity = newCapacity;\n}\n// \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar nums = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, nums, @as(T, 0));\nfor (nums) |*num, i| {\nnum.* = self.get(i);\n}\nreturn nums;\n}\n};\n}\n
"},{"location":"chapter_array_and_linkedlist/summary/","title":"4.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u6570\u7ec4\u548c\u94fe\u8868\u662f\u4e24\u79cd\u57fa\u672c\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u4e24\u79cd\u5b58\u50a8\u65b9\u5f0f\uff0c\u5373\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\u548c\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\u3002\u4e24\u8005\u7684\u4f18\u70b9\u4e0e\u7f3a\u70b9\u5448\u73b0\u51fa\u6b64\u6d88\u5f7c\u957f\u7684\u5173\u7cfb\u3002
  • \u6570\u7ec4\u652f\u6301\u968f\u673a\u8bbf\u95ee\u3001\u5185\u5b58\u7a7a\u95f4\u5360\u7528\u5c0f\uff1b\u4f46\u63d2\u5165\u4e0e\u5220\u9664\u5143\u7d20\u6548\u7387\u4f4e\uff0c\u4e14\u521d\u59cb\u5316\u540e\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002
  • \u94fe\u8868\u53ef\u901a\u8fc7\u66f4\u6539\u6307\u9488\u5b9e\u73b0\u9ad8\u6548\u7684\u7ed3\u70b9\u63d2\u5165\u4e0e\u5220\u9664\uff0c\u5e76\u4e14\u53ef\u4ee5\u7075\u6d3b\u5730\u4fee\u6539\u957f\u5ea6\uff1b\u4f46\u7ed3\u70b9\u8bbf\u95ee\u6548\u7387\u4f4e\u3001\u5360\u7528\u5185\u5b58\u591a\u3002\u5e38\u89c1\u7684\u94fe\u8868\u7c7b\u578b\u6709\u5355\u5411\u94fe\u8868\u3001\u5faa\u73af\u94fe\u8868\u3001\u53cc\u5411\u94fe\u8868\u3002
  • \u5217\u8868\u53c8\u79f0\u52a8\u6001\u6570\u7ec4\uff0c\u662f\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u4e00\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u5176\u4fdd\u5b58\u4e86\u6570\u7ec4\u7684\u4f18\u52bf\uff0c\u4e14\u53ef\u4ee5\u7075\u6d3b\u6539\u53d8\u957f\u5ea6\u3002\u5217\u8868\u7684\u51fa\u73b0\u5927\u5927\u63d0\u5347\u4e86\u6570\u7ec4\u7684\u5b9e\u7528\u6027\uff0c\u4f46\u526f\u4f5c\u7528\u662f\u4f1a\u9020\u6210\u90e8\u5206\u5185\u5b58\u7a7a\u95f4\u6d6a\u8d39\u3002
  • \u4e0b\u8868\u603b\u7ed3\u5bf9\u6bd4\u4e86\u6570\u7ec4\u4e0e\u94fe\u8868\u7684\u5404\u9879\u7279\u6027\u3002
\u6570\u7ec4 \u94fe\u8868 \u5b58\u50a8\u65b9\u5f0f \u8fde\u7eed\u5185\u5b58\u7a7a\u95f4 \u79bb\u6563\u5185\u5b58\u7a7a\u95f4 \u6570\u636e\u7ed3\u6784\u957f\u5ea6 \u957f\u5ea6\u4e0d\u53ef\u53d8 \u957f\u5ea6\u53ef\u53d8 \u5185\u5b58\u4f7f\u7528\u7387 \u5360\u7528\u5185\u5b58\u5c11\u3001\u7f13\u5b58\u5c40\u90e8\u6027\u597d \u5360\u7528\u5185\u5b58\u591a \u4f18\u52bf\u64cd\u4f5c \u968f\u673a\u8bbf\u95ee \u63d2\u5165\u3001\u5220\u9664

\u7f13\u5b58\u5c40\u90e8\u6027\u7684\u7b80\u5355\u89e3\u91ca

\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c\u6570\u636e\u8bfb\u5199\u901f\u5ea6\u6392\u5e8f\u662f\u201c\u786c\u76d8 < \u5185\u5b58 < CPU \u7f13\u5b58\u201d\u3002\u5f53\u6211\u4eec\u8bbf\u95ee\u6570\u7ec4\u5143\u7d20\u65f6\uff0c\u8ba1\u7b97\u673a\u4e0d\u4ec5\u4f1a\u52a0\u8f7d\u5b83\uff0c\u8fd8\u4f1a\u7f13\u5b58\u5176\u5468\u56f4\u7684\u5176\u5b83\u6570\u636e\uff0c\u4ece\u800c\u501f\u52a9\u9ad8\u901f\u7f13\u5b58\u6765\u63d0\u5347\u540e\u7eed\u64cd\u4f5c\u7684\u6267\u884c\u901f\u5ea6\u3002\u94fe\u8868\u5219\u4e0d\u7136\uff0c\u8ba1\u7b97\u673a\u53ea\u80fd\u6328\u4e2a\u5730\u7f13\u5b58\u5404\u4e2a\u7ed3\u70b9\uff0c\u8fd9\u6837\u7684\u591a\u6b21\u201c\u642c\u8fd0\u201d\u964d\u4f4e\u4e86\u6574\u4f53\u6548\u7387\u3002

  • \u4e0b\u8868\u5bf9\u6bd4\u4e86\u6570\u7ec4\u4e0e\u94fe\u8868\u7684\u5404\u79cd\u64cd\u4f5c\u6548\u7387\u3002
\u64cd\u4f5c \u6570\u7ec4 \u94fe\u8868 \u8bbf\u95ee\u5143\u7d20 \\(O(1)\\) \\(O(N)\\) \u6dfb\u52a0\u5143\u7d20 \\(O(N)\\) \\(O(1)\\) \u5220\u9664\u5143\u7d20 \\(O(N)\\) \\(O(1)\\)"},{"location":"chapter_computational_complexity/performance_evaluation/","title":"2.1. \u00a0 \u7b97\u6cd5\u6548\u7387\u8bc4\u4f30","text":""},{"location":"chapter_computational_complexity/performance_evaluation/#211","title":"2.1.1. \u00a0 \u7b97\u6cd5\u8bc4\u4ef7\u7ef4\u5ea6","text":"

\u5728\u5f00\u59cb\u5b66\u4e60\u7b97\u6cd5\u4e4b\u524d\uff0c\u6211\u4eec\u9996\u5148\u8981\u60f3\u6e05\u695a\u7b97\u6cd5\u7684\u8bbe\u8ba1\u76ee\u6807\u662f\u4ec0\u4e48\uff0c\u6216\u8005\u8bf4\uff0c\u5982\u4f55\u6765\u8bc4\u5224\u7b97\u6cd5\u7684\u597d\u4e0e\u574f\u3002\u6574\u4f53\u4e0a\u770b\uff0c\u6211\u4eec\u8bbe\u8ba1\u7b97\u6cd5\u65f6\u8ffd\u6c42\u4e24\u4e2a\u5c42\u9762\u7684\u76ee\u6807\u3002

  1. \u627e\u5230\u95ee\u9898\u89e3\u6cd5\u3002\u7b97\u6cd5\u9700\u8981\u80fd\u591f\u5728\u89c4\u5b9a\u7684\u8f93\u5165\u8303\u56f4\u4e0b\uff0c\u53ef\u9760\u5730\u6c42\u5f97\u95ee\u9898\u7684\u6b63\u786e\u89e3\u3002
  2. \u5bfb\u6c42\u6700\u4f18\u89e3\u6cd5\u3002\u540c\u4e00\u4e2a\u95ee\u9898\u53ef\u80fd\u5b58\u5728\u591a\u79cd\u89e3\u6cd5\uff0c\u800c\u6211\u4eec\u5e0c\u671b\u7b97\u6cd5\u6548\u7387\u5c3d\u53ef\u80fd\u7684\u9ad8\u3002

\u6362\u8a00\u4e4b\uff0c\u5728\u53ef\u4ee5\u89e3\u51b3\u95ee\u9898\u7684\u524d\u63d0\u4e0b\uff0c\u7b97\u6cd5\u6548\u7387\u5219\u662f\u4e3b\u8981\u8bc4\u4ef7\u7ef4\u5ea6\uff0c\u5305\u62ec\uff1a

  • \u65f6\u95f4\u6548\u7387\uff0c\u5373\u7b97\u6cd5\u7684\u8fd0\u884c\u901f\u5ea6\u7684\u5feb\u6162\u3002
  • \u7a7a\u95f4\u6548\u7387\uff0c\u5373\u7b97\u6cd5\u5360\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u5927\u5c0f\u3002

\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u8ffd\u6c42\u201c\u8fd0\u884c\u901f\u5ea6\u5feb\u3001\u5360\u7528\u5185\u5b58\u5c11\u201d\uff0c\u800c\u5982\u4f55\u53bb\u8bc4\u4ef7\u7b97\u6cd5\u6548\u7387\u5219\u662f\u975e\u5e38\u91cd\u8981\u7684\u95ee\u9898\uff0c\u56e0\u4e3a\u53ea\u6709\u77e5\u9053\u5982\u4f55\u8bc4\u4ef7\u7b97\u6cd5\uff0c\u624d\u80fd\u53bb\u505a\u7b97\u6cd5\u4e4b\u95f4\u7684\u5bf9\u6bd4\u5206\u6790\uff0c\u4ee5\u53ca\u4f18\u5316\u7b97\u6cd5\u8bbe\u8ba1\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#212","title":"2.1.2. \u00a0 \u6548\u7387\u8bc4\u4f30\u65b9\u6cd5","text":""},{"location":"chapter_computational_complexity/performance_evaluation/#_1","title":"\u5b9e\u9645\u6d4b\u8bd5","text":"

\u5047\u8bbe\u6211\u4eec\u73b0\u5728\u6709\u7b97\u6cd5 A \u548c \u7b97\u6cd5 B \uff0c\u90fd\u80fd\u591f\u89e3\u51b3\u540c\u4e00\u95ee\u9898\uff0c\u73b0\u5728\u9700\u8981\u5bf9\u6bd4\u4e24\u4e2a\u7b97\u6cd5\u4e4b\u95f4\u7684\u6548\u7387\u3002\u6211\u4eec\u80fd\u591f\u60f3\u5230\u7684\u6700\u76f4\u63a5\u7684\u65b9\u5f0f\uff0c\u5c31\u662f\u627e\u4e00\u53f0\u8ba1\u7b97\u673a\uff0c\u628a\u4e24\u4e2a\u7b97\u6cd5\u90fd\u5b8c\u6574\u8dd1\u4e00\u904d\uff0c\u5e76\u76d1\u63a7\u8bb0\u5f55\u8fd0\u884c\u65f6\u95f4\u548c\u5185\u5b58\u5360\u7528\u60c5\u51b5\u3002\u8fd9\u79cd\u8bc4\u4f30\u65b9\u5f0f\u80fd\u591f\u53cd\u6620\u771f\u5b9e\u60c5\u51b5\uff0c\u4f46\u662f\u4e5f\u5b58\u5728\u5f88\u5927\u7684\u786c\u4f24\u3002

\u96be\u4ee5\u6392\u9664\u6d4b\u8bd5\u73af\u5883\u7684\u5e72\u6270\u56e0\u7d20\u3002\u786c\u4ef6\u914d\u7f6e\u4f1a\u5f71\u54cd\u5230\u7b97\u6cd5\u7684\u6027\u80fd\u8868\u73b0\u3002\u4f8b\u5982\uff0c\u5728\u67d0\u53f0\u8ba1\u7b97\u673a\u4e2d\uff0c\u7b97\u6cd5 A \u6bd4\u7b97\u6cd5 B \u8fd0\u884c\u65f6\u95f4\u66f4\u77ed\uff1b\u4f46\u6362\u5230\u53e6\u4e00\u53f0\u914d\u7f6e\u4e0d\u540c\u7684\u8ba1\u7b97\u673a\u4e2d\uff0c\u53ef\u80fd\u4f1a\u5f97\u5230\u76f8\u53cd\u7684\u6d4b\u8bd5\u7ed3\u679c\u3002\u8fd9\u610f\u5473\u7740\u6211\u4eec\u9700\u8981\u5728\u5404\u79cd\u673a\u5668\u4e0a\u5c55\u5f00\u6d4b\u8bd5\uff0c\u800c\u8fd9\u662f\u4e0d\u73b0\u5b9e\u7684\u3002

\u5c55\u5f00\u5b8c\u6574\u6d4b\u8bd5\u975e\u5e38\u8017\u8d39\u8d44\u6e90\u3002\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u7684\u5927\u5c0f\u53d8\u5316\uff0c\u7b97\u6cd5\u4f1a\u5448\u73b0\u51fa\u4e0d\u540c\u7684\u6548\u7387\u8868\u73b0\u3002\u6bd4\u5982\uff0c\u6709\u53ef\u80fd\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5c0f\u65f6\uff0c\u7b97\u6cd5 A \u8fd0\u884c\u65f6\u95f4\u77ed\u4e8e\u7b97\u6cd5 B \uff0c\u800c\u5728\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5927\u65f6\uff0c\u6d4b\u8bd5\u7ed3\u679c\u622a\u7136\u76f8\u53cd\u3002\u56e0\u6b64\uff0c\u82e5\u60f3\u8981\u8fbe\u5230\u5177\u6709\u8bf4\u670d\u529b\u7684\u5bf9\u6bd4\u7ed3\u679c\uff0c\u90a3\u4e48\u9700\u8981\u8f93\u5165\u5404\u79cd\u4f53\u91cf\u6570\u636e\uff0c\u8fd9\u6837\u7684\u6d4b\u8bd5\u9700\u8981\u5360\u7528\u5927\u91cf\u8ba1\u7b97\u8d44\u6e90\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#_2","title":"\u7406\u8bba\u4f30\u7b97","text":"

\u65e2\u7136\u5b9e\u9645\u6d4b\u8bd5\u5177\u6709\u5f88\u5927\u7684\u5c40\u9650\u6027\uff0c\u90a3\u4e48\u6211\u4eec\u662f\u5426\u53ef\u4ee5\u4ec5\u901a\u8fc7\u4e00\u4e9b\u8ba1\u7b97\uff0c\u5c31\u83b7\u77e5\u7b97\u6cd5\u7684\u6548\u7387\u6c34\u5e73\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\uff0c\u6211\u4eec\u5c06\u6b64\u4f30\u7b97\u65b9\u6cd5\u79f0\u4e3a\u300c\u590d\u6742\u5ea6\u5206\u6790 Complexity Analysis\u300d\u6216\u300c\u6e10\u8fd1\u590d\u6742\u5ea6\u5206\u6790 Asymptotic Complexity Analysis\u300d\u3002

\u590d\u6742\u5ea6\u5206\u6790\u8bc4\u4f30\u7684\u662f\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u589e\u591a\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002\u8fd9\u53e5\u8bdd\u6709\u4e9b\u62d7\u53e3\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u5206\u4e3a\u4e09\u4e2a\u91cd\u70b9\u6765\u7406\u89e3\uff1a

  • \u201c\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u201d\u53ef\u5206\u4e3a\u201c\u8fd0\u884c\u65f6\u95f4\u201d\u548c\u201c\u5360\u7528\u7a7a\u95f4\u201d\uff0c\u8fdb\u800c\u53ef\u5c06\u590d\u6742\u5ea6\u5206\u4e3a\u300c\u65f6\u95f4\u590d\u6742\u5ea6 Time Complexity\u300d\u548c\u300c\u7a7a\u95f4\u590d\u6742\u5ea6 Space Complexity\u300d\u3002
  • \u201c\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u589e\u591a\u65f6\u201d\u4ee3\u8868\u590d\u6742\u5ea6\u4e0e\u8f93\u5165\u6570\u636e\u91cf\u6709\u5173\uff0c\u53cd\u6620\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u4e0e\u8f93\u5165\u6570\u636e\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\uff1b
  • \u201c\u589e\u957f\u8d8b\u52bf\u201d\u8868\u793a\u590d\u6742\u5ea6\u5206\u6790\u4e0d\u5173\u5fc3\u7b97\u6cd5\u5177\u4f53\u4f7f\u7528\u4e86\u591a\u5c11\u65f6\u95f4\u6216\u5360\u7528\u4e86\u591a\u5c11\u7a7a\u95f4\uff0c\u800c\u662f\u7ed9\u51fa\u4e00\u79cd\u201c\u8d8b\u52bf\u6027\u5206\u6790\u201d\uff1b

\u590d\u6742\u5ea6\u5206\u6790\u514b\u670d\u4e86\u5b9e\u9645\u6d4b\u8bd5\u65b9\u6cd5\u7684\u5f0a\u7aef\u3002\u4e00\u662f\u72ec\u7acb\u4e8e\u6d4b\u8bd5\u73af\u5883\uff0c\u5206\u6790\u7ed3\u679c\u9002\u7528\u4e8e\u6240\u6709\u8fd0\u884c\u5e73\u53f0\u3002\u4e8c\u662f\u53ef\u4ee5\u4f53\u73b0\u4e0d\u540c\u6570\u636e\u91cf\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\uff0c\u5c24\u5176\u662f\u53ef\u4ee5\u53cd\u6620\u5927\u6570\u636e\u91cf\u4e0b\u7684\u7b97\u6cd5\u6027\u80fd\u3002

\u5982\u679c\u611f\u89c9\u5bf9\u590d\u6742\u5ea6\u5206\u6790\u7684\u6982\u5ff5\u4e00\u77e5\u534a\u89e3\uff0c\u65e0\u9700\u62c5\u5fc3\uff0c\u540e\u7eed\u7ae0\u8282\u4f1a\u5c55\u5f00\u4ecb\u7ecd\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#213","title":"2.1.3. \u00a0 \u590d\u6742\u5ea6\u5206\u6790\u91cd\u8981\u6027","text":"

\u590d\u6742\u5ea6\u5206\u6790\u7ed9\u51fa\u4e00\u628a\u8bc4\u4ef7\u7b97\u6cd5\u6548\u7387\u7684\u201c\u6807\u5c3a\u201d\uff0c\u544a\u8bc9\u6211\u4eec\u6267\u884c\u67d0\u4e2a\u7b97\u6cd5\u9700\u8981\u591a\u5c11\u65f6\u95f4\u548c\u7a7a\u95f4\u8d44\u6e90\uff0c\u4e5f\u8ba9\u6211\u4eec\u53ef\u4ee5\u5f00\u5c55\u4e0d\u540c\u7b97\u6cd5\u4e4b\u95f4\u7684\u6548\u7387\u5bf9\u6bd4\u3002

\u590d\u6742\u5ea6\u662f\u4e2a\u6570\u5b66\u6982\u5ff5\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u53ef\u80fd\u6bd4\u8f83\u62bd\u8c61\uff0c\u5b66\u4e60\u96be\u5ea6\u76f8\u5bf9\u8f83\u9ad8\u3002\u4ece\u8fd9\u4e2a\u89d2\u5ea6\u51fa\u53d1\uff0c\u5176\u5e76\u4e0d\u9002\u5408\u4f5c\u4e3a\u7b2c\u4e00\u7ae0\u5185\u5bb9\u3002\u4f46\u662f\uff0c\u5f53\u6211\u4eec\u8ba8\u8bba\u67d0\u4e2a\u6570\u636e\u7ed3\u6784\u6216\u8005\u7b97\u6cd5\u7684\u7279\u70b9\u65f6\uff0c\u96be\u4ee5\u907f\u514d\u9700\u8981\u5206\u6790\u5b83\u7684\u8fd0\u884c\u901f\u5ea6\u548c\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\u3002\u56e0\u6b64\uff0c\u5728\u5c55\u5f00\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e4b\u524d\uff0c\u5efa\u8bae\u8bfb\u8005\u5148\u5bf9\u590d\u6742\u5ea6\u5efa\u7acb\u8d77\u521d\u6b65\u7684\u4e86\u89e3\uff0c\u5e76\u4e14\u80fd\u591f\u5b8c\u6210\u7b80\u5355\u6848\u4f8b\u7684\u590d\u6742\u5ea6\u5206\u6790\u3002

"},{"location":"chapter_computational_complexity/space_complexity/","title":"2.3. \u00a0 \u7a7a\u95f4\u590d\u6742\u5ea6","text":"

\u300c\u7a7a\u95f4\u590d\u6742\u5ea6 Space Complexity\u300d\u7edf\u8ba1 \u7b97\u6cd5\u4f7f\u7528\u5185\u5b58\u7a7a\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002\u8fd9\u4e2a\u6982\u5ff5\u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u5f88\u7c7b\u4f3c\u3002

"},{"location":"chapter_computational_complexity/space_complexity/#231","title":"2.3.1. \u00a0 \u7b97\u6cd5\u76f8\u5173\u7a7a\u95f4","text":"

\u7b97\u6cd5\u8fd0\u884c\u4e2d\uff0c\u4f7f\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a

  • \u300c\u8f93\u5165\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u7684\u8f93\u5165\u6570\u636e\uff1b
  • \u300c\u6682\u5b58\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u53d8\u91cf\u3001\u5bf9\u8c61\u3001\u51fd\u6570\u4e0a\u4e0b\u6587\u7b49\u6570\u636e\uff1b
  • \u300c\u8f93\u51fa\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u7684\u8f93\u51fa\u6570\u636e\uff1b

Tip

\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u7edf\u8ba1\u8303\u56f4\u662f\u300c\u6682\u5b58\u7a7a\u95f4\u300d+\u300c\u8f93\u51fa\u7a7a\u95f4\u300d\u3002

\u6682\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u4e09\u4e2a\u90e8\u5206\uff1a

  • \u300c\u6682\u5b58\u6570\u636e\u300d\u7528\u4e8e\u4fdd\u5b58\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u5404\u79cd \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61 \u7b49\u3002
  • \u300c\u6808\u5e27\u7a7a\u95f4\u300d\u7528\u4e8e\u4fdd\u5b58\u8c03\u7528\u51fd\u6570\u7684\u4e0a\u4e0b\u6587\u6570\u636e\u3002\u7cfb\u7edf\u6bcf\u6b21\u8c03\u7528\u51fd\u6570\u90fd\u4f1a\u5728\u6808\u7684\u9876\u90e8\u521b\u5efa\u4e00\u4e2a\u6808\u5e27\uff0c\u51fd\u6570\u8fd4\u56de\u65f6\uff0c\u6808\u5e27\u7a7a\u95f4\u4f1a\u88ab\u91ca\u653e\u3002
  • \u300c\u6307\u4ee4\u7a7a\u95f4\u300d\u7528\u4e8e\u4fdd\u5b58\u7f16\u8bd1\u540e\u7684\u7a0b\u5e8f\u6307\u4ee4\uff0c\u5728\u5b9e\u9645\u7edf\u8ba1\u4e2d\u4e00\u822c\u5ffd\u7565\u4e0d\u8ba1\u3002

Fig. \u7b97\u6cd5\u4f7f\u7528\u7684\u76f8\u5173\u7a7a\u95f4

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u7c7b */\nclass Node {\nint val;\nNode next;\nNode(int x) { val = x; }\n}\n/* \u51fd\u6570 */\nint function() {\n// do something...\nreturn 0;\n}\nint algorithm(int n) {        // \u8f93\u5165\u6570\u636e\nfinal int a = 0;          // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode node = new Node(0);  // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = function();       // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7ed3\u6784\u4f53 */\nstruct Node {\nint val;\nNode *next;\nNode(int x) : val(x), next(nullptr) {}\n};\n/* \u51fd\u6570 */\nint func() {\n// do something...\nreturn 0;\n}\nint algorithm(int n) {        // \u8f93\u5165\u6570\u636e\nconst int a = 0;          // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode* node = new Node(0); // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = func();           // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
\"\"\" \u7c7b \"\"\"\nclass Node:\ndef __init__(self, x: int):\nself.val: int = x                 # \u7ed3\u70b9\u503c\nself.next: Optional[Node] = None  # \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n\"\"\" \u51fd\u6570 \"\"\"\ndef function() -> int:\n# do something...\nreturn 0\ndef algorithm(n) -> int:  # \u8f93\u5165\u6570\u636e\nb: int = 0            # \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nnode = Node(0)        # \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nc: int = function()   # \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c      # \u8f93\u51fa\u6570\u636e\n
/* \u7ed3\u6784\u4f53 */\ntype node struct {\nval  int\nnext *node\n}\n/* \u521b\u5efa node \u7ed3\u6784\u4f53  */\nfunc newNode(val int) *node {\nreturn &node{val: val}\n}\n/* \u51fd\u6570 */\nfunc function() int {\n// do something...\nreturn 0\n}\nfunc algorithm(n int) int { // \u8f93\u5165\u6570\u636e\nconst a = 0             // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nb := 0                  // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nnewNode(0)              // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nc := function()         // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c        // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nval;\nnext;\nconstructor(val) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.next = null;                       // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n/* \u51fd\u6570 */\nfunction constFunc() {\n// do something\nreturn 0;\n}\nfunction algorithm(n) {       // \u8f93\u5165\u6570\u636e\nconst a = 0;              // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nconst b = 0;              // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nconst node = new Node(0); // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nconst c = constFunc();    // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nval: number;\nnext: Node | null;\nconstructor(val?: number) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.next = null;                       // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n/* \u51fd\u6570 */\nfunction constFunc(): number {\n// do something\nreturn 0;\n}\nfunction algorithm(n: number): number { // \u8f93\u5165\u6570\u636e\nconst a = 0;                        // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nconst b = 0;                        // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nconst node = new Node(0);           // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nconst c = constFunc();              // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;                   // \u8f93\u51fa\u6570\u636e\n}\n
\n
/* \u7c7b */\nclass Node\n{\nint val;\nNode next;\nNode(int x) { val = x; }\n}\n/* \u51fd\u6570 */\nint function()\n{\n// do something...\nreturn 0;\n}\nint algorithm(int n)          // \u8f93\u5165\u6570\u636e\n{\nint a = 0;                // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode node = new Node(0);  // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = function();       // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nvar val: Int\nvar next: Node?\ninit(x: Int) {\nval = x\n}\n}\n/* \u51fd\u6570 */\nfunc function() -> Int {\n// do something...\nreturn 0\n}\nfunc algorithm(n: Int) -> Int { // \u8f93\u5165\u6570\u636e\nlet a = 0 // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nvar b = 0 // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nlet node = Node(x: 0) // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nlet c = function() // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c // \u8f93\u51fa\u6570\u636e\n}\n
\n
"},{"location":"chapter_computational_complexity/space_complexity/#232","title":"2.3.2. \u00a0 \u63a8\u7b97\u65b9\u6cd5","text":"

\u7a7a\u95f4\u590d\u6742\u5ea6\u7684\u63a8\u7b97\u65b9\u6cd5\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u603b\u4f53\u7c7b\u4f3c\uff0c\u53ea\u662f\u4ece\u7edf\u8ba1\u201c\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\u201d\u53d8\u4e3a\u7edf\u8ba1\u201c\u4f7f\u7528\u7a7a\u95f4\u5927\u5c0f\u201d\u3002\u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u540c\u7684\u662f\uff0c\u6211\u4eec\u4e00\u822c\u53ea\u5173\u6ce8\u300c\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\u3002\u8fd9\u662f\u56e0\u4e3a\u5185\u5b58\u7a7a\u95f4\u662f\u4e00\u4e2a\u786c\u6027\u8981\u6c42\uff0c\u6211\u4eec\u5fc5\u987b\u4fdd\u8bc1\u5728\u6240\u6709\u8f93\u5165\u6570\u636e\u4e0b\u90fd\u6709\u8db3\u591f\u7684\u5185\u5b58\u7a7a\u95f4\u9884\u7559\u3002

\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e2d\u7684\u201c\u6700\u5dee\u201d\u6709\u4e24\u5c42\u542b\u4e49\uff0c\u5206\u522b\u4e3a\u8f93\u5165\u6570\u636e\u7684\u6700\u5dee\u5206\u5e03\u3001\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u6700\u5dee\u65f6\u95f4\u70b9\u3002

  • \u4ee5\u6700\u5dee\u8f93\u5165\u6570\u636e\u4e3a\u51c6\u3002\u5f53 \\(n < 10\\) \u65f6\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff1b\u4f46\u662f\u5f53 \\(n > 10\\) \u65f6\uff0c\u521d\u59cb\u5316\u7684\u6570\u7ec4 nums \u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\uff1b\u56e0\u6b64\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff1b
  • \u4ee5\u7b97\u6cd5\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u5cf0\u503c\u5185\u5b58\u4e3a\u51c6\u3002\u7a0b\u5e8f\u5728\u6267\u884c\u6700\u540e\u4e00\u884c\u4e4b\u524d\uff0c\u4f7f\u7528 \\(O(1)\\) \u7a7a\u95f4\uff1b\u5f53\u521d\u59cb\u5316\u6570\u7ec4 nums \u65f6\uff0c\u7a0b\u5e8f\u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\uff1b\u56e0\u6b64\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff1b
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 0;                   // O(1)\nint[] b = new int[10000];    // O(1)\nif (n > 10)\nint[] nums = new int[n]; // O(n)\n}\n
void algorithm(int n) {\nint a = 0;               // O(1)\nvector<int> b(10000);    // O(1)\nif (n > 10)\nvector<int> nums(n); // O(n)\n}\n
def algorithm(n: int) -> None:\na: int = 0                     # O(1)\nb: List[int] = [0] * 10000     # O(1)\nif n > 10:\nnums: List[int] = [0] * n  # O(n)\n
func algorithm(n int) {\na := 0                      // O(1)\nb := make([]int, 10000)     // O(1)\nvar nums []int\nif n > 10 {\nnums := make([]int, n)  // O(n)\n}\nfmt.Println(a, b, nums)\n}\n
function algorithm(n) {\nconst a = 0;                   // O(1)\nconst b = new Array(10000);    // O(1)\nif (n > 10) {\nconst nums = new Array(n); // O(n)\n}\n}\n
function algorithm(n: number): void {\nconst a = 0;                   // O(1)\nconst b = new Array(10000);    // O(1)\nif (n > 10) {\nconst nums = new Array(n); // O(n)\n}\n}\n
\n
void algorithm(int n)\n{\nint a = 0;                   // O(1)\nint[] b = new int[10000];    // O(1)\nif (n > 10)\n{\nint[] nums = new int[n]; // O(n)\n}\n}\n
func algorithm(n: Int) {\nlet a = 0 // O(1)\nlet b = Array(repeating: 0, count: 10000) // O(1)\nif n > 10 {\nlet nums = Array(repeating: 0, count: n) // O(n)\n}\n}\n
\n

\u5728\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u9700\u8981\u6ce8\u610f\u7edf\u8ba1\u6808\u5e27\u7a7a\u95f4\u3002\u4f8b\u5982\u51fd\u6570 loop()\uff0c\u5728\u5faa\u73af\u4e2d\u8c03\u7528\u4e86 \\(n\\) \u6b21 function() \uff0c\u6bcf\u8f6e\u4e2d\u7684 function() \u90fd\u8fd4\u56de\u5e76\u91ca\u653e\u4e86\u6808\u5e27\u7a7a\u95f4\uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(1)\\) \u3002\u800c\u9012\u5f52\u51fd\u6570 recur() \u5728\u8fd0\u884c\u4e2d\u4f1a\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 recur() \uff0c\u4ece\u800c\u4f7f\u7528 \\(O(n)\\) \u7684\u6808\u5e27\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
int function() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n) {\nfor (int i = 0; i < n; i++) {\nfunction();\n}\n}\n/* \u9012\u5f52 O(n) */\nvoid recur(int n) {\nif (n == 1) return;\nreturn recur(n - 1);\n}\n
int func() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n) {\nfor (int i = 0; i < n; i++) {\nfunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nvoid recur(int n) {\nif (n == 1) return;\nreturn recur(n - 1);\n}\n
def function() -> int:\n# do something\nreturn 0\n\"\"\" \u5faa\u73af O(1) \"\"\"\ndef loop(n: int) -> None:\nfor _ in range(n):\nfunction()\n\"\"\" \u9012\u5f52 O(n) \"\"\"\ndef recur(n: int) -> int:\nif n == 1: return\nreturn recur(n - 1)\n
func function() int {\n// do something\nreturn 0\n}\n/* \u5faa\u73af O(1) */\nfunc loop(n int) {\nfor i := 0; i < n; i++ {\nfunction()\n}\n}\n/* \u9012\u5f52 O(n) */\nfunc recur(n int) {\nif n == 1 {\nreturn\n}\nrecur(n - 1)\n}\n
function constFunc() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nfunction loop(n) {\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nfunction recur(n) {\nif (n === 1) return;\nreturn recur(n - 1);\n}\n
function constFunc(): number {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nfunction loop(n: number): void {\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nfunction recur(n: number): void {\nif (n === 1) return;\nreturn recur(n - 1);\n}\n
\n
int function()\n{\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n)\n{\nfor (int i = 0; i < n; i++)\n{\nfunction();\n}\n}\n/* \u9012\u5f52 O(n) */\nint recur(int n)\n{\nif (n == 1) return 1;\nreturn recur(n - 1);\n}\n
@discardableResult\nfunc function() -> Int {\n// do something\nreturn 0\n}\n/* \u5faa\u73af O(1) */\nfunc loop(n: Int) {\nfor _ in 0 ..< n {\nfunction()\n}\n}\n/* \u9012\u5f52 O(n) */\nfunc recur(n: Int) {\nif n == 1 {\nreturn\n}\nrecur(n: n - 1)\n}\n
\n
"},{"location":"chapter_computational_complexity/space_complexity/#233","title":"2.3.3. \u00a0 \u5e38\u89c1\u7c7b\u578b","text":"

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u5e38\u89c1\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u7c7b\u578b\u6709\uff08\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\uff09

\\[ \\begin{aligned} O(1) < O(\\log n) < O(n) < O(n^2) < O(2^n) \\newline \\text{\u5e38\u6570\u9636} < \\text{\u5bf9\u6570\u9636} < \\text{\u7ebf\u6027\u9636} < \\text{\u5e73\u65b9\u9636} < \\text{\u6307\u6570\u9636} \\end{aligned} \\]

Fig. \u7a7a\u95f4\u590d\u6742\u5ea6\u7684\u5e38\u89c1\u7c7b\u578b

Tip

\u90e8\u5206\u793a\u4f8b\u4ee3\u7801\u9700\u8981\u4e00\u4e9b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5305\u62ec\u6570\u7ec4\u3001\u94fe\u8868\u3001\u4e8c\u53c9\u6811\u3001\u9012\u5f52\u7b97\u6cd5\u7b49\u3002\u5982\u679c\u9047\u5230\u770b\u4e0d\u61c2\u7684\u5730\u65b9\u65e0\u9700\u62c5\u5fc3\uff0c\u53ef\u4ee5\u5728\u5b66\u4e60\u5b8c\u540e\u9762\u7ae0\u8282\u540e\u518d\u6765\u590d\u4e60\uff0c\u73b0\u9636\u6bb5\u5148\u805a\u7126\u5728\u7406\u89e3\u7a7a\u95f4\u590d\u6742\u5ea6\u542b\u4e49\u548c\u63a8\u7b97\u65b9\u6cd5\u4e0a\u3002

"},{"location":"chapter_computational_complexity/space_complexity/#o1","title":"\u5e38\u6570\u9636 \\(O(1)\\)","text":"

\u5e38\u6570\u9636\u5e38\u89c1\u4e8e\u6570\u91cf\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\u7684\u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u3002

\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u5faa\u73af\u4e2d\u521d\u59cb\u5316\u53d8\u91cf\u6216\u8c03\u7528\u51fd\u6570\u800c\u5360\u7528\u7684\u5185\u5b58\uff0c\u5728\u8fdb\u5165\u4e0b\u4e00\u5faa\u73af\u540e\u5c31\u4f1a\u88ab\u91ca\u653e\uff0c\u5373\u4e0d\u4f1a\u7d2f\u79ef\u5360\u7528\u7a7a\u95f4\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(1)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e38\u6570\u9636 */\nvoid constant(int n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nfinal int a = 0;\nint b = 0;\nint[] nums = new int[10000];\nListNode node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nfunction();\n}\n}\n
space_complexity.cpp
/* \u5e38\u6570\u9636 */\nvoid constant(int n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst int a = 0;\nint b = 0;\nvector<int> nums(10000);\nListNode node(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nfunc();\n}\n}\n
space_complexity.py
def constant(n: int) -> None:\n\"\"\" \u5e38\u6570\u9636 \"\"\"\n# \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\na: int = 0\nnums: List[int] = [0] * 10000\nnode = ListNode(0)\n# \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in range(n):\nc: int = 0\n# \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in range(n):\nfunction()\n
space_complexity.go
/* \u5e38\u6570\u9636 */\nfunc spaceConstant(n int) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0\nb := 0\nnums := make([]int, 10000)\nListNode := newNode(0)\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nvar c int\nfor i := 0; i < n; i++ {\nc = 0\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor i := 0; i < n; i++ {\nfunction()\n}\nfmt.Println(a, b, nums, c, ListNode)\n}\n
space_complexity.js
/* \u5e38\u6570\u9636 */\nfunction constant(n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0;\nconst b = 0;\nconst nums = new Array(10000);\nconst node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconst c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n
space_complexity.ts
/* \u5e38\u6570\u9636 */\nfunction constant(n: number): void {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0;\nconst b = 0;\nconst nums = new Array(10000);\nconst node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconst c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceConstant}\n
space_complexity.cs
/* \u5e38\u6570\u9636 */\nvoid constant(int n)\n{\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nint a = 0;\nint b = 0;\nint[] nums = new int[10000];\nListNode node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++)\n{\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++)\n{\nfunction();\n}\n}\n
space_complexity.swift
/* \u5e38\u6570\u9636 */\nfunc constant(n: Int) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nlet a = 0\nvar b = 0\nlet nums = Array(repeating: 0, count: 10000)\nlet node = ListNode(x: 0)\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in 0 ..< n {\nlet c = 0\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in 0 ..< n {\nfunction()\n}\n}\n
space_complexity.zig
// \u5e38\u6570\u9636\nfn constant(n: i32) void {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a: i32 = 0;\nvar b: i32 = 0;\nvar nums = [_]i32{0}**10000;\nvar node = inc.ListNode(i32){.val = 0};\nvar i: i32 = 0;\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nwhile (i < n) : (i += 1) {\nvar c: i32 = 0;\n_ = c;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\ni = 0;\nwhile (i < n) : (i += 1) {\n_ = function();\n}\n_ = a;\n_ = b;\n_ = nums;\n_ = node;\n}\n
"},{"location":"chapter_computational_complexity/space_complexity/#on","title":"\u7ebf\u6027\u9636 \\(O(n)\\)","text":"

\u7ebf\u6027\u9636\u5e38\u89c1\u4e8e\u5143\u7d20\u6570\u91cf\u4e0e \\(n\\) \u6210\u6b63\u6bd4\u7684\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u7b49\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u7ebf\u6027\u9636 */\nvoid linear(int n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nint[] nums = new int[n];\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nList<ListNode> nodes = new ArrayList<>();\nfor (int i = 0; i < n; i++) {\nnodes.add(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nMap<Integer, String> map = new HashMap<>();\nfor (int i = 0; i < n; i++) {\nmap.put(i, String.valueOf(i));\n}\n}\n
space_complexity.cpp
/* \u7ebf\u6027\u9636 */\nvoid linear(int n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nvector<int> nums(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvector<ListNode> nodes;\nfor (int i = 0; i < n; i++) {\nnodes.push_back(ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nunordered_map<int, string> map;\nfor (int i = 0; i < n; i++) {\nmap[i] = to_string(i);\n}\n}\n
space_complexity.py
def linear(n: int) -> None:\n\"\"\" \u7ebf\u6027\u9636 \"\"\"\n# \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nnums: List[int] = [0] * n\n# \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nmapp: Dict = {}\nfor i in range(n):\nmapp[i] = str(i)\n
space_complexity.go
/* \u7ebf\u6027\u9636 */\nfunc spaceLinear(n int) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\n_ = make([]int, n)\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar nodes []*node\nfor i := 0; i < n; i++ {\nnodes = append(nodes, newNode(i))\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nm := make(map[int]string, n)\nfor i := 0; i < n; i++ {\nm[i] = strconv.Itoa(i)\n}\n}\n
space_complexity.js
/* \u7ebf\u6027\u9636 */\nfunction linear(n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nconst nums = new Array(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst nodes = [];\nfor (let i = 0; i < n; i++) {\nnodes.push(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst map = new Map();\nfor (let i = 0; i < n; i++) {\nmap.set(i, i.toString());\n}\n}\n
space_complexity.ts
/* \u7ebf\u6027\u9636 */\nfunction linear(n: number): void {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nconst nums = new Array(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst nodes: ListNode[] = [];\nfor (let i = 0; i < n; i++) {\nnodes.push(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst map = new Map();\nfor (let i = 0; i < n; i++) {\nmap.set(i, i.toString());\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceLinear}\n
space_complexity.cs
/* \u7ebf\u6027\u9636 */\nvoid linear(int n)\n{\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nint[] nums = new int[n];\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nList<ListNode> nodes = new();\nfor (int i = 0; i < n; i++)\n{\nnodes.Add(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nDictionary<int, String> map = new();\nfor (int i = 0; i < n; i++)\n{\nmap.Add(i, i.ToString());\n}\n}\n
space_complexity.swift
/* \u7ebf\u6027\u9636 */\nfunc linear(n: Int) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nlet nums = Array(repeating: 0, count: n)\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nlet nodes = (0 ..< n).map { ListNode(x: $0) }\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nlet map = Dictionary(uniqueKeysWithValues: (0 ..< n).map { ($0, \"\\($0)\") })\n}\n
space_complexity.zig
// \u7ebf\u6027\u9636\nfn linear(comptime n: i32) !void {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nvar nums = [_]i32{0}**n;\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar nodes = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer nodes.deinit();\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\ntry nodes.append(i);\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar map = std.AutoArrayHashMap(i32, []const u8).init(std.heap.page_allocator);\ndefer map.deinit();\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\nconst string = try std.fmt.allocPrint(std.heap.page_allocator, \"{d}\", .{j});\ndefer std.heap.page_allocator.free(string);\ntry map.put(i, string);\n}\n_ = nums;\n}\n

\u4ee5\u4e0b\u9012\u5f52\u51fd\u6570\u4f1a\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 algorithm() \u51fd\u6570\uff0c\u4f7f\u7528 \\(O(n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n) {\nSystem.out.println(\"\u9012\u5f52 n = \" + n);\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.cpp
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n) {\ncout << \"\u9012\u5f52 n = \" << n << endl;\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.py
def linear_recur(n: int) -> None:\n\"\"\" \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 \"\"\"\nprint(\"\u9012\u5f52 n =\", n)\nif n == 1: return\nlinear_recur(n - 1)\n
space_complexity.go
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc spaceLinearRecur(n int) {\nfmt.Println(\"\u9012\u5f52 n =\", n)\nif n == 1 {\nreturn\n}\nspaceLinearRecur(n - 1)\n}\n
space_complexity.js
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction linearRecur(n) {\nconsole.log(`\u9012\u5f52 n = ${n}`);\nif (n === 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.ts
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction linearRecur(n: number): void {\nconsole.log(`\u9012\u5f52 n = ${n}`);\nif (n === 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.c
[class]{}-[func]{spaceLinearRecur}\n
space_complexity.cs
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n)\n{\nConsole.WriteLine(\"\u9012\u5f52 n = \" + n);\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.swift
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc linearRecur(n: Int) {\nprint(\"\u9012\u5f52 n = \\(n)\")\nif n == 1 {\nreturn\n}\nlinearRecur(n: n - 1)\n}\n
space_complexity.zig
// \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn linearRecur(comptime n: i32) void {\nstd.debug.print(\"\u9012\u5f52 n = {}\\n\", .{n});\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n

Fig. \u9012\u5f52\u51fd\u6570\u4ea7\u751f\u7684\u7ebf\u6027\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#on2","title":"\u5e73\u65b9\u9636 \\(O(n^2)\\)","text":"

\u5e73\u65b9\u9636\u5e38\u89c1\u4e8e\u5143\u7d20\u6570\u91cf\u4e0e \\(n\\) \u6210\u5e73\u65b9\u5173\u7cfb\u7684\u77e9\u9635\u3001\u56fe\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nint[][] numMatrix = new int[n][n];\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nList<List<Integer>> numList = new ArrayList<>();\nfor (int i = 0; i < n; i++) {\nList<Integer> tmp = new ArrayList<>();\nfor (int j = 0; j < n; j++) {\ntmp.add(0);\n}\nnumList.add(tmp);\n}\n}\n
space_complexity.cpp
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n) {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nvector<vector<int>> numMatrix;\nfor (int i = 0; i < n; i++) {\nvector<int> tmp;\nfor (int j = 0; j < n; j++) {\ntmp.push_back(0);\n}\nnumMatrix.push_back(tmp);\n}\n}\n
space_complexity.py
def quadratic(n: int) -> None:\n\"\"\" \u5e73\u65b9\u9636 \"\"\"\n# \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nnum_matrix: List[List[int]] = [[0] * n for _ in range(n)]\n
space_complexity.go
/* \u5e73\u65b9\u9636 */\nfunc spaceQuadratic(n int) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nnumMatrix := make([][]int, n)\nfor i := 0; i < n; i++ {\nnumMatrix[i] = make([]int, n)\n}\n}\n
space_complexity.js
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numMatrix = Array(n).fill(null).map(() => Array(n).fill(null));\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numList = [];\nfor (let i = 0; i < n; i++) {\nconst tmp = [];\nfor (let j = 0; j < n; j++) {\ntmp.push(0);\n}\nnumList.push(tmp);\n}\n}\n
space_complexity.ts
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n: number): void {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numMatrix = Array(n)\n.fill(null)\n.map(() => Array(n).fill(null));\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numList = [];\nfor (let i = 0; i < n; i++) {\nconst tmp = [];\nfor (let j = 0; j < n; j++) {\ntmp.push(0);\n}\nnumList.push(tmp);\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceQuadratic}\n
space_complexity.cs
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n)\n{\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nint[,] numMatrix = new int[n, n];\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nList<List<int>> numList = new();\nfor (int i = 0; i < n; i++)\n{\nList<int> tmp = new();\nfor (int j = 0; j < n; j++)\n{\ntmp.Add(0);\n}\nnumList.Add(tmp);\n}\n}\n
space_complexity.swift
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n: Int) {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nlet numList = Array(repeating: Array(repeating: 0, count: n), count: n)\n}\n
space_complexity.zig
// \u5e73\u65b9\u9636\nfn quadratic(n: i32) !void {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nvar nodes = std.ArrayList(std.ArrayList(i32)).init(std.heap.page_allocator);\ndefer nodes.deinit();\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\nvar tmp = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer tmp.deinit();\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\ntry tmp.append(0);\n}\ntry nodes.append(tmp);\n}\n}\n

\u5728\u4ee5\u4e0b\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 algorithm() \uff0c\u5e76\u4e14\u6bcf\u4e2a\u51fd\u6570\u4e2d\u90fd\u521d\u59cb\u5316\u4e86\u4e00\u4e2a\u6570\u7ec4\uff0c\u957f\u5ea6\u5206\u522b\u4e3a \\(n, n-1, n-2, ..., 2, 1\\) \uff0c\u5e73\u5747\u957f\u5ea6\u4e3a \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u603b\u4f53\u4f7f\u7528 \\(O(n^2)\\) \u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n) {\nif (n <= 0) return 0;\n// \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nint[] nums = new int[n];\nSystem.out.println(\"\u9012\u5f52 n = \" + n + \" \u4e2d\u7684 nums \u957f\u5ea6 = \" + nums.length);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.cpp
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n) {\nif (n <= 0) return 0;\nvector<int> nums(n);\ncout << \"\u9012\u5f52 n = \" << n << \" \u4e2d\u7684 nums \u957f\u5ea6 = \" << nums.size() << endl;\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.py
def quadratic_recur(n: int) -> int:\n\"\"\" \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 \"\"\"\nif n <= 0: return 0\n# \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nnums: List[int] = [0] * n\nreturn quadratic_recur(n - 1)\n
space_complexity.go
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc spaceQuadraticRecur(n int) int {\nif n <= 0 {\nreturn 0\n}\nnums := make([]int, n)\nfmt.Printf(\"\u9012\u5f52 n = %d \u4e2d\u7684 nums \u957f\u5ea6 = %d \\n\", n, len(nums))\nreturn spaceQuadraticRecur(n - 1)\n}\n
space_complexity.js
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction quadraticRecur(n) {\nif (n <= 0) return 0;\nconst nums = new Array(n);\nconsole.log(`\u9012\u5f52 n = ${n} \u4e2d\u7684 nums \u957f\u5ea6 = ${nums.length}`);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.ts
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction quadraticRecur(n: number): number {\nif (n <= 0) return 0;\nconst nums = new Array(n);\nconsole.log(`\u9012\u5f52 n = ${n} \u4e2d\u7684 nums \u957f\u5ea6 = ${nums.length}`);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.c
[class]{}-[func]{spaceQuadraticRecur}\n
space_complexity.cs
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n)\n{\nif (n <= 0) return 0;\nint[] nums = new int[n];\nConsole.WriteLine(\"\u9012\u5f52 n = \" + n + \" \u4e2d\u7684 nums \u957f\u5ea6 = \" + nums.Length);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.swift
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\n@discardableResult\nfunc quadraticRecur(n: Int) -> Int {\nif n <= 0 {\nreturn 0\n}\n// \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nlet nums = Array(repeating: 0, count: n)\nprint(\"\u9012\u5f52 n = \\(n) \u4e2d\u7684 nums \u957f\u5ea6 = \\(nums.count)\")\nreturn quadraticRecur(n: n - 1)\n}\n
space_complexity.zig
// \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn quadraticRecur(comptime n: i32) i32 {\nif (n <= 0) return 0;\nvar nums = [_]i32{0}**n;\nstd.debug.print(\"\u9012\u5f52 n = {} \u4e2d\u7684 nums \u957f\u5ea6 = {}\\n\", .{n, nums.len});\nreturn quadraticRecur(n - 1);\n}\n

Fig. \u9012\u5f52\u51fd\u6570\u4ea7\u751f\u7684\u5e73\u65b9\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#o2n","title":"\u6307\u6570\u9636 \\(O(2^n)\\)","text":"

\u6307\u6570\u9636\u5e38\u89c1\u4e8e\u4e8c\u53c9\u6811\u3002\u9ad8\u5ea6\u4e3a \\(n\\) \u7684\u300c\u6ee1\u4e8c\u53c9\u6811\u300d\u7684\u7ed3\u70b9\u6570\u91cf\u4e3a \\(2^n - 1\\) \uff0c\u4f7f\u7528 \\(O(2^n)\\) \u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode buildTree(int n) {\nif (n == 0) return null;\nTreeNode root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.cpp
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode* buildTree(int n) {\nif (n == 0) return nullptr;\nTreeNode* root = new TreeNode(0);\nroot->left = buildTree(n - 1);\nroot->right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.py
def build_tree(n: int) -> Optional[TreeNode]:\n\"\"\" \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 \"\"\"\nif n == 0: return None\nroot = TreeNode(0)\nroot.left = build_tree(n - 1)\nroot.right = build_tree(n - 1)\nreturn root\n
space_complexity.go
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunc buildTree(n int) *treeNode {\nif n == 0 {\nreturn nil\n}\nroot := newTreeNode(0)\nroot.left = buildTree(n - 1)\nroot.right = buildTree(n - 1)\nreturn root\n}\n
space_complexity.js
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunction buildTree(n) {\nif (n === 0) return null;\nconst root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.ts
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunction buildTree(n: number): TreeNode | null {\nif (n === 0) return null;\nconst root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.c
[class]{}-[func]{buildTree}\n
space_complexity.cs
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode? buildTree(int n)\n{\nif (n == 0) return null;\nTreeNode root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.swift
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunc buildTree(n: Int) -> TreeNode? {\nif n == 0 {\nreturn nil\n}\nlet root = TreeNode(x: 0)\nroot.left = buildTree(n: n - 1)\nroot.right = buildTree(n: n - 1)\nreturn root\n}\n
space_complexity.zig
// \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09\nfn buildTree(mem_allocator: std.mem.Allocator, n: i32) !?*inc.TreeNode(i32) {\nif (n == 0) return null;\nconst root = try mem_allocator.create(inc.TreeNode(i32));\nroot.init(0);\nroot.left = try buildTree(mem_allocator, n - 1);\nroot.right = try buildTree(mem_allocator, n - 1);\nreturn root;\n}\n

Fig. \u6ee1\u4e8c\u53c9\u6811\u4ea7\u751f\u7684\u6307\u6570\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#olog-n","title":"\u5bf9\u6570\u9636 \\(O(\\log n)\\)","text":"

\u5bf9\u6570\u9636\u5e38\u89c1\u4e8e\u5206\u6cbb\u7b97\u6cd5\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u7b49\u3002

\u4f8b\u5982\u300c\u5f52\u5e76\u6392\u5e8f\u300d\uff0c\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6570\u7ec4\u53ef\u4ee5\u5f62\u6210\u9ad8\u5ea6\u4e3a \\(\\log n\\) \u7684\u9012\u5f52\u6811\uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

\u518d\u4f8b\u5982\u300c\u6570\u5b57\u8f6c\u5316\u4e3a\u5b57\u7b26\u4e32\u300d\uff0c\u8f93\u5165\u4efb\u610f\u6b63\u6574\u6570 \\(n\\) \uff0c\u5b83\u7684\u4f4d\u6570\u4e3a \\(\\log_{10} n\\) \uff0c\u5373\u5bf9\u5e94\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a \\(\\log_{10} n\\) \uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log_{10} n) = O(\\log n)\\) \u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/","title":"2.4. \u00a0 \u6743\u8861\u65f6\u95f4\u4e0e\u7a7a\u95f4","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u90fd\u80fd\u591f\u8fbe\u5230\u6700\u4f18\uff0c\u800c\u5b9e\u9645\u4e0a\uff0c\u540c\u65f6\u4f18\u5316\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u662f\u975e\u5e38\u56f0\u96be\u7684\u3002

\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u5f80\u5f80\u662f\u4ee5\u63d0\u5347\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a\u4ee3\u4ef7\u7684\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002\u6211\u4eec\u628a\u727a\u7272\u5185\u5b58\u7a7a\u95f4\u6765\u63d0\u5347\u7b97\u6cd5\u8fd0\u884c\u901f\u5ea6\u7684\u601d\u8def\u79f0\u4e3a\u300c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u300d\uff1b\u53cd\u4e4b\uff0c\u79f0\u4e4b\u4e3a\u300c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u300d\u3002\u9009\u62e9\u54ea\u79cd\u601d\u8def\u53d6\u51b3\u4e8e\u6211\u4eec\u66f4\u770b\u91cd\u54ea\u4e2a\u65b9\u9762\u3002

\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u90fd\u662f\u6bd4\u7a7a\u95f4\u66f4\u5b9d\u8d35\u7684\uff0c\u53ea\u8981\u7a7a\u95f4\u590d\u6742\u5ea6\u4e0d\u8981\u592a\u79bb\u8c31\u3001\u80fd\u63a5\u53d7\u5c31\u884c\uff0c\u56e0\u6b64\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u6700\u4e3a\u5e38\u7528\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#241","title":"2.4.1. \u00a0 \u793a\u4f8b\u9898\u76ee *","text":"

\u4ee5 LeetCode \u5168\u7ad9\u7b2c\u4e00\u9898 \u4e24\u6570\u4e4b\u548c \u4e3a\u4f8b\u3002

\u4e24\u6570\u4e4b\u548c

\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums \u548c\u4e00\u4e2a\u6574\u6570\u76ee\u6807\u503c target \uff0c\u8bf7\u4f60\u5728\u8be5\u6570\u7ec4\u4e2d\u627e\u51fa\u201c\u548c\u201d\u4e3a\u76ee\u6807\u503c target \u7684\u90a3\u4e24\u4e2a\u6574\u6570\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u6570\u7ec4\u4e0b\u6807\u3002

\u4f60\u53ef\u4ee5\u5047\u8bbe\u6bcf\u79cd\u8f93\u5165\u53ea\u4f1a\u5bf9\u5e94\u4e00\u4e2a\u7b54\u6848\u3002\u4f46\u662f\uff0c\u6570\u7ec4\u4e2d\u540c\u4e00\u4e2a\u5143\u7d20\u5728\u7b54\u6848\u91cc\u4e0d\u80fd\u91cd\u590d\u51fa\u73b0\u3002

\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u8fd4\u56de\u7b54\u6848\u3002

\u300c\u66b4\u529b\u679a\u4e3e\u300d\u548c\u300c\u8f85\u52a9\u54c8\u5e0c\u8868\u300d\u5206\u522b\u5bf9\u5e94 \u7a7a\u95f4\u6700\u4f18 \u548c \u65f6\u95f4\u6700\u4f18 \u7684\u4e24\u79cd\u89e3\u6cd5\u3002\u672c\u7740\u65f6\u95f4\u6bd4\u7a7a\u95f4\u66f4\u5b9d\u8d35\u7684\u539f\u5219\uff0c\u540e\u8005\u662f\u672c\u9898\u7684\u6700\u4f73\u89e3\u6cd5\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#_1","title":"\u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e","text":"

\u8003\u8651\u76f4\u63a5\u904d\u5386\u6240\u6709\u6240\u6709\u53ef\u80fd\u6027\u3002\u901a\u8fc7\u5f00\u542f\u4e00\u4e2a\u4e24\u5c42\u5faa\u73af\uff0c\u5224\u65ad\u4e24\u4e2a\u6574\u6570\u7684\u548c\u662f\u5426\u4e3a target \uff0c\u82e5\u662f\u5219\u8fd4\u56de\u5b83\u4fe9\u7684\u7d22\u5f15\uff08\u5373\u4e0b\u6807\uff09\u5373\u53ef\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig leetcode_two_sum.java
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nint[] twoSumBruteForce(int[] nums, int target) {\nint size = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++) {\nfor (int j = i + 1; j < size; j++) {\nif (nums[i] + nums[j] == target)\nreturn new int[] { i, j };\n}\n}\nreturn new int[0];\n}\n
leetcode_two_sum.cpp
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nvector<int> twoSumBruteForce(vector<int>& nums, int target) {\nint size = nums.size();\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++) {\nfor (int j = i + 1; j < size; j++) {\nif (nums[i] + nums[j] == target)\nreturn { i, j };\n}\n}\nreturn {};\n}\n
leetcode_two_sum.py
def two_sum_brute_force(nums: List[int], target: int) -> List[int]:\n\"\"\" \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e \"\"\"\n# \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i in range(len(nums) - 1):\nfor j in range(i + 1, len(nums)):\nif nums[i] + nums[j] == target:\nreturn [i, j]\nreturn []\n
leetcode_two_sum.go
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunc twoSumBruteForce(nums []int, target int) []int {\nsize := len(nums)\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i := 0; i < size-1; i++ {\nfor j := i + 1; i < size; j++ {\nif nums[i]+nums[j] == target {\nreturn []int{i, j}\n}\n}\n}\nreturn nil\n}\n
leetcode_two_sum.js
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunction twoSumBruteForce(nums, target) {\nconst n = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (let i = 0; i < n; i++) {\nfor (let j = i + 1; j < n; j++) {\nif (nums[i] + nums[j] === target) {\nreturn [i, j];\n}\n}\n}\nreturn [];\n}\n
leetcode_two_sum.ts
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunction twoSumBruteForce(nums: number[], target: number): number[] {\nconst n = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (let i = 0; i < n; i++) {\nfor (let j = i + 1; j < n; j++) {\nif (nums[i] + nums[j] === target) {\nreturn [i, j];\n}\n}\n}\nreturn [];\n};\n
leetcode_two_sum.c
[class]{}-[func]{twoSumBruteForce}\n
leetcode_two_sum.cs
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nint[] twoSumBruteForce(int[] nums, int target)\n{\nint size = nums.Length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++)\n{\nfor (int j = i + 1; j < size; j++)\n{\nif (nums[i] + nums[j] == target)\nreturn new int[] { i, j };\n}\n}\nreturn new int[0];\n}\n
leetcode_two_sum.swift
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunc twoSumBruteForce(nums: [Int], target: Int) -> [Int] {\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i in nums.indices.dropLast() {\nfor j in nums.indices.dropFirst(i + 1) {\nif nums[i] + nums[j] == target {\nreturn [i, j]\n}\n}\n}\nreturn [0]\n}\n
leetcode_two_sum.zig
// \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e\nfn twoSumBruteForce(nums: []i32, target: i32) ?[2]i32 {\nvar size: usize = nums.len;\nvar i: usize = 0;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nwhile (i < size - 1) : (i += 1) {\nvar j = i + 1;\nwhile (j < size) : (j += 1) {\nif (nums[i] + nums[j] == target) {\nreturn [_]i32{@intCast(i32, i), @intCast(i32, j)};\n}\n}\n}\nreturn null;\n}\n

\u8be5\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N^2)\\) \uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u5c5e\u4e8e\u65f6\u95f4\u6362\u7a7a\u95f4\u3002\u672c\u65b9\u6cd5\u65f6\u95f4\u590d\u6742\u5ea6\u8f83\u9ad8\uff0c\u5728\u5927\u6570\u636e\u91cf\u4e0b\u975e\u5e38\u8017\u65f6\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#_2","title":"\u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868","text":"

\u8003\u8651\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\uff0ckey \u4e3a\u6570\u7ec4\u5143\u7d20\u3001value \u4e3a\u5143\u7d20\u7d22\u5f15\u3002\u5faa\u73af\u904d\u5386\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20 num \uff0c\u5e76\u6267\u884c\uff1a

  1. \u5224\u65ad\u6570\u5b57 target - num \u662f\u5426\u5728\u54c8\u5e0c\u8868\u4e2d\uff0c\u82e5\u662f\u5219\u76f4\u63a5\u8fd4\u56de\u8be5\u4e24\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\uff1b
  2. \u5c06\u5143\u7d20 num \u548c\u5176\u7d22\u5f15\u6dfb\u52a0\u8fdb\u54c8\u5e0c\u8868\uff1b
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig leetcode_two_sum.java
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nint[] twoSumHashTable(int[] nums, int target) {\nint size = nums.length;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nMap<Integer, Integer> dic = new HashMap<>();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++) {\nif (dic.containsKey(target - nums[i])) {\nreturn new int[] { dic.get(target - nums[i]), i };\n}\ndic.put(nums[i], i);\n}\nreturn new int[0];\n}\n
leetcode_two_sum.cpp
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nvector<int> twoSumHashTable(vector<int>& nums, int target) {\nint size = nums.size();\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nunordered_map<int, int> dic;\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++) {\nif (dic.find(target - nums[i]) != dic.end()) {\nreturn { dic[target - nums[i]], i };\n}\ndic.emplace(nums[i], i);\n}\nreturn {};\n}\n
leetcode_two_sum.py
def two_sum_hash_table(nums: List[int], target: int) -> List[int]:\n\"\"\" \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 \"\"\"\n# \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\ndic = {}\n# \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor i in range(len(nums)):\nif target - nums[i] in dic:\nreturn [dic[target - nums[i]], i]\ndic[nums[i]] = i\nreturn []\n
leetcode_two_sum.go
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunc twoSumHashTable(nums []int, target int) []int {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nhashTable := map[int]int{}\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor idx, val := range nums {\nif preIdx, ok := hashTable[target-val]; ok {\nreturn []int{preIdx, idx}\n}\nhashTable[val] = idx\n}\nreturn nil\n}\n
leetcode_two_sum.js
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunction twoSumHashTable(nums, target) {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nlet m = {};\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (let i = 0; i < nums.length; i++) {\nif (m[nums[i]] !== undefined) {\nreturn [m[nums[i]], i];\n} else {\nm[target - nums[i]] = i;\n}\n}\nreturn [];\n}\n
leetcode_two_sum.ts
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunction twoSumHashTable(nums: number[], target: number): number[] {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nlet m: Map<number, number> = new Map();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (let i = 0; i < nums.length; i++) {\nlet index = m.get(nums[i]);\nif (index !== undefined) {\nreturn [index, i];\n} else {\nm.set(target - nums[i], i);\n}\n}\nreturn [];\n};\n
leetcode_two_sum.c
[class]{}-[func]{twoSumHashTable}\n
leetcode_two_sum.cs
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nint[] twoSumHashTable(int[] nums, int target)\n{\nint size = nums.Length;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nDictionary<int, int> dic = new();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++)\n{\nif (dic.ContainsKey(target - nums[i]))\n{\nreturn new int[] { dic[target - nums[i]], i };\n}\ndic.Add(nums[i], i);\n}\nreturn new int[0];\n}\n
leetcode_two_sum.swift
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunc twoSumHashTable(nums: [Int], target: Int) -> [Int] {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nvar dic: [Int: Int] = [:]\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor i in nums.indices {\nif let j = dic[target - nums[i]] {\nreturn [j, i]\n}\ndic[nums[i]] = i\n}\nreturn [0]\n}\n
leetcode_two_sum.zig
// \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868\nfn twoSumHashTable(nums: []i32, target: i32) !?[2]i32 {\nvar size: usize = nums.len;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nvar dic = std.AutoHashMap(i32, i32).init(std.heap.page_allocator);\ndefer dic.deinit();\nvar i: usize = 0;\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nwhile (i < size) : (i += 1) {\nif (dic.contains(target - nums[i])) {\nreturn [_]i32{dic.get(target - nums[i]).?, @intCast(i32, i)};\n}\ntry dic.put(nums[i], @intCast(i32, i));\n}\nreturn null;\n}\n

\u8be5\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff0c\u4f53\u73b0\u7a7a\u95f4\u6362\u65f6\u95f4\u3002\u672c\u65b9\u6cd5\u867d\u7136\u5f15\u5165\u4e86\u989d\u5916\u7a7a\u95f4\u4f7f\u7528\uff0c\u4f46\u65f6\u95f4\u548c\u7a7a\u95f4\u4f7f\u7528\u6574\u4f53\u66f4\u52a0\u5747\u8861\uff0c\u56e0\u6b64\u4e3a\u672c\u9898\u6700\u4f18\u89e3\u6cd5\u3002

"},{"location":"chapter_computational_complexity/summary/","title":"2.5. \u00a0 \u5c0f\u7ed3","text":""},{"location":"chapter_computational_complexity/summary/#_1","title":"\u7b97\u6cd5\u6548\u7387\u8bc4\u4f30","text":"
  • \u300c\u65f6\u95f4\u6548\u7387\u300d\u548c\u300c\u7a7a\u95f4\u6548\u7387\u300d\u662f\u7b97\u6cd5\u6027\u80fd\u7684\u4e24\u4e2a\u91cd\u8981\u7684\u8bc4\u4ef7\u7ef4\u5ea6\u3002
  • \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u300c\u5b9e\u9645\u6d4b\u8bd5\u300d\u6765\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\uff0c\u4f46\u96be\u4ee5\u6392\u9664\u6d4b\u8bd5\u73af\u5883\u7684\u5e72\u6270\uff0c\u5e76\u4e14\u975e\u5e38\u8017\u8d39\u8ba1\u7b97\u8d44\u6e90\u3002
  • \u300c\u590d\u6742\u5ea6\u5206\u6790\u300d\u514b\u670d\u4e86\u5b9e\u9645\u6d4b\u8bd5\u7684\u5f0a\u7aef\uff0c\u5206\u6790\u7ed3\u679c\u9002\u7528\u4e8e\u6240\u6709\u8fd0\u884c\u5e73\u53f0\uff0c\u5e76\u4e14\u53ef\u4ee5\u4f53\u73b0\u4e0d\u540c\u6570\u636e\u5927\u5c0f\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\u3002
"},{"location":"chapter_computational_complexity/summary/#_2","title":"\u65f6\u95f4\u590d\u6742\u5ea6","text":"
  • \u300c\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\uff0c\u53ef\u4ee5\u6709\u6548\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u5931\u6548\uff0c\u6bd4\u5982\u5728\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5c0f\u6216\u65f6\u95f4\u590d\u6742\u5ea6\u76f8\u540c\u65f6\uff0c\u65e0\u6cd5\u7cbe\u786e\u5bf9\u6bd4\u7b97\u6cd5\u6548\u7387\u7684\u4f18\u52a3\u6027\u3002
  • \u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u4f7f\u7528\u5927 \\(O\\) \u7b26\u53f7\u8868\u793a\uff0c\u5373\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\uff0c\u5176\u53cd\u6620\u5f53 \\(n\\) \u8d8b\u4e8e\u6b63\u65e0\u7a77\u65f6\uff0c\\(T(n)\\) \u5904\u4e8e\u4f55\u79cd\u589e\u957f\u7ea7\u522b\u3002
  • \u63a8\u7b97\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u4e3a\u4e24\u6b65\uff0c\u9996\u5148\u7edf\u8ba1\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\uff0c\u518d\u5224\u65ad\u6e10\u8fd1\u4e0a\u754c\u3002
  • \u5e38\u89c1\u65f6\u95f4\u590d\u6742\u5ea6\u4ece\u5c0f\u5230\u5927\u6392\u5217\u6709 \\(O(1)\\) , \\(O(\\log n)\\) , \\(O(n)\\) , \\(O(n \\log n)\\) , \\(O(n^2)\\) , \\(O(2^n)\\) , \\(O(n!)\\) \u3002
  • \u67d0\u4e9b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u662f\u6052\u5b9a\u7684\uff0c\u800c\u662f\u4e0e\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\u6709\u5173\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u4e3a\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u548c\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u540e\u8005\u51e0\u4e4e\u4e0d\u7528\uff0c\u56e0\u4e3a\u8f93\u5165\u6570\u636e\u9700\u8981\u6ee1\u8db3\u82db\u523b\u7684\u6761\u4ef6\u624d\u80fd\u8fbe\u5230\u6700\u4f73\u60c5\u51b5\u3002
  • \u300c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u53ef\u4ee5\u53cd\u6620\u5728\u968f\u673a\u6570\u636e\u8f93\u5165\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\uff0c\u6700\u8d34\u5408\u5b9e\u9645\u4f7f\u7528\u60c5\u51b5\u4e0b\u7684\u7b97\u6cd5\u6027\u80fd\u3002\u8ba1\u7b97\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u9700\u8981\u7edf\u8ba1\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\uff0c\u4ee5\u53ca\u7efc\u5408\u540e\u7684\u6570\u5b66\u671f\u671b\u3002
"},{"location":"chapter_computational_complexity/summary/#_3","title":"\u7a7a\u95f4\u590d\u6742\u5ea6","text":"
  • \u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u5b9a\u4e49\u7c7b\u4f3c\uff0c\u300c\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\u7edf\u8ba1\u7b97\u6cd5\u5360\u7528\u7a7a\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002

  • \u7b97\u6cd5\u8fd0\u884c\u4e2d\u76f8\u5173\u5185\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u8f93\u5165\u7a7a\u95f4\u3001\u6682\u5b58\u7a7a\u95f4\u3001\u8f93\u51fa\u7a7a\u95f4\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165\u7a7a\u95f4\u4e0d\u8ba1\u5165\u7a7a\u95f4\u590d\u6742\u5ea6\u8ba1\u7b97\u3002\u6682\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u6307\u4ee4\u7a7a\u95f4\u3001\u6570\u636e\u7a7a\u95f4\u3001\u6808\u5e27\u7a7a\u95f4\uff0c\u5176\u4e2d\u6808\u5e27\u7a7a\u95f4\u4e00\u822c\u5728\u9012\u5f52\u51fd\u6570\u4e2d\u624d\u4f1a\u5f71\u54cd\u5230\u7a7a\u95f4\u590d\u6742\u5ea6\u3002

  • \u6211\u4eec\u4e00\u822c\u53ea\u5173\u5fc3\u300c\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u5373\u7edf\u8ba1\u7b97\u6cd5\u5728\u300c\u6700\u5dee\u8f93\u5165\u6570\u636e\u300d\u548c\u300c\u6700\u5dee\u8fd0\u884c\u65f6\u95f4\u70b9\u300d\u4e0b\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u3002
  • \u5e38\u89c1\u7a7a\u95f4\u590d\u6742\u5ea6\u4ece\u5c0f\u5230\u5927\u6392\u5217\u6709 \\(O(1)\\) , \\(O(\\log n)\\) , \\(O(n)\\) , \\(O(n^2)\\) , \\(O(2^n)\\) \u3002
"},{"location":"chapter_computational_complexity/time_complexity/","title":"2.2. \u00a0 \u65f6\u95f4\u590d\u6742\u5ea6","text":""},{"location":"chapter_computational_complexity/time_complexity/#221","title":"2.2.1. \u00a0 \u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4","text":"

\u8fd0\u884c\u65f6\u95f4\u80fd\u591f\u76f4\u89c2\u4e14\u51c6\u786e\u5730\u4f53\u73b0\u51fa\u7b97\u6cd5\u7684\u6548\u7387\u6c34\u5e73\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981 \u51c6\u786e\u9884\u4f30\u4e00\u6bb5\u4ee3\u7801\u7684\u8fd0\u884c\u65f6\u95f4 \uff0c\u8be5\u5982\u4f55\u505a\u5462\uff1f

  1. \u9996\u5148\u9700\u8981 \u786e\u5b9a\u8fd0\u884c\u5e73\u53f0 \uff0c\u5305\u62ec\u786c\u4ef6\u914d\u7f6e\u3001\u7f16\u7a0b\u8bed\u8a00\u3001\u7cfb\u7edf\u73af\u5883\u7b49\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u5f71\u54cd\u5230\u4ee3\u7801\u7684\u8fd0\u884c\u6548\u7387\u3002
  2. \u8bc4\u4f30 \u5404\u79cd\u8ba1\u7b97\u64cd\u4f5c\u7684\u6240\u9700\u8fd0\u884c\u65f6\u95f4 \uff0c\u4f8b\u5982\u52a0\u6cd5\u64cd\u4f5c + \u9700\u8981 1 ns \uff0c\u4e58\u6cd5\u64cd\u4f5c * \u9700\u8981 10 ns \uff0c\u6253\u5370\u64cd\u4f5c\u9700\u8981 5 ns \u7b49\u3002
  3. \u6839\u636e\u4ee3\u7801 \u7edf\u8ba1\u6240\u6709\u8ba1\u7b97\u64cd\u4f5c\u7684\u6570\u91cf \uff0c\u5e76\u5c06\u6240\u6709\u64cd\u4f5c\u7684\u6267\u884c\u65f6\u95f4\u6c42\u548c\uff0c\u5373\u53ef\u5f97\u5230\u8fd0\u884c\u65f6\u95f4\u3002

\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u6839\u636e\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5f97\u5230\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u4e3a \\(6n + 12\\) ns \u3002

\\[ 1 + 1 + 10 + (1 + 5) \\times n = 6n + 12 \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nSystem.out.println(0);     // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\ncout << 0 << endl;         // 5 ns\n}\n}\n
# \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\ndef algorithm(n: int) -> None:\na = 2      # 1 ns\na = a + 1  # 1 ns\na = a * 2  # 10 ns\n# \u5faa\u73af n \u6b21\nfor _ in range(n):  # 1 ns\nprint(0)        # 5 ns\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunc algorithm(n int) {\na := 2      // 1 ns\na = a + 1   // 1 ns\na = a * 2   // 10 ns\n// \u5faa\u73af n \u6b21\nfor i := 0; i < n; i++ {    // 1 ns\nfmt.Println(a)          // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunction algorithm(n) {\nvar a = 2; // 1 ns\na = a + 1; // 1 ns\na = a * 2; // 10 ns\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++) { // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nconsole.log(0); // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunction algorithm(n: number): void {\nvar a: number = 2; // 1 ns\na = a + 1; // 1 ns\na = a * 2; // 10 ns\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++) { // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nconsole.log(0); // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {   // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nprintf(\"%d\", 0);            // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n)\n{\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++)\n{  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nConsole.WriteLine(0);     // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunc algorithm(n: Int) {\nvar a = 2 // 1 ns\na = a + 1 // 1 ns\na = a * 2 // 10 ns\n// \u5faa\u73af n \u6b21\nfor _ in 0 ..< n { // 1 ns\nprint(0) // 5 ns\n}\n}\n
\n

\u4f46\u5b9e\u9645\u4e0a\uff0c \u7edf\u8ba1\u7b97\u6cd5\u7684\u8fd0\u884c\u65f6\u95f4\u65e2\u4e0d\u5408\u7406\u4e5f\u4e0d\u73b0\u5b9e\u3002\u9996\u5148\uff0c\u6211\u4eec\u4e0d\u5e0c\u671b\u9884\u4f30\u65f6\u95f4\u548c\u8fd0\u884c\u5e73\u53f0\u7ed1\u5b9a\uff0c\u6bd5\u7adf\u7b97\u6cd5\u9700\u8981\u8dd1\u5728\u5404\u5f0f\u5404\u6837\u7684\u5e73\u53f0\u4e4b\u4e0a\u3002\u5176\u6b21\uff0c\u6211\u4eec\u5f88\u96be\u83b7\u77e5\u6bcf\u4e00\u79cd\u64cd\u4f5c\u7684\u8fd0\u884c\u65f6\u95f4\uff0c\u8fd9\u4e3a\u9884\u4f30\u8fc7\u7a0b\u5e26\u6765\u4e86\u6781\u5927\u7684\u96be\u5ea6\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#222","title":"2.2.2. \u00a0 \u7edf\u8ba1\u65f6\u95f4\u589e\u957f\u8d8b\u52bf","text":"

\u300c\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u300d\u91c7\u53d6\u4e86\u4e0d\u540c\u7684\u505a\u6cd5\uff0c\u5176\u7edf\u8ba1\u7684\u4e0d\u662f\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\uff0c\u800c\u662f \u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf \u3002

\u201c\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u201d\u8fd9\u4e2a\u6982\u5ff5\u6bd4\u8f83\u62bd\u8c61\uff0c\u6211\u4eec\u501f\u52a9\u4e00\u4e2a\u4f8b\u5b50\u6765\u7406\u89e3\u3002\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u7ed9\u5b9a\u4e09\u4e2a\u7b97\u6cd5 A , B , C \u3002

  • \u7b97\u6cd5 A \u53ea\u6709 \\(1\\) \u4e2a\u6253\u5370\u64cd\u4f5c\uff0c\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u4e0d\u968f\u7740 \\(n\\) \u589e\u5927\u800c\u589e\u957f\u3002\u6211\u4eec\u79f0\u6b64\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a\u300c\u5e38\u6570\u9636\u300d\u3002
  • \u7b97\u6cd5 B \u4e2d\u7684\u6253\u5370\u64cd\u4f5c\u9700\u8981\u5faa\u73af \\(n\\) \u6b21\uff0c\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740 \\(n\\) \u589e\u5927\u6210\u7ebf\u6027\u589e\u957f\u3002\u6b64\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u88ab\u79f0\u4e3a\u300c\u7ebf\u6027\u9636\u300d\u3002
  • \u7b97\u6cd5 C \u4e2d\u7684\u6253\u5370\u64cd\u4f5c\u9700\u8981\u5faa\u73af \\(1000000\\) \u6b21\uff0c\u4f46\u8fd0\u884c\u65f6\u95f4\u4ecd\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\u3002\u56e0\u6b64 C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u548c A \u76f8\u540c\uff0c\u4ecd\u4e3a\u300c\u5e38\u6570\u9636\u300d\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\nSystem.out.println(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\nSystem.out.println(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\nSystem.out.println(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\ncout << 0 << endl;\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\ncout << 0 << endl;\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\ncout << 0 << endl;\n}\n}\n
# \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\ndef algorithm_A(n: int) -> None:\nprint(0)\n# \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\ndef algorithm_B(n: int) -> None:\nfor _ in range(n):\nprint(0)\n# \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\ndef algorithm_C(n: int) -> None:\nfor _ in range(1000000):\nprint(0)\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithm_A(n int) {\nfmt.Println(0)\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunc algorithm_B(n int) {\nfor i := 0; i < n; i++ {\nfmt.Println(0)\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithm_C(n int) {\nfor i := 0; i < 1000000; i++ {\nfmt.Println(0)\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_A(n) {\nconsole.log(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunction algorithm_B(n) {\nfor (let i = 0; i < n; i++) {\nconsole.log(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_C(n) {\nfor (let i = 0; i < 1000000; i++) {\nconsole.log(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_A(n: number): void {\nconsole.log(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunction algorithm_B(n: number): void {\nfor (let i = 0; i < n; i++) {\nconsole.log(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_C(n: number): void {\nfor (let i = 0; i < 1000000; i++) {\nconsole.log(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\nprintf(\"%d\", 0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\nprintf(\"%d\", 0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\nprintf(\"%d\", 0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n)\n{\nConsole.WriteLine(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n)\n{\nfor (int i = 0; i < n; i++)\n{\nConsole.WriteLine(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n)\n{\nfor (int i = 0; i < 1000000; i++)\n{\nConsole.WriteLine(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithmA(n: Int) {\nprint(0)\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunc algorithmB(n: Int) {\nfor _ in 0 ..< n {\nprint(0)\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithmC(n: Int) {\nfor _ in 0 ..< 1000000 {\nprint(0)\n}\n}\n
\n

Fig. \u7b97\u6cd5 A, B, C \u7684\u65f6\u95f4\u589e\u957f\u8d8b\u52bf

\u76f8\u6bd4\u76f4\u63a5\u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u7684\u505a\u6cd5\u6709\u4ec0\u4e48\u597d\u5904\u5462\uff1f\u4ee5\u53ca\u6709\u4ec0\u4e48\u4e0d\u8db3\uff1f

\u65f6\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u6709\u6548\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\u3002\u7b97\u6cd5 B \u8fd0\u884c\u65f6\u95f4\u7684\u589e\u957f\u662f\u7ebf\u6027\u7684\uff0c\u5728 \\(n > 1\\) \u65f6\u6162\u4e8e\u7b97\u6cd5 A \uff0c\u5728 \\(n > 1000000\\) \u65f6\u6162\u4e8e\u7b97\u6cd5 C \u3002\u5b9e\u8d28\u4e0a\uff0c\u53ea\u8981\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u8db3\u591f\u5927\uff0c\u590d\u6742\u5ea6\u4e3a\u300c\u5e38\u6570\u9636\u300d\u7684\u7b97\u6cd5\u4e00\u5b9a\u4f18\u4e8e\u300c\u7ebf\u6027\u9636\u300d\u7684\u7b97\u6cd5\uff0c\u8fd9\u4e5f\u6b63\u662f\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u7684\u542b\u4e49\u3002

\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u63a8\u7b97\u65b9\u6cd5\u66f4\u52a0\u7b80\u4fbf\u3002\u5728\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u7edf\u8ba1\u300c\u8ba1\u7b97\u64cd\u4f5c\u7684\u8fd0\u884c\u65f6\u95f4\u300d\u7b80\u5316\u4e3a\u7edf\u8ba1\u300c\u8ba1\u7b97\u64cd\u4f5c\u7684\u6570\u91cf\u300d\uff0c\u8fd9\u662f\u56e0\u4e3a\uff0c\u65e0\u8bba\u662f\u8fd0\u884c\u5e73\u53f0\u8fd8\u662f\u8ba1\u7b97\u64cd\u4f5c\u7c7b\u578b\uff0c\u90fd\u4e0e\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u7684\u589e\u957f\u8d8b\u52bf\u65e0\u5173\u3002\u56e0\u800c\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u5730\u5c06\u6240\u6709\u8ba1\u7b97\u64cd\u4f5c\u7684\u6267\u884c\u65f6\u95f4\u7edf\u4e00\u770b\u4f5c\u662f\u76f8\u540c\u7684\u201c\u5355\u4f4d\u65f6\u95f4\u201d\uff0c\u8fd9\u6837\u7684\u7b80\u5316\u505a\u6cd5\u5927\u5927\u964d\u4f4e\u4e86\u4f30\u7b97\u96be\u5ea6\u3002

\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u5b58\u5728\u4e00\u5b9a\u7684\u5c40\u9650\u6027\u3002\u6bd4\u5982\uff0c\u867d\u7136\u7b97\u6cd5 A \u548c C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u76f8\u540c\uff0c\u4f46\u662f\u5b9e\u9645\u7684\u8fd0\u884c\u65f6\u95f4\u6709\u975e\u5e38\u5927\u7684\u5dee\u522b\u3002\u518d\u6bd4\u5982\uff0c\u867d\u7136\u7b97\u6cd5 B \u6bd4 C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u8981\u66f4\u9ad8\uff0c\u4f46\u5728\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u6bd4\u8f83\u5c0f\u65f6\uff0c\u7b97\u6cd5 B \u662f\u8981\u660e\u663e\u4f18\u4e8e\u7b97\u6cd5 C \u7684\u3002\u5bf9\u4e8e\u4ee5\u4e0a\u60c5\u51b5\uff0c\u6211\u4eec\u5f88\u96be\u4ec5\u51ed\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u5224\u5b9a\u7b97\u6cd5\u6548\u7387\u9ad8\u4f4e\u3002\u7136\u800c\uff0c\u5373\u4f7f\u5b58\u5728\u8fd9\u4e9b\u95ee\u9898\uff0c\u590d\u6742\u5ea6\u5206\u6790\u4ecd\u7136\u662f\u8bc4\u5224\u7b97\u6cd5\u6548\u7387\u7684\u6700\u6709\u6548\u4e14\u5e38\u7528\u7684\u65b9\u6cd5\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#223","title":"2.2.3. \u00a0 \u51fd\u6570\u6e10\u8fd1\u4e0a\u754c","text":"

\u8bbe\u7b97\u6cd5\u300c\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\u300d\u4e3a \\(T(n)\\) \uff0c\u5176\u662f\u4e00\u4e2a\u5173\u4e8e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u7684\u51fd\u6570\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u7b97\u6cd5\u7684\u64cd\u4f5c\u6570\u91cf\u4e3a

\\[ T(n) = 3 + 2n \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) { // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nSystem.out.println(0);    // +1\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) { // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\ncout << 0 << endl;    // +1\n}\n}\n
def algorithm(n: int) -> None:\na: int = 1  # +1\na = a + 1  # +1\na = a * 2  # +1\n# \u5faa\u73af n \u6b21\nfor i in range(n):  # +1\nprint(0)        # +1\n
func algorithm(n int) {\na := 1      // +1\na = a + 1   // +1\na = a * 2   // +1\n// \u5faa\u73af n \u6b21\nfor i := 0; i < n; i++ {   // +1\nfmt.Println(a)         // +1\n}\n}\n
function algorithm(n) {\nvar a = 1; // +1\na += 1; // +1\na *= 2; // +1\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++){ // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nconsole.log(0); // +1\n}\n}\n
function algorithm(n: number): void{\nvar a: number = 1; // +1\na += 1; // +1\na *= 2; // +1\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++){ // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nconsole.log(0); // +1\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {   // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nprintf(\"%d\", 0);            // +1\n}\n}  
void algorithm(int n)\n{\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\n{\nConsole.WriteLine(0);   // +1\n}\n}\n
func algorithm(n: Int) {\nvar a = 1 // +1\na = a + 1 // +1\na = a * 2 // +1\n// \u5faa\u73af n \u6b21\nfor _ in 0 ..< n { // +1\nprint(0) // +1\n}\n}\n
\n

\\(T(n)\\) \u662f\u4e2a\u4e00\u6b21\u51fd\u6570\uff0c\u8bf4\u660e\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u662f\u7ebf\u6027\u7684\uff0c\u56e0\u6b64\u6613\u5f97\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u7ebf\u6027\u9636\u3002

\u6211\u4eec\u5c06\u7ebf\u6027\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u8bb0\u4e3a \\(O(n)\\) \uff0c\u8fd9\u4e2a\u6570\u5b66\u7b26\u53f7\u88ab\u79f0\u4e3a\u300c\u5927 \\(O\\) \u8bb0\u53f7 Big-\\(O\\) Notation\u300d\uff0c\u4ee3\u8868\u51fd\u6570 \\(T(n)\\) \u7684\u300c\u6e10\u8fd1\u4e0a\u754c asymptotic upper bound\u300d\u3002

\u6211\u4eec\u8981\u63a8\u7b97\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u672c\u8d28\u4e0a\u662f\u5728\u8ba1\u7b97\u300c\u64cd\u4f5c\u6570\u91cf\u51fd\u6570 \\(T(n)\\) \u300d\u7684\u6e10\u8fd1\u4e0a\u754c\u3002\u4e0b\u9762\u6211\u4eec\u5148\u6765\u770b\u770b\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\u7684\u6570\u5b66\u5b9a\u4e49\u3002

\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c

\u82e5\u5b58\u5728\u6b63\u5b9e\u6570 \\(c\\) \u548c\u5b9e\u6570 \\(n_0\\) \uff0c\u4f7f\u5f97\u5bf9\u4e8e\u6240\u6709\u7684 \\(n > n_0\\) \uff0c\u5747\u6709 $$ T(n) \\leq c \\cdot f(n) $$ \u5219\u53ef\u8ba4\u4e3a \\(f(n)\\) \u7ed9\u51fa\u4e86 \\(T(n)\\) \u7684\u4e00\u4e2a\u6e10\u8fd1\u4e0a\u754c\uff0c\u8bb0\u4e3a $$ T(n) = O(f(n)) $$

Fig. \u51fd\u6570\u7684\u6e10\u8fd1\u4e0a\u754c

\u672c\u8d28\u4e0a\u770b\uff0c\u8ba1\u7b97\u6e10\u8fd1\u4e0a\u754c\u5c31\u662f\u5728\u627e\u4e00\u4e2a\u51fd\u6570 \\(f(n)\\) \uff0c\u4f7f\u5f97\u5728 \\(n\\) \u8d8b\u5411\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\\(T(n)\\) \u548c \\(f(n)\\) \u5904\u4e8e\u76f8\u540c\u7684\u589e\u957f\u7ea7\u522b\uff08\u4ec5\u76f8\u5dee\u4e00\u4e2a\u5e38\u6570\u9879 \\(c\\) \u7684\u500d\u6570\uff09\u3002

Tip

\u6e10\u8fd1\u4e0a\u754c\u7684\u6570\u5b66\u5473\u513f\u6709\u70b9\u91cd\uff0c\u5982\u679c\u4f60\u611f\u89c9\u6ca1\u6709\u5b8c\u5168\u7406\u89e3\uff0c\u65e0\u9700\u62c5\u5fc3\uff0c\u56e0\u4e3a\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\u6211\u4eec\u53ea\u9700\u8981\u4f1a\u63a8\u7b97\u5373\u53ef\uff0c\u6570\u5b66\u610f\u4e49\u53ef\u4ee5\u6162\u6162\u9886\u609f\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#224","title":"2.2.4. \u00a0 \u63a8\u7b97\u65b9\u6cd5","text":"

\u63a8\u7b97\u51fa \\(f(n)\\) \u540e\uff0c\u6211\u4eec\u5c31\u5f97\u5230\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(f(n))\\) \u3002\u90a3\u4e48\uff0c\u5982\u4f55\u6765\u786e\u5b9a\u6e10\u8fd1\u4e0a\u754c \\(f(n)\\) \u5462\uff1f\u603b\u4f53\u5206\u4e3a\u4e24\u6b65\uff0c\u9996\u5148\u300c\u7edf\u8ba1\u64cd\u4f5c\u6570\u91cf\u300d\uff0c\u7136\u540e\u300c\u5224\u65ad\u6e10\u8fd1\u4e0a\u754c\u300d\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#1","title":"1) \u7edf\u8ba1\u64cd\u4f5c\u6570\u91cf","text":"

\u5bf9\u7740\u4ee3\u7801\uff0c\u4ece\u4e0a\u5230\u4e0b\u4e00\u884c\u4e00\u884c\u5730\u8ba1\u6570\u5373\u53ef\u3002\u7136\u800c\uff0c\u7531\u4e8e\u4e0a\u8ff0 \\(c \\cdot f(n)\\) \u4e2d\u7684\u5e38\u6570\u9879 \\(c\\) \u53ef\u4ee5\u53d6\u4efb\u610f\u5927\u5c0f\uff0c\u56e0\u6b64\u64cd\u4f5c\u6570\u91cf \\(T(n)\\) \u4e2d\u7684\u5404\u79cd\u7cfb\u6570\u3001\u5e38\u6570\u9879\u90fd\u53ef\u4ee5\u88ab\u5ffd\u7565\u3002\u6839\u636e\u6b64\u539f\u5219\uff0c\u53ef\u4ee5\u603b\u7ed3\u51fa\u4ee5\u4e0b\u8ba1\u6570\u5077\u61d2\u6280\u5de7\uff1a

  1. \u8df3\u8fc7\u6570\u91cf\u4e0e \\(n\\) \u65e0\u5173\u7684\u64cd\u4f5c\u3002\u56e0\u4e3a\u4ed6\u4eec\u90fd\u662f \\(T(n)\\) \u4e2d\u7684\u5e38\u6570\u9879\uff0c\u5bf9\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u4ea7\u751f\u5f71\u54cd\u3002
  2. \u7701\u7565\u6240\u6709\u7cfb\u6570\u3002\u4f8b\u5982\uff0c\u5faa\u73af \\(2n\\) \u6b21\u3001\\(5n + 1\\) \u6b21\u3001\u2026\u2026\uff0c\u90fd\u53ef\u4ee5\u5316\u7b80\u8bb0\u4e3a \\(n\\) \u6b21\uff0c\u56e0\u4e3a \\(n\\) \u524d\u9762\u7684\u7cfb\u6570\u5bf9\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u4e0d\u4ea7\u751f\u5f71\u54cd\u3002
  3. \u5faa\u73af\u5d4c\u5957\u65f6\u4f7f\u7528\u4e58\u6cd5\u3002\u603b\u64cd\u4f5c\u6570\u91cf\u7b49\u4e8e\u5916\u5c42\u5faa\u73af\u548c\u5185\u5c42\u5faa\u73af\u64cd\u4f5c\u6570\u91cf\u4e4b\u79ef\uff0c\u6bcf\u4e00\u5c42\u5faa\u73af\u4f9d\u7136\u53ef\u4ee5\u5206\u522b\u5957\u7528\u4e0a\u8ff0 1. \u548c 2. \u6280\u5de7\u3002

\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u4f7f\u7528\u4e0a\u8ff0\u6280\u5de7\u524d\u3001\u540e\u7684\u7edf\u8ba1\u7ed3\u679c\u3002

\\[ \\begin{aligned} T(n) & = 2n(n + 1) + (5n + 1) + 2 & \\text{\u5b8c\u6574\u7edf\u8ba1 (-.-|||)} \\newline & = 2n^2 + 7n + 3 \\newline T(n) & = n^2 + n & \\text{\u5077\u61d2\u7edf\u8ba1 (o.O)} \\end{aligned} \\]

\u6700\u7ec8\uff0c\u4e24\u8005\u90fd\u80fd\u63a8\u51fa\u76f8\u540c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7ed3\u679c\uff0c\u5373 \\(O(n^2)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\nSystem.out.println(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\nSystem.out.println(0);\n}\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\ncout << 0 << endl;\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\ncout << 0 << endl;\n}\n}\n}\n
def algorithm(n: int) -> None:\na: int = 1  # +0\uff08\u6280\u5de7 1\uff09\na = a + n   # +0\uff08\u6280\u5de7 1\uff09\n# +n\uff08\u6280\u5de7 2\uff09\nfor i in range(5 * n + 1):\nprint(0)\n# +n*n\uff08\u6280\u5de7 3\uff09\nfor i in range(2 * n):\nfor j in range(n + 1):\nprint(0)\n
func algorithm(n int) {\na := 1      // +0\uff08\u6280\u5de7 1\uff09\na = a + n  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor i := 0; i < 5 * n + 1; i++ {\nfmt.Println(0)\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor i := 0; i < 2 * n; i++ {\nfor j := 0; j < n + 1; j++ {\nfmt.Println(0)\n}\n}\n}\n
function algorithm(n) {\nlet a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (let i = 0; i < 5 * n + 1; i++) {\nconsole.log(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (let i = 0; i < 2 * n; i++) {\nfor (let j = 0; j < n + 1; j++) {\nconsole.log(0);\n}\n}\n}\n
function algorithm(n: number): void {\nlet a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (let i = 0; i < 5 * n + 1; i++) {\nconsole.log(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (let i = 0; i < 2 * n; i++) {\nfor (let j = 0; j < n + 1; j++) {\nconsole.log(0);\n}\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\nprintf(\"%d\", 0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\nprintf(\"%d\", 0);\n}\n}\n}\n
void algorithm(int n)\n{\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++)\n{\nConsole.WriteLine(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++)\n{\nfor (int j = 0; j < n + 1; j++)\n{\nConsole.WriteLine(0);\n}\n}\n}\n
func algorithm(n: Int) {\nvar a = 1 // +0\uff08\u6280\u5de7 1\uff09\na = a + n // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor _ in 0 ..< (5 * n + 1) {\nprint(0)\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor _ in 0 ..< (2 * n) {\nfor _ in 0 ..< (n + 1) {\nprint(0)\n}\n}\n}\n
\n
"},{"location":"chapter_computational_complexity/time_complexity/#2","title":"2) \u5224\u65ad\u6e10\u8fd1\u4e0a\u754c","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\u7531\u591a\u9879\u5f0f \\(T(n)\\) \u4e2d\u6700\u9ad8\u9636\u7684\u9879\u6765\u51b3\u5b9a\u3002\u8fd9\u662f\u56e0\u4e3a\u5728 \\(n\\) \u8d8b\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\u6700\u9ad8\u9636\u7684\u9879\u5c06\u5904\u4e8e\u4e3b\u5bfc\u4f5c\u7528\uff0c\u5176\u5b83\u9879\u7684\u5f71\u54cd\u90fd\u53ef\u4ee5\u88ab\u5ffd\u7565\u3002

\u4ee5\u4e0b\u8868\u683c\u7ed9\u51fa\u4e86\u4e00\u4e9b\u4f8b\u5b50\uff0c\u5176\u4e2d\u6709\u4e00\u4e9b\u5938\u5f20\u7684\u503c\uff0c\u662f\u60f3\u8981\u5411\u5927\u5bb6\u5f3a\u8c03 \u7cfb\u6570\u65e0\u6cd5\u64bc\u52a8\u9636\u6570 \u8fd9\u4e00\u7ed3\u8bba\u3002\u5728 \\(n\\) \u8d8b\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\u8fd9\u4e9b\u5e38\u6570\u90fd\u662f\u201c\u6d6e\u4e91\u201d\u3002

\u64cd\u4f5c\u6570\u91cf \\(T(n)\\) \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(f(n))\\) \\(100000\\) \\(O(1)\\) \\(3n + 2\\) \\(O(n)\\) \\(2n^2 + 3n + 2\\) \\(O(n^2)\\) \\(n^3 + 10000n^2\\) \\(O(n^3)\\) \\(2^n + 10000n^{10000}\\) \\(O(2^n)\\)"},{"location":"chapter_computational_complexity/time_complexity/#225","title":"2.2.5. \u00a0 \u5e38\u89c1\u7c7b\u578b","text":"

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u5e38\u89c1\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7c7b\u578b\u6709\uff08\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\uff09

\\[ \\begin{aligned} O(1) < O(\\log n) < O(n) < O(n \\log n) < O(n^2) < O(2^n) < O(n!) \\newline \\text{\u5e38\u6570\u9636} < \\text{\u5bf9\u6570\u9636} < \\text{\u7ebf\u6027\u9636} < \\text{\u7ebf\u6027\u5bf9\u6570\u9636} < \\text{\u5e73\u65b9\u9636} < \\text{\u6307\u6570\u9636} < \\text{\u9636\u4e58\u9636} \\end{aligned} \\]

Fig. \u65f6\u95f4\u590d\u6742\u5ea6\u7684\u5e38\u89c1\u7c7b\u578b

Tip

\u90e8\u5206\u793a\u4f8b\u4ee3\u7801\u9700\u8981\u4e00\u4e9b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5305\u62ec\u6570\u7ec4\u3001\u9012\u5f52\u7b97\u6cd5\u7b49\u3002\u5982\u679c\u9047\u5230\u770b\u4e0d\u61c2\u7684\u5730\u65b9\u65e0\u9700\u62c5\u5fc3\uff0c\u53ef\u4ee5\u5728\u5b66\u4e60\u5b8c\u540e\u9762\u7ae0\u8282\u540e\u518d\u6765\u590d\u4e60\uff0c\u73b0\u9636\u6bb5\u5148\u805a\u7126\u5728\u7406\u89e3\u65f6\u95f4\u590d\u6742\u5ea6\u542b\u4e49\u548c\u63a8\u7b97\u65b9\u6cd5\u4e0a\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#o1","title":"\u5e38\u6570\u9636 \\(O(1)\\)","text":"

\u5e38\u6570\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\uff0c\u5373\u4e0d\u968f\u7740 \\(n\\) \u7684\u53d8\u5316\u800c\u53d8\u5316\u3002

\u5bf9\u4e8e\u4ee5\u4e0b\u7b97\u6cd5\uff0c\u65e0\u8bba\u64cd\u4f5c\u6570\u91cf size \u6709\u591a\u5927\uff0c\u53ea\u8981\u4e0e\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5c31\u4ecd\u4e3a \\(O(1)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e38\u6570\u9636 */\nint constant(int n) {\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.cpp
/* \u5e38\u6570\u9636 */\nint constant(int n) {\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.py
def constant(n: int) -> int:\n\"\"\" \u5e38\u6570\u9636 \"\"\"\ncount: int = 0\nsize: int = 100000\nfor _ in range(size):\ncount += 1\nreturn count\n
time_complexity.go
/* \u5e38\u6570\u9636 */\nfunc constant(n int) int {\ncount := 0\nsize := 100000\nfor i := 0; i < size; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u5e38\u6570\u9636 */\nfunction constant(n) {\nlet count = 0;\nconst size = 100000;\nfor (let i = 0; i < size; i++) count++;\nreturn count;\n}\n
time_complexity.ts
/* \u5e38\u6570\u9636 */\nfunction constant(n: number): number {\nlet count = 0;\nconst size = 100000;\nfor (let i = 0; i < size; i++) count++;\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{constant}\n
time_complexity.cs
/* \u5e38\u6570\u9636 */\nint constant(int n)\n{\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.swift
/* \u5e38\u6570\u9636 */\nfunc constant(n: Int) -> Int {\nvar count = 0\nlet size = 100_000\nfor _ in 0 ..< size {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u5e38\u6570\u9636\nfn constant(n: i32) i32 {\n_ = n;\nvar count: i32 = 0;\nconst size: i32 = 100_000;\nvar i: i32 = 0;\nwhile(i<size) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on","title":"\u7ebf\u6027\u9636 \\(O(n)\\)","text":"

\u7ebf\u6027\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u76f8\u5bf9\u8f93\u5165\u6570\u636e\u5927\u5c0f\u6210\u7ebf\u6027\u7ea7\u522b\u589e\u957f\u3002\u7ebf\u6027\u9636\u5e38\u51fa\u73b0\u4e8e\u5355\u5c42\u5faa\u73af\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u9636 */\nint linear(int n) {\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u9636 */\nint linear(int n) {\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.py
def linear(n: int) -> int:\n\"\"\" \u7ebf\u6027\u9636 \"\"\"\ncount: int = 0\nfor _ in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u9636 */\nfunc linear(n int) int {\ncount := 0\nfor i := 0; i < n; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u9636 */\nfunction linear(n) {\nlet count = 0;\nfor (let i = 0; i < n; i++) count++;\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u9636 */\nfunction linear(n: number): number {\nlet count = 0;\nfor (let i = 0; i < n; i++) count++;\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{linear}\n
time_complexity.cs
/* \u7ebf\u6027\u9636 */\nint linear(int n)\n{\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u9636 */\nfunc linear(n: Int) -> Int {\nvar count = 0\nfor _ in 0 ..< n {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u9636\nfn linear(n: i32) i32 {\nvar count: i32 = 0;\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n

\u300c\u904d\u5386\u6570\u7ec4\u300d\u548c\u300c\u904d\u5386\u94fe\u8868\u300d\u7b49\u64cd\u4f5c\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(n)\\) \uff0c\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u7684\u957f\u5ea6\u3002

Tip

\u6570\u636e\u5927\u5c0f \\(n\\) \u662f\u6839\u636e\u8f93\u5165\u6570\u636e\u7684\u7c7b\u578b\u6765\u786e\u5b9a\u7684\u3002\u6bd4\u5982\uff0c\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u76f4\u63a5\u5c06 \\(n\\) \u770b\u4f5c\u8f93\u5165\u6570\u636e\u5927\u5c0f\uff1b\u4ee5\u4e0b\u904d\u5386\u6570\u7ec4\u793a\u4f8b\u4e2d\uff0c\u6570\u636e\u5927\u5c0f \\(n\\) \u4e3a\u6570\u7ec4\u7684\u957f\u5ea6\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(int[] nums) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (int num : nums) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(vector<int>& nums) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (int num : nums) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def array_traversal(nums: List[int]) -> int:\n\"\"\" \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09\"\"\"\ncount: int = 0\n# \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor num in nums:\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunc arrayTraversal(nums []int) int {\ncount := 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor range nums {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunction arrayTraversal(nums) {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunction arrayTraversal(nums: number[]): number {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{arrayTraversal}\n
time_complexity.cs
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(int[] nums)\n{\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nforeach (int num in nums)\n{\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunc arrayTraversal(nums: [Int]) -> Int {\nvar count = 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor _ in nums {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09\nfn arrayTraversal(nums: []i32) i32 {\nvar count: i32 = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (nums) |_| {\ncount += 1;\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on2","title":"\u5e73\u65b9\u9636 \\(O(n^2)\\)","text":"

\u5e73\u65b9\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u76f8\u5bf9\u8f93\u5165\u6570\u636e\u5927\u5c0f\u6210\u5e73\u65b9\u7ea7\u522b\u589e\u957f\u3002\u5e73\u65b9\u9636\u5e38\u51fa\u73b0\u4e8e\u5d4c\u5957\u5faa\u73af\uff0c\u5916\u5c42\u5faa\u73af\u548c\u5185\u5c42\u5faa\u73af\u90fd\u4e3a \\(O(n)\\) \uff0c\u603b\u4f53\u4e3a \\(O(n^2)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e73\u65b9\u9636 */\nint quadratic(int n) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5e73\u65b9\u9636 */\nint quadratic(int n) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.py
def quadratic(n: int) -> int:\n\"\"\" \u5e73\u65b9\u9636 \"\"\"\ncount: int = 0\n# \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor i in range(n):\nfor j in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n int) int {\ncount := 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor i := 0; i < n; i++ {\nfor j := 0; j < n; j++ {\ncount++\n}\n}\nreturn count\n}\n
time_complexity.js
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n) {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n: number): number {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{quadratic}\n
time_complexity.cs
/* \u5e73\u65b9\u9636 */\nint quadratic(int n)\n{\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++)\n{\nfor (int j = 0; j < n; j++)\n{\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n: Int) -> Int {\nvar count = 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor _ in 0 ..< n {\nfor _ in 0 ..< n {\ncount += 1\n}\n}\nreturn count\n}\n
time_complexity.zig
// \u5e73\u65b9\u9636\nfn quadratic(n: i32) i32 {\nvar count: i32 = 0;\nvar i: i32 = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nwhile (i < n) : (i += 1) {\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\ncount += 1;\n}\n}\nreturn count;\n}\n

Fig. \u5e38\u6570\u9636\u3001\u7ebf\u6027\u9636\u3001\u5e73\u65b9\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u4ee5\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u4e3a\u4f8b\uff0c\u5916\u5c42\u5faa\u73af \\(n - 1\\) \u6b21\uff0c\u5185\u5c42\u5faa\u73af \\(n-1, n-2, \\cdots, 2, 1\\) \u6b21\uff0c\u5e73\u5747\u4e3a \\(\\frac{n}{2}\\) \u6b21\uff0c\u56e0\u6b64\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \u3002

\\[ O((n - 1) \\frac{n}{2}) = O(n^2) \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(int[] nums) {\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(vector<int>& nums) {\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.py
def bubble_sort(nums: List[int]) -> int:\n\"\"\" \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09\"\"\"\ncount: int = 0  # \u8ba1\u6570\u5668\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(len(nums) - 1, 0, -1):\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\ntmp: int = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\ncount += 3  # \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\nreturn count\n
time_complexity.go
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunc bubbleSort(nums []int) int {\ncount := 0 // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\ntmp := nums[j]\nnums[j] = nums[j+1]\nnums[j+1] = tmp\ncount += 3 // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count\n}\n
time_complexity.js
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunction bubbleSort(nums) {\nlet count = 0; // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3; // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunction bubbleSort(nums: number[]): number {\nlet count = 0; // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3; // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{bubbleSort}\n
time_complexity.cs
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(int[] nums)\n{\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunc bubbleSort(nums: inout [Int]) -> Int {\nvar count = 0 // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in sequence(first: nums.count - 1, next: { $0 > 0 + 1 ? $0 - 1 : nil }) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in 0 ..< i {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\ncount += 3 // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count\n}\n
time_complexity.zig
// \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09\nfn bubbleSort(nums: []i32) i32 {\nvar count: i32 = 0;  // \u8ba1\u6570\u5668 \n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: i32 = @intCast(i32, nums.len ) - 1;\nwhile (i > 0) : (i -= 1) {\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#o2n","title":"\u6307\u6570\u9636 \\(O(2^n)\\)","text":"

Note

\u751f\u7269\u5b66\u79d1\u4e2d\u7684\u201c\u7ec6\u80de\u5206\u88c2\u201d\u5373\u662f\u6307\u6570\u9636\u589e\u957f\uff1a\u521d\u59cb\u72b6\u6001\u4e3a \\(1\\) \u4e2a\u7ec6\u80de\uff0c\u5206\u88c2\u4e00\u8f6e\u540e\u4e3a \\(2\\) \u4e2a\uff0c\u5206\u88c2\u4e24\u8f6e\u540e\u4e3a \\(4\\) \u4e2a\uff0c\u2026\u2026\uff0c\u5206\u88c2 \\(n\\) \u8f6e\u540e\u6709 \\(2^n\\) \u4e2a\u7ec6\u80de\u3002

\u6307\u6570\u9636\u589e\u957f\u5f97\u975e\u5e38\u5feb\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u4e00\u822c\u662f\u4e0d\u80fd\u88ab\u63a5\u53d7\u7684\u3002\u82e5\u4e00\u4e2a\u95ee\u9898\u4f7f\u7528\u300c\u66b4\u529b\u679a\u4e3e\u300d\u6c42\u89e3\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f \\(O(2^n)\\) \uff0c\u90a3\u4e48\u4e00\u822c\u90fd\u9700\u8981\u4f7f\u7528\u300c\u52a8\u6001\u89c4\u5212\u300d\u6216\u300c\u8d2a\u5fc3\u7b97\u6cd5\u300d\u7b49\u7b97\u6cd5\u6765\u6c42\u89e3\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n) {\nint count = 0, base = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.cpp
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n) {\nint count = 0, base = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.py
def exponential(n: int) -> int:\n\"\"\" \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\"\"\"\ncount: int = 0\nbase: int = 1\n# cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor _ in range(n):\nfor _ in range(base):\ncount += 1\nbase *= 2\n# count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n
time_complexity.go
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09*/\nfunc exponential(n int) int {\ncount, base := 0, 1\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor i := 0; i < n; i++ {\nfor j := 0; j < base; j++ {\ncount++\n}\nbase *= 2\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n}\n
time_complexity.js
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction exponential(n) {\nlet count = 0,\nbase = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.ts
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction exponential(n: number): number {\nlet count = 0,\nbase = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{exponential}\n
time_complexity.cs
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n)\n{\nint count = 0, bas = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++)\n{\nfor (int j = 0; j < bas; j++)\n{\ncount++;\n}\nbas *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.swift
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunc exponential(n: Int) -> Int {\nvar count = 0\nvar base = 1\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor _ in 0 ..< n {\nfor _ in 0 ..< base {\ncount += 1\n}\nbase *= 2\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n}\n
time_complexity.zig
// \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\nfn exponential(n: i32) i32 {\nvar count: i32 = 0;\nvar bas: i32 = 1;\nvar i: i32 = 0;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nwhile (i < n) : (i += 1) {\nvar j: i32 = 0;\nwhile (j < bas) : (j += 1) {\ncount += 1;\n}\nbas *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n

Fig. \u6307\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u5728\u5b9e\u9645\u7b97\u6cd5\u4e2d\uff0c\u6307\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u9012\u5f52\u51fd\u6570\u3002\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u4e0d\u65ad\u5730\u4e00\u5206\u4e3a\u4e8c\uff0c\u5206\u88c2 \\(n\\) \u6b21\u540e\u505c\u6b62\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.cpp
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.py
def exp_recur(n: int) -> int:\n\"\"\" \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n == 1: return 1\nreturn exp_recur(n - 1) + exp_recur(n - 1) + 1\n
time_complexity.go
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09*/\nfunc expRecur(n int) int {\nif n == 1 {\nreturn 1\n}\nreturn expRecur(n-1) + expRecur(n-1) + 1\n}\n
time_complexity.js
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction expRecur(n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.ts
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction expRecur(n: number): number {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.c
[class]{}-[func]{expRecur}\n
time_complexity.cs
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n)\n{\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.swift
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc expRecur(n: Int) -> Int {\nif n == 1 {\nreturn 1\n}\nreturn expRecur(n: n - 1) + expRecur(n: n - 1) + 1\n}\n
time_complexity.zig
// \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn expRecur(n: i32) i32 {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#olog-n","title":"\u5bf9\u6570\u9636 \\(O(\\log n)\\)","text":"

\u5bf9\u6570\u9636\u4e0e\u6307\u6570\u9636\u6b63\u597d\u76f8\u53cd\uff0c\u540e\u8005\u53cd\u6620\u201c\u6bcf\u8f6e\u589e\u52a0\u5230\u4e24\u500d\u7684\u60c5\u51b5\u201d\uff0c\u800c\u524d\u8005\u53cd\u6620\u201c\u6bcf\u8f6e\u7f29\u51cf\u5230\u4e00\u534a\u7684\u60c5\u51b5\u201d\u3002\u5bf9\u6570\u9636\u4ec5\u6b21\u4e8e\u5e38\u6570\u9636\uff0c\u65f6\u95f4\u589e\u957f\u5f97\u5f88\u6162\uff0c\u662f\u7406\u60f3\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u3002

\u5bf9\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u300c\u4e8c\u5206\u67e5\u627e\u300d\u548c\u300c\u5206\u6cbb\u7b97\u6cd5\u300d\u4e2d\uff0c\u4f53\u73b0\u201c\u4e00\u5206\u4e3a\u591a\u201d\u3001\u201c\u5316\u7e41\u4e3a\u7b80\u201d\u7684\u7b97\u6cd5\u601d\u60f3\u3002

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u7531\u4e8e\u6bcf\u8f6e\u7f29\u51cf\u5230\u4e00\u534a\uff0c\u56e0\u6b64\u5faa\u73af\u6b21\u6570\u662f \\(\\log_2 n\\) \uff0c\u5373 \\(2^n\\) \u7684\u53cd\u51fd\u6570\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n) {\nint count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n) {\nint count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def logarithmic(n: float) -> int:\n\"\"\" \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\"\"\"\ncount: int = 0\nwhile n > 1:\nn = n / 2\ncount += 1\nreturn count\n
time_complexity.go
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09*/\nfunc logarithmic(n float64) int {\ncount := 0\nfor n > 1 {\nn = n / 2\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction logarithmic(n) {\nlet count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction logarithmic(n: number): number {\nlet count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{logarithmic}\n
time_complexity.cs
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n)\n{\nint count = 0;\nwhile (n > 1)\n{\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunc logarithmic(n: Double) -> Int {\nvar count = 0\nvar n = n\nwhile n > 1 {\nn = n / 2\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\nfn logarithmic(n: f32) i32 {\nvar count: i32 = 0;\nvar n_var = n;\nwhile (n_var > 1)\n{\nn_var = n_var / 2;\ncount +=1;\n}\nreturn count;\n}\n

Fig. \u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u4e0e\u6307\u6570\u9636\u7c7b\u4f3c\uff0c\u5bf9\u6570\u9636\u4e5f\u5e38\u51fa\u73b0\u4e8e\u9012\u5f52\u51fd\u6570\u3002\u4ee5\u4e0b\u4ee3\u7801\u5f62\u6210\u4e86\u4e00\u4e2a\u9ad8\u5ea6\u4e3a \\(\\log_2 n\\) \u7684\u9012\u5f52\u6811\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.cpp
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.py
def log_recur(n: float) -> int:\n\"\"\" \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n <= 1: return 0\nreturn log_recur(n / 2) + 1\n
time_complexity.go
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09*/\nfunc logRecur(n float64) int {\nif n <= 1 {\nreturn 0\n}\nreturn logRecur(n/2) + 1\n}\n
time_complexity.js
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction logRecur(n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.ts
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction logRecur(n: number): number {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.c
[class]{}-[func]{logRecur}\n
time_complexity.cs
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n)\n{\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.swift
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc logRecur(n: Double) -> Int {\nif n <= 1 {\nreturn 0\n}\nreturn logRecur(n: n / 2) + 1\n}\n
time_complexity.zig
// \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn logRecur(n: f32) i32 {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on-log-n","title":"\u7ebf\u6027\u5bf9\u6570\u9636 \\(O(n \\log n)\\)","text":"

\u7ebf\u6027\u5bf9\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u5d4c\u5957\u5faa\u73af\u4e2d\uff0c\u4e24\u5c42\u5faa\u73af\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u522b\u4e3a \\(O(\\log n)\\) \u548c \\(O(n)\\) \u3002

\u4e3b\u6d41\u6392\u5e8f\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f \\(O(n \\log n )\\) \uff0c\u4f8b\u5982\u5feb\u901f\u6392\u5e8f\u3001\u5f52\u5e76\u6392\u5e8f\u3001\u5806\u6392\u5e8f\u7b49\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n) {\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (int i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n) {\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (int i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def linear_log_recur(n: float) -> int:\n\"\"\" \u7ebf\u6027\u5bf9\u6570\u9636 \"\"\"\nif n <= 1: return 1\ncount: int = linear_log_recur(n // 2) + \\\n                 linear_log_recur(n // 2)\nfor _ in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunc linearLogRecur(n float64) int {\nif n <= 1 {\nreturn 1\n}\ncount := linearLogRecur(n/2) +\nlinearLogRecur(n/2)\nfor i := 0.0; i < n; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunction linearLogRecur(n) {\nif (n <= 1) return 1;\nlet count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (let i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunction linearLogRecur(n: number): number {\nif (n <= 1) return 1;\nlet count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (let i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{linearLogRecur}\n
time_complexity.cs
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n)\n{\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) +\nlinearLogRecur(n / 2);\nfor (int i = 0; i < n; i++)\n{\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunc linearLogRecur(n: Double) -> Int {\nif n <= 1 {\nreturn 1\n}\nvar count = linearLogRecur(n: n / 2) + linearLogRecur(n: n / 2)\nfor _ in sequence(first: 0, next: { $0 < n - 1 ? $0 + 1 : nil }) {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u5bf9\u6570\u9636\nfn linearLogRecur(n: f32) i32 {\nif (n <= 1) return 1;\nvar count: i32 = linearLogRecur(n / 2) +\nlinearLogRecur(n / 2);\nvar i: f32 = 0;\nwhile (i < n) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n

Fig. \u7ebf\u6027\u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/time_complexity/#on_1","title":"\u9636\u4e58\u9636 \\(O(n!)\\)","text":"

\u9636\u4e58\u9636\u5bf9\u5e94\u6570\u5b66\u4e0a\u7684\u300c\u5168\u6392\u5217\u300d\u3002\u5373\u7ed9\u5b9a \\(n\\) \u4e2a\u4e92\u4e0d\u91cd\u590d\u7684\u5143\u7d20\uff0c\u6c42\u5176\u6240\u6709\u53ef\u80fd\u7684\u6392\u5217\u65b9\u6848\uff0c\u5219\u65b9\u6848\u6570\u91cf\u4e3a

\\[ n! = n \\times (n - 1) \\times (n - 2) \\times \\cdots \\times 2 \\times 1 \\]

\u9636\u4e58\u5e38\u4f7f\u7528\u9012\u5f52\u5b9e\u73b0\u3002\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u7b2c\u4e00\u5c42\u5206\u88c2\u51fa \\(n\\) \u4e2a\uff0c\u7b2c\u4e8c\u5c42\u5206\u88c2\u51fa \\(n - 1\\) \u4e2a\uff0c\u2026\u2026 \uff0c\u76f4\u81f3\u5230\u7b2c \\(n\\) \u5c42\u65f6\u7ec8\u6b62\u5206\u88c2\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n) {\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n) {\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.py
def factorial_recur(n: int) -> int:\n\"\"\" \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n == 0: return 1\ncount: int = 0\n# \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor _ in range(n):\ncount += factorial_recur(n - 1)\nreturn count\n
time_complexity.go
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc factorialRecur(n int) int {\nif n == 0 {\nreturn 1\n}\ncount := 0\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor i := 0; i < n; i++ {\ncount += factorialRecur(n - 1)\n}\nreturn count\n}\n
time_complexity.js
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction factorialRecur(n) {\nif (n == 0) return 1;\nlet count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (let i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.ts
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction factorialRecur(n: number): number {\nif (n == 0) return 1;\nlet count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (let i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{factorialRecur}\n
time_complexity.cs
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n)\n{\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++)\n{\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.swift
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc factorialRecur(n: Int) -> Int {\nif n == 0 {\nreturn 1\n}\nvar count = 0\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor _ in 0 ..< n {\ncount += factorialRecur(n: n - 1)\n}\nreturn count\n}\n
time_complexity.zig
// \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn factorialRecur(n: i32) i32 {\nif (n == 0) return 1;\nvar count: i32 = 0;\nvar i: i32 = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nwhile (i < n) : (i += 1) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n

Fig. \u9636\u4e58\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/time_complexity/#226","title":"2.2.6. \u00a0 \u6700\u5dee\u3001\u6700\u4f73\u3001\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6","text":"

\u67d0\u4e9b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u662f\u6052\u5b9a\u7684\uff0c\u800c\u662f\u4e0e\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\u6709\u5173\u3002\u4e3e\u4e00\u4e2a\u4f8b\u5b50\uff0c\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6\u4e3a \\(n\\) \u6570\u7ec4 nums \uff0c\u5176\u4e2d nums \u7531\u4ece \\(1\\) \u81f3 \\(n\\) \u7684\u6570\u5b57\u7ec4\u6210\uff0c\u4f46\u5143\u7d20\u987a\u5e8f\u662f\u968f\u673a\u6253\u4e71\u7684\uff1b\u7b97\u6cd5\u7684\u4efb\u52a1\u662f\u8fd4\u56de\u5143\u7d20 \\(1\\) \u7684\u7d22\u5f15\u3002\u6211\u4eec\u53ef\u4ee5\u5f97\u51fa\u4ee5\u4e0b\u7ed3\u8bba\uff1a

  • \u5f53 nums = [?, ?, ..., 1]\uff0c\u5373\u5f53\u672b\u5c3e\u5143\u7d20\u662f \\(1\\) \u65f6\uff0c\u5219\u9700\u5b8c\u6574\u904d\u5386\u6570\u7ec4\uff0c\u6b64\u65f6\u8fbe\u5230 \u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1b
  • \u5f53 nums = [1, ?, ?, ...] \uff0c\u5373\u5f53\u9996\u4e2a\u6570\u5b57\u4e3a \\(1\\) \u65f6\uff0c\u65e0\u8bba\u6570\u7ec4\u591a\u957f\u90fd\u4e0d\u9700\u8981\u7ee7\u7eed\u904d\u5386\uff0c\u6b64\u65f6\u8fbe\u5230 \u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 \\(\\Omega(1)\\) \uff1b

\u300c\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\u300d\u4f7f\u7528\u5927 \\(O\\) \u8bb0\u53f7\u8868\u793a\uff0c\u4ee3\u8868\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u3002\u4e0e\u4e4b\u5bf9\u5e94\uff0c\u300c\u51fd\u6570\u6e10\u8fd1\u4e0b\u754c\u300d\u7528 \\(\\Omega\\) \u8bb0\u53f7\uff08Omega Notation\uff09\u6765\u8868\u793a\uff0c\u4ee3\u8868\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig worst_best_time_complexity.java
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nint[] randomNumbers(int n) {\nInteger[] nums = new Integer[n];\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nCollections.shuffle(Arrays.asList(nums));\n// Integer[] -> int[]\nint[] res = new int[n];\nfor (int i = 0; i < n; i++) {\nres[i] = nums[i];\n}\nreturn res;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(int[] nums) {\nfor (int i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.cpp
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nvector<int> randomNumbers(int n) {\nvector<int> nums(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u4f7f\u7528\u7cfb\u7edf\u65f6\u95f4\u751f\u6210\u968f\u673a\u79cd\u5b50\nunsigned seed = chrono::system_clock::now().time_since_epoch().count();\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nshuffle(nums.begin(), nums.end(), default_random_engine(seed));\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(vector<int>& nums) {\nfor (int i = 0; i < nums.size(); i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.py
def random_numbers(n: int) -> List[int]:\n\"\"\" \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a: 1, 2, ..., n \uff0c\u987a\u5e8f\u88ab\u6253\u4e71 \"\"\"\n# \u751f\u6210\u6570\u7ec4 nums =: 1, 2, 3, ..., n\nnums: List[int] = [i for i in range(1, n + 1)]\n# \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nrandom.shuffle(nums)\nreturn nums\ndef find_one(nums: List[int]) -> int:\n\"\"\" \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 \"\"\"\nfor i in range(len(nums)):\n# \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n# \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1:\nreturn i\nreturn -1\n
worst_best_time_complexity.go
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunc randomNumbers(n int) []int {\nnums := make([]int, n)\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor i := 0; i < n; i++ {\nnums[i] = i + 1\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nrand.Shuffle(len(nums), func(i, j int) {\nnums[i], nums[j] = nums[j], nums[i]\n})\nreturn nums\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunc findOne(nums []int) int {\nfor i := 0; i < len(nums); i++ {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1 {\nreturn i\n}\n}\nreturn -1\n}\n
worst_best_time_complexity.js
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunction randomNumbers(n) {\nconst nums = Array(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (let i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (let i = 0; i < n; i++) {\nconst r = Math.floor(Math.random() * (i + 1));\nconst temp = nums[i];\nnums[i] = nums[r];\nnums[r] = temp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunction findOne(nums) {\nfor (let i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] === 1) {\nreturn i;\n}\n}\nreturn -1;\n}\n
worst_best_time_complexity.ts
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunction randomNumbers(n: number): number[] {\nconst nums = Array(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (let i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (let i = 0; i < n; i++) {\nconst r = Math.floor(Math.random() * (i + 1));\nconst temp = nums[i];\nnums[i] = nums[r];\nnums[r] = temp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunction findOne(nums: number[]): number {\nfor (let i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] === 1) {\nreturn i;\n}\n}\nreturn -1;\n}\n
worst_best_time_complexity.c
[class]{}-[func]{randomNumbers}\n[class]{}-[func]{findOne}\n
worst_best_time_complexity.cs
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nint[] randomNumbers(int n)\n{\nint[] nums = new int[n];\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++)\n{\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (int i = 0; i < nums.Length; i++)\n{\nvar index = new Random().Next(i, nums.Length);\nvar tmp = nums[i];\nvar ran = nums[index];\nnums[i] = ran;\nnums[index] = tmp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(int[] nums)\n{\nfor (int i = 0; i < nums.Length; i++)\n{\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.swift
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunc randomNumbers(n: Int) -> [Int] {\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nvar nums = Array(1 ... n)\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nnums.shuffle()\nreturn nums\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunc findOne(nums: [Int]) -> Int {\nfor i in nums.indices {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1 {\nreturn i\n}\n}\nreturn -1\n}\n
worst_best_time_complexity.zig
// \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71\npub fn randomNumbers(comptime n: usize) [n]i32 {\nvar nums: [n]i32 = undefined;\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (nums) |*num, i| {\nnum.* = @intCast(i32, i) + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nconst rand = std.crypto.random;\nrand.shuffle(i32, &nums);\nreturn nums;\n}\n// \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15\npub fn findOne(nums: []i32) i32 {\nfor (nums) |num, i| {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (num == 1) return @intCast(i32, i);\n}\nreturn -1;\n}\n

Tip

\u6211\u4eec\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u5f88\u5c11\u4f7f\u7528\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u56e0\u4e3a\u5f80\u5f80\u53ea\u6709\u5f88\u5c0f\u6982\u7387\u4e0b\u624d\u80fd\u8fbe\u5230\uff0c\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u8bef\u5bfc\u6027\u3002\u53cd\u4e4b\uff0c\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u6700\u4e3a\u5b9e\u7528\uff0c\u56e0\u4e3a\u5b83\u7ed9\u51fa\u4e86\u4e00\u4e2a\u201c\u6548\u7387\u5b89\u5168\u503c\u201d\uff0c\u8ba9\u6211\u4eec\u53ef\u4ee5\u653e\u5fc3\u5730\u4f7f\u7528\u7b97\u6cd5\u3002

\u4ece\u4e0a\u8ff0\u793a\u4f8b\u53ef\u4ee5\u770b\u51fa\uff0c\u6700\u5dee\u6216\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u53ea\u51fa\u73b0\u5728\u201c\u7279\u6b8a\u5206\u5e03\u7684\u6570\u636e\u201d\u4e2d\uff0c\u8fd9\u4e9b\u60c5\u51b5\u7684\u51fa\u73b0\u6982\u7387\u5f80\u5f80\u5f88\u5c0f\uff0c\u56e0\u6b64\u5e76\u4e0d\u80fd\u6700\u771f\u5b9e\u5730\u53cd\u6620\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u3002\u76f8\u5bf9\u5730\uff0c\u300c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u53ef\u4ee5\u4f53\u73b0\u7b97\u6cd5\u5728\u968f\u673a\u8f93\u5165\u6570\u636e\u4e0b\u7684\u8fd0\u884c\u6548\u7387\uff0c\u7528 \\(\\Theta\\) \u8bb0\u53f7\uff08Theta Notation\uff09\u6765\u8868\u793a\u3002

\u5bf9\u4e8e\u90e8\u5206\u7b97\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u5730\u63a8\u7b97\u51fa\u968f\u673a\u6570\u636e\u5206\u5e03\u4e0b\u7684\u5e73\u5747\u60c5\u51b5\u3002\u6bd4\u5982\u4e0a\u8ff0\u793a\u4f8b\uff0c\u7531\u4e8e\u8f93\u5165\u6570\u7ec4\u662f\u88ab\u6253\u4e71\u7684\uff0c\u56e0\u6b64\u5143\u7d20 \\(1\\) \u51fa\u73b0\u5728\u4efb\u610f\u7d22\u5f15\u7684\u6982\u7387\u90fd\u662f\u76f8\u7b49\u7684\uff0c\u90a3\u4e48\u7b97\u6cd5\u7684\u5e73\u5747\u5faa\u73af\u6b21\u6570\u5219\u662f\u6570\u7ec4\u957f\u5ea6\u7684\u4e00\u534a \\(\\frac{n}{2}\\) \uff0c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(\\Theta(\\frac{n}{2}) = \\Theta(n)\\) \u3002

\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5c24\u5176\u662f\u8f83\u4e3a\u590d\u6742\u7684\u7b97\u6cd5\uff0c\u8ba1\u7b97\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u6bd4\u8f83\u56f0\u96be\uff0c\u56e0\u4e3a\u5f88\u96be\u7b80\u4fbf\u5730\u5206\u6790\u51fa\u5728\u6570\u636e\u5206\u5e03\u4e0b\u7684\u6574\u4f53\u6570\u5b66\u671f\u671b\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u4f5c\u4e3a\u7b97\u6cd5\u6548\u7387\u7684\u8bc4\u5224\u6807\u51c6\u3002

\u4e3a\u4ec0\u4e48\u5f88\u5c11\u770b\u5230 \\(\\Theta\\) \u7b26\u53f7\uff1f

\u5b9e\u9645\u4e2d\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u300c\u5927 \\(O\\) \u7b26\u53f7\u300d\u6765\u8868\u793a\u300c\u5e73\u5747\u590d\u6742\u5ea6\u300d\uff0c\u8fd9\u6837\u4e25\u683c\u610f\u4e49\u4e0a\u6765\u8bf4\u662f\u4e0d\u89c4\u8303\u7684\u3002\u8fd9\u53ef\u80fd\u662f\u56e0\u4e3a \\(O\\) \u7b26\u53f7\u5b9e\u5728\u662f\u592a\u6717\u6717\u4e0a\u53e3\u4e86\u3002\u5982\u679c\u5728\u672c\u4e66\u548c\u5176\u4ed6\u8d44\u6599\u4e2d\u770b\u5230\u7c7b\u4f3c \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \u7684\u8868\u8ff0\uff0c\u8bf7\u4f60\u76f4\u63a5\u7406\u89e3\u4e3a \\(\\Theta(n)\\) \u5373\u53ef\u3002

"},{"location":"chapter_data_structure/classification_of_data_structure/","title":"3.2. \u00a0 \u6570\u636e\u7ed3\u6784\u5206\u7c7b","text":"

\u6570\u636e\u7ed3\u6784\u4e3b\u8981\u53ef\u6839\u636e\u300c\u903b\u8f91\u7ed3\u6784\u300d\u548c\u300c\u7269\u7406\u7ed3\u6784\u300d\u4e24\u79cd\u89d2\u5ea6\u8fdb\u884c\u5206\u7c7b\u3002

"},{"location":"chapter_data_structure/classification_of_data_structure/#321","title":"3.2.1. \u00a0 \u903b\u8f91\u7ed3\u6784\uff1a\u7ebf\u6027\u4e0e\u975e\u7ebf\u6027","text":"

\u300c\u903b\u8f91\u7ed3\u6784\u300d\u53cd\u6620\u4e86\u6570\u636e\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u3002\u6570\u7ec4\u548c\u94fe\u8868\u7684\u6570\u636e\u6309\u7167\u987a\u5e8f\u4f9d\u6b21\u6392\u5217\uff0c\u53cd\u6620\u4e86\u6570\u636e\u95f4\u7684\u7ebf\u6027\u5173\u7cfb\uff1b\u6811\u4ece\u9876\u81f3\u5e95\u6309\u5c42\u7ea7\u6392\u5217\uff0c\u53cd\u6620\u4e86\u7956\u5148\u4e0e\u540e\u4ee3\u4e4b\u95f4\u7684\u6d3e\u751f\u5173\u7cfb\uff1b\u56fe\u7531\u7ed3\u70b9\u548c\u8fb9\u7ec4\u6210\uff0c\u53cd\u6620\u4e86\u590d\u6742\u7f51\u7edc\u5173\u7cfb\u3002

\u6211\u4eec\u4e00\u822c\u5c06\u903b\u8f91\u7ed3\u6784\u5206\u4e3a\u300c\u7ebf\u6027\u300d\u548c\u300c\u975e\u7ebf\u6027\u300d\u4e24\u79cd\u3002\u201c\u7ebf\u6027\u201d\u8fd9\u4e2a\u6982\u5ff5\u5f88\u76f4\u89c2\uff0c\u5373\u8868\u660e\u6570\u636e\u5728\u903b\u8f91\u5173\u7cfb\u4e0a\u662f\u6392\u6210\u4e00\u6761\u7ebf\u7684\uff1b\u800c\u5982\u679c\u6570\u636e\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u662f\u975e\u7ebf\u6027\u7684\uff08\u4f8b\u5982\u662f\u7f51\u72b6\u6216\u6811\u72b6\u7684\uff09\uff0c\u90a3\u4e48\u5c31\u662f\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002

  • \u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff1a\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\uff1b
  • \u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff1a\u6811\u3001\u56fe\u3001\u5806\u3001\u54c8\u5e0c\u8868\uff1b

Fig. \u7ebf\u6027\u4e0e\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784

"},{"location":"chapter_data_structure/classification_of_data_structure/#322","title":"3.2.2. \u00a0 \u7269\u7406\u7ed3\u6784\uff1a\u8fde\u7eed\u4e0e\u79bb\u6563","text":"

Note

\u82e5\u611f\u5230\u9605\u8bfb\u56f0\u96be\uff0c\u5efa\u8bae\u5148\u770b\u5b8c\u4e0b\u4e2a\u7ae0\u8282\u300c\u6570\u7ec4\u4e0e\u94fe\u8868\u300d\uff0c\u518d\u56de\u8fc7\u5934\u6765\u7406\u89e3\u7269\u7406\u7ed3\u6784\u7684\u542b\u4e49\u3002

\u300c\u7269\u7406\u7ed3\u6784\u300d\u53cd\u6620\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u65b9\u5f0f\u3002\u4ece\u672c\u8d28\u4e0a\u770b\uff0c\u5206\u522b\u662f \u6570\u7ec4\u7684\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8 \u548c \u94fe\u8868\u7684\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\u3002\u7269\u7406\u7ed3\u6784\u4ece\u5e95\u5c42\u4e0a\u51b3\u5b9a\u4e86\u6570\u636e\u7684\u8bbf\u95ee\u3001\u66f4\u65b0\u3001\u589e\u5220\u7b49\u64cd\u4f5c\u65b9\u6cd5\uff0c\u5728\u65f6\u95f4\u6548\u7387\u548c\u7a7a\u95f4\u6548\u7387\u65b9\u9762\u5448\u73b0\u51fa\u6b64\u6d88\u5f7c\u957f\u7684\u7279\u6027\u3002

Fig. \u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\u4e0e\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8

\u6240\u6709\u6570\u636e\u7ed3\u6784\u90fd\u662f\u57fa\u4e8e\u6570\u7ec4\u3001\u6216\u94fe\u8868\u3001\u6216\u4e24\u8005\u7ec4\u5408\u5b9e\u73b0\u7684\u3002\u4f8b\u5982\u6808\u548c\u961f\u5217\uff0c\u65e2\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u5b9e\u73b0\u3001\u4e5f\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u5b9e\u73b0\uff0c\u800c\u4f8b\u5982\u54c8\u5e0c\u8868\uff0c\u5176\u5b9e\u73b0\u540c\u65f6\u5305\u542b\u4e86\u6570\u7ec4\u548c\u94fe\u8868\u3002

  • \u57fa\u4e8e\u6570\u7ec4\u53ef\u5b9e\u73b0\uff1a\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u3001\u77e9\u9635\u3001\u5f20\u91cf\uff08\u7ef4\u5ea6 \\(\\geq 3\\) \u7684\u6570\u7ec4\uff09\u7b49\uff1b
  • \u57fa\u4e8e\u94fe\u8868\u53ef\u5b9e\u73b0\uff1a\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u7b49\uff1b

\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u4e5f\u88ab\u79f0\u4e3a\u300c\u9759\u6001\u6570\u636e\u7ed3\u6784\u300d\uff0c\u8fd9\u610f\u5473\u7740\u8be5\u6570\u636e\u7ed3\u6784\u5728\u5728\u88ab\u521d\u59cb\u5316\u540e\uff0c\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u76f8\u53cd\u5730\uff0c\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u88ab\u79f0\u4e3a\u300c\u52a8\u6001\u6570\u636e\u7ed3\u6784\u300d\uff0c\u8be5\u6570\u636e\u7ed3\u6784\u5728\u88ab\u521d\u59cb\u5316\u540e\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5728\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u4fee\u6539\u5176\u957f\u5ea6\u3002

Tip

\u6570\u7ec4\u4e0e\u94fe\u8868\u662f\u5176\u4ed6\u6240\u6709\u6570\u636e\u7ed3\u6784\u7684\u201c\u5e95\u5c42\u79ef\u6728\u201d\uff0c\u5efa\u8bae\u8bfb\u8005\u4e00\u5b9a\u8981\u591a\u82b1\u4e9b\u65f6\u95f4\u4e86\u89e3\u3002

"},{"location":"chapter_data_structure/data_and_memory/","title":"3.1. \u00a0 \u6570\u636e\u4e0e\u5185\u5b58","text":""},{"location":"chapter_data_structure/data_and_memory/#311","title":"3.1.1. \u00a0 \u57fa\u672c\u6570\u636e\u7c7b\u578b","text":"

\u8c08\u5230\u8ba1\u7b97\u673a\u4e2d\u7684\u6570\u636e\uff0c\u6211\u4eec\u80fd\u591f\u60f3\u5230\u6587\u672c\u3001\u56fe\u7247\u3001\u89c6\u9891\u3001\u8bed\u97f3\u30013D \u6a21\u578b\u7b49\u7b49\uff0c\u8fd9\u4e9b\u6570\u636e\u867d\u7136\u7ec4\u7ec7\u5f62\u5f0f\u4e0d\u540c\uff0c\u4f46\u90fd\u662f\u7531\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u6784\u6210\u7684\u3002

\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u662f CPU \u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u8fd0\u7b97\u7684\u7c7b\u578b\uff0c\u5728\u7b97\u6cd5\u4e2d\u76f4\u63a5\u88ab\u4f7f\u7528\u3002

  • \u300c\u6574\u6570\u300d\u6839\u636e\u4e0d\u540c\u7684\u957f\u5ea6\u5206\u4e3a byte, short, int, long \uff0c\u6839\u636e\u7b97\u6cd5\u9700\u6c42\u9009\u7528\uff0c\u5373\u5728\u6ee1\u8db3\u53d6\u503c\u8303\u56f4\u7684\u60c5\u51b5\u4e0b\u5c3d\u91cf\u51cf\u5c0f\u5185\u5b58\u7a7a\u95f4\u5360\u7528\uff1b
  • \u300c\u6d6e\u70b9\u6570\u300d\u4ee3\u8868\u5c0f\u6570\uff0c\u6839\u636e\u957f\u5ea6\u5206\u4e3a float, double \uff0c\u540c\u6837\u6839\u636e\u7b97\u6cd5\u7684\u5b9e\u9645\u9700\u6c42\u9009\u7528\uff1b
  • \u300c\u5b57\u7b26\u300d\u5728\u8ba1\u7b97\u673a\u4e2d\u662f\u4ee5\u5b57\u7b26\u96c6\u7684\u5f62\u5f0f\u4fdd\u5b58\u7684\uff0cchar \u7684\u503c\u5b9e\u9645\u4e0a\u662f\u6570\u5b57\uff0c\u4ee3\u8868\u5b57\u7b26\u96c6\u4e2d\u7684\u7f16\u53f7\uff0c\u8ba1\u7b97\u673a\u901a\u8fc7\u5b57\u7b26\u96c6\u67e5\u8868\u6765\u5b8c\u6210\u7f16\u53f7\u5230\u5b57\u7b26\u7684\u8f6c\u6362\u3002\u5360\u7528\u7a7a\u95f4\u901a\u5e38\u4e3a 2 bytes \u6216 1 byte \uff1b
  • \u300c\u5e03\u5c14\u300d\u4ee3\u8868\u903b\u8f91\u4e2d\u7684\u201c\u662f\u201d\u4e0e\u201c\u5426\u201d\uff0c\u5176\u5360\u7528\u7a7a\u95f4\u9700\u6839\u636e\u7f16\u7a0b\u8bed\u8a00\u786e\u5b9a\uff0c\u901a\u5e38\u4e3a 1 byte \u6216 1 bit \uff1b
\u7c7b\u522b \u7b26\u53f7 \u5360\u7528\u7a7a\u95f4 \u53d6\u503c\u8303\u56f4 \u9ed8\u8ba4\u503c \u6574\u6570 byte 1 byte \\(-2^7\\) ~ \\(2^7 - 1\\) ( \\(-128\\) ~ \\(127\\) ) \\(0\\) short 2 bytes \\(-2^{15}\\) ~ \\(2^{15} - 1\\) \\(0\\) int 4 bytes \\(-2^{31}\\) ~ \\(2^{31} - 1\\) \\(0\\) long 8 bytes \\(-2^{63}\\) ~ \\(2^{63} - 1\\) \\(0\\) \u6d6e\u70b9\u6570 float 4 bytes \\(-3.4 \\times 10^{38}\\) ~ \\(3.4 \\times 10^{38}\\) \\(0.0\\) f double 8 bytes \\(-1.7 \\times 10^{308}\\) ~ \\(1.7 \\times 10^{308}\\) \\(0.0\\) \u5b57\u7b26 char 2 bytes / 1 byte \\(0\\) ~ \\(2^{16} - 1\\) \\(0\\) \u5e03\u5c14 bool 1 byte / 1 bit \\(\\text{true}\\) \u6216 \\(\\text{false}\\) \\(\\text{false}\\)

Tip

\u4ee5\u4e0a\u8868\u683c\u4e2d\uff0c\u52a0\u7c97\u9879\u5728\u300c\u7b97\u6cd5\u9898\u300d\u4e2d\u6700\u4e3a\u5e38\u7528\u3002\u6b64\u8868\u683c\u65e0\u9700\u786c\u80cc\uff0c\u5927\u81f4\u7406\u89e3\u5373\u53ef\uff0c\u9700\u8981\u65f6\u53ef\u4ee5\u901a\u8fc7\u67e5\u8868\u6765\u56de\u5fc6\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_1","title":"\u6574\u6570\u8868\u793a\u65b9\u5f0f","text":"

\u6574\u6570\u7684\u53d6\u503c\u8303\u56f4\u53d6\u51b3\u4e8e\u53d8\u91cf\u4f7f\u7528\u7684\u5185\u5b58\u957f\u5ea6\uff0c\u5373\u5b57\u8282\uff08\u6216\u6bd4\u7279\uff09\u6570\u3002\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c 1 \u5b57\u8282 (byte) = 8 \u6bd4\u7279 (bit) \uff0c 1 \u6bd4\u7279\u5373 1 \u4e2a\u4e8c\u8fdb\u5236\u4f4d\u3002\u4ee5 int \u7c7b\u578b\u4e3a\u4f8b\uff1a

  1. \u6574\u6570\u7c7b\u578b int \u5360\u7528 4 bytes = 32 bits \uff0c\u56e0\u6b64\u53ef\u4ee5\u8868\u793a \\(2^{32}\\) \u4e2a\u4e0d\u540c\u7684\u6570\u5b57\uff1b
  2. \u5c06\u6700\u9ad8\u4f4d\u770b\u4f5c\u7b26\u53f7\u4f4d\uff0c\\(0\\) \u4ee3\u8868\u6b63\u6570\uff0c\\(1\\) \u4ee3\u8868\u8d1f\u6570\uff0c\u4ece\u800c\u53ef\u4ee5\u8868\u793a \\(2^{31}\\) \u4e2a\u6b63\u6570\u548c \\(2^{31}\\) \u4e2a\u8d1f\u6570\uff1b
  3. \u5f53\u6240\u6709 bits \u4e3a 0 \u65f6\u4ee3\u8868\u6570\u5b57 \\(0\\) \uff0c\u4ece\u96f6\u5f00\u59cb\u589e\u5927\uff0c\u53ef\u5f97\u6700\u5927\u6b63\u6570\u4e3a \\(2^{31} - 1\\) \uff1b
  4. \u5269\u4f59 \\(2^{31}\\) \u4e2a\u6570\u5b57\u5168\u90e8\u7528\u6765\u8868\u793a\u8d1f\u6570\uff0c\u56e0\u6b64\u6700\u5c0f\u8d1f\u6570\u4e3a \\(-2^{31}\\) \uff1b\u5177\u4f53\u7ec6\u8282\u6d89\u53ca\u5230\u5230\u201c\u6e90\u7801\u3001\u53cd\u7801\u3001\u8865\u7801\u201d\u77e5\u8bc6\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u67e5\u9605\u5b66\u4e60\uff1b

\u5176\u5b83\u6574\u6570\u7c7b\u578b byte, short, long \u53d6\u503c\u8303\u56f4\u7684\u8ba1\u7b97\u65b9\u6cd5\u4e0e int \u7c7b\u4f3c\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_2","title":"\u6d6e\u70b9\u6570\u8868\u793a\u65b9\u5f0f *","text":"

Note

\u5728\u672c\u4e66\u4e2d\uff0c\u6807\u9898\u540e\u7684 * \u7b26\u53f7\u4ee3\u8868\u9009\u8bfb\u7ae0\u8282\uff0c\u5982\u679c\u4f60\u89c9\u5f97\u7406\u89e3\u56f0\u96be\uff0c\u5efa\u8bae\u5148\u8df3\u8fc7\uff0c\u7b49\u5b66\u5b8c\u5fc5\u8bfb\u7ae0\u8282\u540e\u7eed\u518d\u5355\u72ec\u653b\u514b\u3002

\u7ec6\u5fc3\u7684\u4f60\u53ef\u80fd\u4f1a\u7591\u60d1\uff1a int \u548c float \u957f\u5ea6\u76f8\u540c\uff0c\u90fd\u662f 4 bytes \uff0c\u4f46\u4e3a\u4ec0\u4e48 float \u7684\u53d6\u503c\u8303\u56f4\u8fdc\u5927\u4e8e int \uff1f\u6309\u8bf4 float \u9700\u8981\u8868\u793a\u5c0f\u6570\uff0c\u53d6\u503c\u8303\u56f4\u5e94\u8be5\u53d8\u5c0f\u624d\u5bf9\u3002

\u5176\u5b9e\uff0c\u8fd9\u662f\u56e0\u4e3a\u6d6e\u70b9\u6570 float \u91c7\u7528\u4e86\u4e0d\u540c\u7684\u8868\u793a\u65b9\u5f0f\u3002IEEE 754 \u6807\u51c6\u89c4\u5b9a\uff0c32-bit \u957f\u5ea6\u7684 float \u7531\u4ee5\u4e0b\u90e8\u5206\u6784\u6210\uff1a

  • \u7b26\u53f7\u4f4d \\(\\mathrm{S}\\) \uff1a\u5360 1 bit \uff1b
  • \u6307\u6570\u4f4d \\(\\mathrm{E}\\) \uff1a\u5360 8 bits \uff1b
  • \u5206\u6570\u4f4d \\(\\mathrm{N}\\) \uff1a\u5360 24 bits \uff0c\u5176\u4e2d 23 \u4f4d\u663e\u5f0f\u5b58\u50a8\uff1b

\u8bbe 32-bit \u4e8c\u8fdb\u5236\u6570\u7684\u7b2c \\(i\\) \u4f4d\u4e3a \\(b_i\\) \uff0c\u5219 float \u503c\u7684\u8ba1\u7b97\u65b9\u6cd5\u5b9a\u4e49\u4e3a

\\[ \\text { val } = (-1)^{b_{31}} \\times 2^{\\left(b_{30} b_{29} \\ldots b_{23}\\right)_2-127} \\times\\left(1 . b_{22} b_{21} \\ldots b_0\\right)_2 \\]

\u8f6c\u5316\u5230\u5341\u8fdb\u5236\u4e0b\u7684\u8ba1\u7b97\u516c\u5f0f\u4e3a

\\[ \\text { val }=(-1)^{\\mathrm{S}} \\times 2^{\\mathrm{E} -127} \\times (1 + \\mathrm{N}) \\]

\u5176\u4e2d\u5404\u9879\u7684\u53d6\u503c\u8303\u56f4\u4e3a

\\[ \\begin{aligned} \\mathrm{S} \\in & \\{ 0, 1\\} , \\quad \\mathrm{E} \\in \\{ 1, 2, \\dots, 254 \\} \\newline (1 + \\mathrm{N}) = & (1 + \\sum_{i=1}^{23} b_{23-i} 2^{-i}) \\subset [1, 2 - 2^{-23}] \\end{aligned} \\]

Fig. IEEE 754 \u6807\u51c6\u4e0b\u7684 float \u8868\u793a\u65b9\u5f0f

\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\\(\\mathrm{S} = 0\\) \uff0c \\(\\mathrm{E} = 124\\) \uff0c\\(\\mathrm{N} = 2^{-2} + 2^{-3} = 0.375\\) \uff0c\u6613\u5f97

\\[ \\text { val } = (-1)^0 \\times 2^{124 - 127} \\times (1 + 0.375) = 0.171875 \\]

\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u56de\u7b54\u5f00\u59cb\u7684\u95ee\u9898\uff1afloat \u7684\u8868\u793a\u65b9\u5f0f\u5305\u542b\u6307\u6570\u4f4d\uff0c\u5bfc\u81f4\u5176\u53d6\u503c\u8303\u56f4\u8fdc\u5927\u4e8e int \u3002\u6839\u636e\u4ee5\u4e0a\u8ba1\u7b97\uff0c float \u53ef\u8868\u793a\u7684\u6700\u5927\u6b63\u6570\u4e3a \\(2^{254 - 127} \\times (2 - 2^{-23}) \\approx 3.4 \\times 10^{38}\\) \uff0c\u5207\u6362\u7b26\u53f7\u4f4d\u4fbf\u53ef\u5f97\u5230\u6700\u5c0f\u8d1f\u6570\u3002

\u6d6e\u70b9\u6570 float \u867d\u7136\u62d3\u5c55\u4e86\u53d6\u503c\u8303\u56f4\uff0c\u4f46\u526f\u4f5c\u7528\u662f\u727a\u7272\u4e86\u7cbe\u5ea6\u3002\u6574\u6570\u7c7b\u578b int \u5c06\u5168\u90e8 32 \u4f4d\u7528\u4e8e\u8868\u793a\u6570\u5b57\uff0c\u6570\u5b57\u662f\u5747\u5300\u5206\u5e03\u7684\uff1b\u800c\u7531\u4e8e\u6307\u6570\u4f4d\u7684\u5b58\u5728\uff0c\u6d6e\u70b9\u6570 float \u7684\u6570\u503c\u8d8a\u5927\uff0c\u76f8\u90bb\u4e24\u4e2a\u6570\u5b57\u4e4b\u95f4\u7684\u5dee\u503c\u5c31\u4f1a\u8d8b\u5411\u8d8a\u5927\u3002

\u8fdb\u4e00\u6b65\u5730\uff0c\u6307\u6570\u4f4d \\(E = 0\\) \u548c \\(E = 255\\) \u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u7528\u4e8e\u8868\u793a\u96f6\u3001\u65e0\u7a77\u5927\u3001\\(\\mathrm{NaN}\\) \u7b49\u3002

\u6307\u6570\u4f4d E \u5206\u6570\u4f4d \\(\\mathrm{N} = 0\\) \u5206\u6570\u4f4d \\(\\mathrm{N} \\ne 0\\) \u8ba1\u7b97\u516c\u5f0f \\(0\\) \\(\\pm 0\\) \u6b21\u6b63\u89c4\u6570 \\((-1)^{\\mathrm{S}} \\times 2^{-126} \\times (0.\\mathrm{N})\\) \\(1, 2, \\dots, 254\\) \u6b63\u89c4\u6570 \u6b63\u89c4\u6570 \\((-1)^{\\mathrm{S}} \\times 2^{(\\mathrm{E} -127)} \\times (1.\\mathrm{N})\\) \\(255\\) \\(\\pm \\infty\\) \\(\\mathrm{NaN}\\)

\u7279\u522b\u5730\uff0c\u6b21\u6b63\u89c4\u6570\u663e\u8457\u63d0\u5347\u4e86\u5c0f\u6570\u7cbe\u5ea6\uff1a

  • \u6700\u5c0f\u6b63\u6b63\u89c4\u6570\u4e3a \\(2^{-126} \\approx 1.18 \\times 10^{-38}\\) \uff1b
  • \u6700\u5c0f\u6b63\u6b21\u6b63\u89c4\u6570\u4e3a \\(2^{-126} \\times 2^{-23} \\approx 1.4 \\times 10^{-45}\\) \uff1b

\u53cc\u7cbe\u5ea6 double \u4e5f\u91c7\u7528\u7c7b\u4f3c float \u7684\u8868\u793a\u65b9\u6cd5\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_3","title":"\u57fa\u672c\u6570\u636e\u7c7b\u578b\u4e0e\u6570\u636e\u7ed3\u6784\u7684\u5173\u7cfb","text":"

\u6211\u4eec\u77e5\u9053\uff0c\u6570\u636e\u7ed3\u6784\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\uff0c\u5b83\u7684\u4e3b\u8bed\u662f\u201c\u7ed3\u6784\u201d\uff0c\u800c\u4e0d\u662f\u201c\u6570\u636e\u201d\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u8868\u793a\u201c\u4e00\u6392\u6570\u5b57\u201d\uff0c\u81ea\u7136\u60f3\u5230\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u6570\u636e\u7ed3\u6784\u3002\u6570\u7ec4\u7684\u5b58\u50a8\u65b9\u5f0f\u53ef\u4ee5\u8868\u793a\u6570\u5b57\u7684\u76f8\u90bb\u5173\u7cfb\u3001\u987a\u5e8f\u5173\u7cfb\uff0c\u4f46\u81f3\u4e8e\u5176\u4e2d\u5b58\u50a8\u7684\u662f\u6574\u6570 int \uff0c\u8fd8\u662f\u5c0f\u6570 float \uff0c\u6216\u662f\u5b57\u7b26 char \uff0c\u5219\u4e0e\u6240\u8c13\u7684\u6570\u636e\u7684\u7ed3\u6784\u65e0\u5173\u4e86\u3002

\u6362\u8a00\u4e4b\uff0c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u63d0\u4f9b\u4e86\u6570\u636e\u7684\u201c\u5185\u5bb9\u7c7b\u578b\u201d\uff0c\u800c\u6570\u636e\u7ed3\u6784\u63d0\u4f9b\u6570\u636e\u7684\u201c\u7ec4\u7ec7\u65b9\u5f0f\u201d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint[] numbers = new int[5];\nfloat[] decimals = new float[5];\nchar[] characters = new char[5];\nboolean[] booleans = new boolean[5];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint numbers[5];\nfloat decimals[5];\nchar characters[5];\nbool booleans[5];\n
\"\"\" Python \u7684 list \u53ef\u4ee5\u81ea\u7531\u5b58\u50a8\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5bf9\u8c61 \"\"\"\nlist = [0, 0.0, 'a', False]\n
// \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d\nvar numbers = [5]int{}\nvar decimals = [5]float64{}\nvar characters = [5]byte{}\nvar booleans = [5]bool{}\n
/* JavaScript \u7684\u6570\u7ec4\u53ef\u4ee5\u81ea\u7531\u5b58\u50a8\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5bf9\u8c61 */\nconst array = [0, 0.0, 'a', false];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nconst numbers: number[] = [];\nconst characters: string[] = [];\nconst booleans: boolean[] = [];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint numbers[10];\nfloat decimals[10];\nchar characters[10];\nbool booleans[10];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint[] numbers = new int[5];\nfloat[] decimals = new float[5];\nchar[] characters = new char[5];\nbool[] booleans = new bool[5];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nlet numbers = Array(repeating: Int(), count: 5)\nlet decimals = Array(repeating: Double(), count: 5)\nlet characters = Array(repeating: Character(\"a\"), count: 5)\nlet booleans = Array(repeating: Bool(), count: 5)\n
\n
"},{"location":"chapter_data_structure/data_and_memory/#312","title":"3.1.2. \u00a0 \u8ba1\u7b97\u673a\u5185\u5b58","text":"

\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c\u5185\u5b58\u548c\u786c\u76d8\u662f\u4e24\u79cd\u4e3b\u8981\u7684\u5b58\u50a8\u786c\u4ef6\u8bbe\u5907\u3002\u300c\u786c\u76d8\u300d\u4e3b\u8981\u7528\u4e8e\u957f\u671f\u5b58\u50a8\u6570\u636e\uff0c\u5bb9\u91cf\u8f83\u5927\uff08\u901a\u5e38\u53ef\u8fbe\u5230 TB \u7ea7\u522b\uff09\u3001\u901f\u5ea6\u8f83\u6162\u3002\u300c\u5185\u5b58\u300d\u7528\u4e8e\u8fd0\u884c\u7a0b\u5e8f\u65f6\u6682\u5b58\u6570\u636e\uff0c\u901f\u5ea6\u8f83\u5feb\uff0c\u4f46\u5bb9\u91cf\u8f83\u5c0f\uff08\u901a\u5e38\u4e3a GB \u7ea7\u522b\uff09\u3002

\u7b97\u6cd5\u8fd0\u884c\u4e2d\uff0c\u76f8\u5173\u6570\u636e\u90fd\u88ab\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\u3002\u4e0b\u56fe\u5c55\u793a\u4e86\u4e00\u4e2a\u8ba1\u7b97\u673a\u5185\u5b58\u6761\uff0c\u5176\u4e2d\u6bcf\u4e2a\u9ed1\u8272\u65b9\u5757\u90fd\u5305\u542b\u4e00\u5757\u5185\u5b58\u7a7a\u95f4\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u5185\u5b58\u60f3\u8c61\u6210\u4e00\u4e2a\u5de8\u5927\u7684 Excel \u8868\u683c\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5355\u5143\u683c\u90fd\u53ef\u4ee5\u5b58\u50a8 1 byte \u7684\u6570\u636e\uff0c\u5728\u7b97\u6cd5\u8fd0\u884c\u65f6\uff0c\u6240\u6709\u6570\u636e\u90fd\u88ab\u5b58\u50a8\u5728\u8fd9\u4e9b\u5355\u5143\u683c\u4e2d\u3002

\u7cfb\u7edf\u901a\u8fc7\u300c\u5185\u5b58\u5730\u5740 Memory Location\u300d\u6765\u8bbf\u95ee\u76ee\u6807\u5185\u5b58\u4f4d\u7f6e\u7684\u6570\u636e\u3002\u8ba1\u7b97\u673a\u6839\u636e\u7279\u5b9a\u89c4\u5219\u7ed9\u8868\u683c\u4e2d\u6bcf\u4e2a\u5355\u5143\u683c\u7f16\u53f7\uff0c\u4fdd\u8bc1\u6bcf\u5757\u5185\u5b58\u7a7a\u95f4\u90fd\u6709\u72ec\u7acb\u7684\u5185\u5b58\u5730\u5740\u3002\u81ea\u6b64\uff0c\u7a0b\u5e8f\u4fbf\u901a\u8fc7\u8fd9\u4e9b\u5730\u5740\uff0c\u8bbf\u95ee\u5185\u5b58\u4e2d\u7684\u6570\u636e\u3002

Fig. \u5185\u5b58\u6761\u3001\u5185\u5b58\u7a7a\u95f4\u3001\u5185\u5b58\u5730\u5740

\u5185\u5b58\u8d44\u6e90\u662f\u8bbe\u8ba1\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u91cd\u8981\u8003\u8651\u56e0\u7d20\u3002\u5185\u5b58\u662f\u6240\u6709\u7a0b\u5e8f\u7684\u516c\u5171\u8d44\u6e90\uff0c\u5f53\u5185\u5b58\u88ab\u67d0\u7a0b\u5e8f\u5360\u7528\u65f6\uff0c\u4e0d\u80fd\u88ab\u5176\u5b83\u7a0b\u5e8f\u540c\u65f6\u4f7f\u7528\u3002\u6211\u4eec\u9700\u8981\u6839\u636e\u5269\u4f59\u5185\u5b58\u8d44\u6e90\u7684\u60c5\u51b5\u6765\u8bbe\u8ba1\u7b97\u6cd5\u3002\u4f8b\u5982\uff0c\u82e5\u5269\u4f59\u5185\u5b58\u7a7a\u95f4\u6709\u9650\uff0c\u5219\u8981\u6c42\u7b97\u6cd5\u5360\u7528\u7684\u5cf0\u503c\u5185\u5b58\u4e0d\u80fd\u8d85\u8fc7\u7cfb\u7edf\u5269\u4f59\u5185\u5b58\uff1b\u82e5\u8fd0\u884c\u7684\u7a0b\u5e8f\u5f88\u591a\u3001\u7f3a\u5c11\u5927\u5757\u8fde\u7eed\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u5219\u8981\u6c42\u9009\u53d6\u7684\u6570\u636e\u7ed3\u6784\u5fc5\u987b\u80fd\u591f\u5b58\u50a8\u5728\u79bb\u6563\u7684\u5185\u5b58\u7a7a\u95f4\u5185\u3002

"},{"location":"chapter_data_structure/summary/","title":"3.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u6574\u6570 byte, short, int, long \u3001\u6d6e\u70b9\u6570 float, double \u3001\u5b57\u7b26 char \u3001\u5e03\u5c14 boolean \u662f\u8ba1\u7b97\u673a\u4e2d\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u5360\u7528\u7a7a\u95f4\u7684\u5927\u5c0f\u51b3\u5b9a\u4e86\u5b83\u4eec\u7684\u53d6\u503c\u8303\u56f4\u3002
  • \u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u6570\u636e\u5b58\u50a8\u5728\u8ba1\u7b97\u673a\u7684\u5185\u5b58\u4e2d\u3002\u5185\u5b58\u4e2d\u6bcf\u5757\u7a7a\u95f4\u90fd\u6709\u72ec\u7acb\u7684\u5185\u5b58\u5730\u5740\uff0c\u7a0b\u5e8f\u662f\u901a\u8fc7\u5185\u5b58\u5730\u5740\u6765\u8bbf\u95ee\u6570\u636e\u7684\u3002
  • \u6570\u636e\u7ed3\u6784\u4e3b\u8981\u53ef\u4ee5\u4ece\u903b\u8f91\u7ed3\u6784\u548c\u7269\u7406\u7ed3\u6784\u4e24\u4e2a\u89d2\u5ea6\u8fdb\u884c\u5206\u7c7b\u3002\u903b\u8f91\u7ed3\u6784\u53cd\u6620\u4e86\u6570\u636e\u4e2d\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\uff0c\u7269\u7406\u7ed3\u6784\u53cd\u6620\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u5f62\u5f0f\u3002
  • \u5e38\u89c1\u7684\u903b\u8f91\u7ed3\u6784\u6709\u7ebf\u6027\u3001\u6811\u72b6\u3001\u7f51\u72b6\u7b49\u3002\u6211\u4eec\u4e00\u822c\u6839\u636e\u903b\u8f91\u7ed3\u6784\u5c06\u6570\u636e\u7ed3\u6784\u5206\u4e3a\u7ebf\u6027\uff08\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\uff09\u548c\u975e\u7ebf\u6027\uff08\u6811\u3001\u56fe\u3001\u5806\uff09\u4e24\u79cd\u3002\u6839\u636e\u5b9e\u73b0\u65b9\u5f0f\u7684\u4e0d\u540c\uff0c\u54c8\u5e0c\u8868\u53ef\u80fd\u662f\u7ebf\u6027\u6216\u975e\u7ebf\u6027\u3002
  • \u7269\u7406\u7ed3\u6784\u4e3b\u8981\u6709\u4e24\u79cd\uff0c\u5206\u522b\u662f\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\uff08\u6570\u7ec4\uff09\u548c\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\uff08\u94fe\u8868\uff09\uff0c\u6240\u6709\u7684\u6570\u636e\u7ed3\u6784\u90fd\u662f\u7531\u6570\u7ec4\u3001\u6216\u94fe\u8868\u3001\u6216\u4e24\u8005\u7ec4\u5408\u5b9e\u73b0\u7684\u3002
"},{"location":"chapter_graph/graph/","title":"9.1. \u00a0 \u56fe","text":"

\u300c\u56fe Graph\u300d\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u7531\u300c\u9876\u70b9 Vertex\u300d\u548c\u300c\u8fb9 Edge\u300d\u7ec4\u6210\u3002\u6211\u4eec\u53ef\u5c06\u56fe \\(G\\) \u62bd\u8c61\u5730\u8868\u793a\u4e3a\u4e00\u7ec4\u9876\u70b9 \\(V\\) \u548c\u4e00\u7ec4\u8fb9 \\(E\\) \u7684\u96c6\u5408\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u8868\u793a\u4e00\u4e2a\u5305\u542b 5 \u4e2a\u9876\u70b9\u548c 7 \u6761\u8fb9\u7684\u56fe

\\[ \\begin{aligned} V & = \\{ 1, 2, 3, 4, 5 \\} \\newline E & = \\{ (1,2), (1,3), (1,5), (2,3), (2,4), (2,5), (4,5) \\} \\newline G & = \\{ V, E \\} \\newline \\end{aligned} \\]

Fig. \u94fe\u8868\u3001\u6811\u3001\u56fe\u4e4b\u95f4\u7684\u5173\u7cfb

\u90a3\u4e48\uff0c\u56fe\u4e0e\u5176\u4ed6\u6570\u636e\u7ed3\u6784\u7684\u5173\u7cfb\u662f\u4ec0\u4e48\uff1f\u5982\u679c\u6211\u4eec\u628a\u300c\u9876\u70b9\u300d\u770b\u4f5c\u7ed3\u70b9\uff0c\u628a\u300c\u8fb9\u300d\u770b\u4f5c\u8fde\u63a5\u5404\u4e2a\u7ed3\u70b9\u7684\u6307\u9488\uff0c\u5219\u53ef\u5c06\u300c\u56fe\u300d\u770b\u6210\u4e00\u79cd\u4ece\u300c\u94fe\u8868\u300d\u62d3\u5c55\u800c\u6765\u7684\u6570\u636e\u7ed3\u6784\u3002\u76f8\u6bd4\u7ebf\u6027\u5173\u7cfb\uff08\u94fe\u8868\uff09\u548c\u5206\u6cbb\u5173\u7cfb\uff08\u6811\uff09\uff0c\u7f51\u7edc\u5173\u7cfb\uff08\u56fe\uff09\u7684\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u4e5f\u4ece\u800c\u66f4\u4e3a\u590d\u6742\u3002

"},{"location":"chapter_graph/graph/#911","title":"9.1.1. \u00a0 \u56fe\u5e38\u89c1\u7c7b\u578b","text":"

\u6839\u636e\u8fb9\u662f\u5426\u6709\u65b9\u5411\uff0c\u5206\u4e3a\u300c\u65e0\u5411\u56fe Undirected Graph\u300d\u548c\u300c\u6709\u5411\u56fe Directed Graph\u300d\u3002

  • \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u8fb9\u8868\u793a\u4e24\u9876\u70b9\u4e4b\u95f4\u201c\u53cc\u5411\u201d\u7684\u8fde\u63a5\u5173\u7cfb\uff0c\u4f8b\u5982\u5fae\u4fe1\u6216 QQ \u4e2d\u7684\u201c\u597d\u53cb\u5173\u7cfb\u201d\uff1b
  • \u5728\u6709\u5411\u56fe\u4e2d\uff0c\u8fb9\u662f\u6709\u65b9\u5411\u7684\uff0c\u5373 \\(A \\rightarrow B\\) \u548c \\(A \\leftarrow B\\) \u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u662f\u76f8\u4e92\u72ec\u7acb\u7684\uff0c\u4f8b\u5982\u5fae\u535a\u6216\u6296\u97f3\u4e0a\u7684\u201c\u5173\u6ce8\u201d\u4e0e\u201c\u88ab\u5173\u6ce8\u201d\u5173\u7cfb\uff1b

Fig. \u6709\u5411\u56fe\u4e0e\u65e0\u5411\u56fe

\u6839\u636e\u6240\u6709\u9876\u70b9\u662f\u5426\u8fde\u901a\uff0c\u5206\u4e3a\u300c\u8fde\u901a\u56fe Connected Graph\u300d\u548c\u300c\u975e\u8fde\u901a\u56fe Disconnected Graph\u300d\u3002

  • \u5bf9\u4e8e\u8fde\u901a\u56fe\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u53ef\u4ee5\u5230\u8fbe\u5176\u4f59\u4efb\u610f\u9876\u70b9\uff1b
  • \u5bf9\u4e8e\u975e\u8fde\u901a\u56fe\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u81f3\u5c11\u6709\u4e00\u4e2a\u9876\u70b9\u65e0\u6cd5\u5230\u8fbe\uff1b

Fig. \u8fde\u901a\u56fe\u4e0e\u975e\u8fde\u901a\u56fe

\u6211\u4eec\u53ef\u4ee5\u7ed9\u8fb9\u6dfb\u52a0\u201c\u6743\u91cd\u201d\u53d8\u91cf\uff0c\u5f97\u5230\u300c\u6709\u6743\u56fe Weighted Graph\u300d\u3002\u4f8b\u5982\uff0c\u5728\u738b\u8005\u8363\u8000\u7b49\u6e38\u620f\u4e2d\uff0c\u7cfb\u7edf\u4f1a\u6839\u636e\u5171\u540c\u6e38\u620f\u65f6\u95f4\u6765\u8ba1\u7b97\u73a9\u5bb6\u4e4b\u95f4\u7684\u201c\u4eb2\u5bc6\u5ea6\u201d\uff0c\u8fd9\u79cd\u4eb2\u5bc6\u5ea6\u7f51\u7edc\u5c31\u53ef\u4ee5\u4f7f\u7528\u6709\u6743\u56fe\u6765\u8868\u793a\u3002

Fig. \u6709\u6743\u56fe\u4e0e\u65e0\u6743\u56fe

"},{"location":"chapter_graph/graph/#912","title":"9.1.2. \u00a0 \u56fe\u5e38\u7528\u672f\u8bed","text":"
  • \u300c\u90bb\u63a5 Adjacency\u300d\uff1a\u5f53\u4e24\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u76f8\u8fde\u65f6\uff0c\u79f0\u6b64\u4e24\u9876\u70b9\u201c\u90bb\u63a5\u201d\u3002\u4f8b\u5982\uff0c\u4e0a\u56fe\u4e2d\u9876\u70b9 1 \u7684\u90bb\u63a5\u9876\u70b9\u4e3a\u9876\u70b9 2, 3, 5 \u3002
  • \u300c\u8def\u5f84 Path\u300d\uff1a\u4ece\u9876\u70b9 A \u5230\u9876\u70b9 B \u8d70\u8fc7\u7684\u8fb9\u6784\u6210\u7684\u5e8f\u5217\uff0c\u88ab\u79f0\u4e3a\u4ece A \u5230 B \u7684\u201c\u8def\u5f84\u201d\u3002\u4f8b\u5982\uff0c\u4e0a\u56fe\u4e2d 1, 5, 2, 4 \u662f\u9876\u70b9 1 \u5230\u9876\u70b9 4 \u7684\u4e00\u4e2a\u8def\u5f84\u3002
  • \u300c\u5ea6 Degree\u300d\u8868\u793a\u4e00\u4e2a\u9876\u70b9\u5177\u6709\u591a\u5c11\u6761\u8fb9\u3002\u5bf9\u4e8e\u6709\u5411\u56fe\uff0c\u300c\u5165\u5ea6 In-Degree\u300d\u8868\u793a\u6709\u591a\u5c11\u6761\u8fb9\u6307\u5411\u8be5\u9876\u70b9\uff0c\u300c\u51fa\u5ea6 Out-Degree\u300d\u8868\u793a\u6709\u591a\u5c11\u6761\u8fb9\u4ece\u8be5\u9876\u70b9\u6307\u51fa\u3002
"},{"location":"chapter_graph/graph/#913","title":"9.1.3. \u00a0 \u56fe\u7684\u8868\u793a","text":"

\u56fe\u7684\u5e38\u7528\u8868\u793a\u65b9\u6cd5\u6709\u300c\u90bb\u63a5\u77e9\u9635\u300d\u548c\u300c\u90bb\u63a5\u8868\u300d\u3002\u4ee5\u4e0b\u4f7f\u7528\u300c\u65e0\u5411\u56fe\u300d\u6765\u4e3e\u4f8b\u3002

"},{"location":"chapter_graph/graph/#_1","title":"\u90bb\u63a5\u77e9\u9635","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u6570\u91cf\u4e3a \\(n\\) \uff0c\u300c\u90bb\u63a5\u77e9\u9635 Adjacency Matrix\u300d\u4f7f\u7528\u4e00\u4e2a \\(n \\times n\\) \u5927\u5c0f\u7684\u77e9\u9635\u6765\u8868\u793a\u56fe\uff0c\u6bcf\u4e00\u884c\uff08\u5217\uff09\u4ee3\u8868\u4e00\u4e2a\u9876\u70b9\uff0c\u77e9\u9635\u5143\u7d20\u4ee3\u8868\u8fb9\uff0c\u4f7f\u7528 \\(1\\) \u6216 \\(0\\) \u6765\u8868\u793a\u4e24\u4e2a\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u6216\u65e0\u8fb9\u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8bb0\u90bb\u63a5\u77e9\u9635\u4e3a \\(M\\) \u3001\u9876\u70b9\u5217\u8868\u4e3a \\(V\\) \uff0c\u5219\u77e9\u9635\u5143\u7d20 \\(M[i][j] = 1\\) \u4ee3\u8868\u7740\u9876\u70b9 \\(V[i]\\) \u5230\u9876\u70b9 \\(V[j]\\) \u4e4b\u95f4\u6709\u8fb9\uff0c\u76f8\u53cd\u5730 \\(M[i][j] = 0\\) \u4ee3\u8868\u4e24\u9876\u70b9\u4e4b\u95f4\u65e0\u8fb9\u3002

Fig. \u56fe\u7684\u90bb\u63a5\u77e9\u9635\u8868\u793a

\u90bb\u63a5\u77e9\u9635\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a

  • \u9876\u70b9\u4e0d\u80fd\u4e0e\u81ea\u8eab\u76f8\u8fde\uff0c\u56e0\u800c\u90bb\u63a5\u77e9\u9635\u4e3b\u5bf9\u89d2\u7ebf\u5143\u7d20\u6ca1\u6709\u610f\u4e49\u3002
  • \u300c\u65e0\u5411\u56fe\u300d\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u7b49\u4ef7\uff0c\u6b64\u65f6\u90bb\u63a5\u77e9\u9635\u5173\u4e8e\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\u3002
  • \u5c06\u90bb\u63a5\u77e9\u9635\u7684\u5143\u7d20\u4ece \\(1\\) , \\(0\\) \u66ff\u6362\u4e3a\u6743\u91cd\uff0c\u5219\u80fd\u591f\u8868\u793a\u300c\u6709\u6743\u56fe\u300d\u3002

\u4f7f\u7528\u90bb\u63a5\u77e9\u9635\u8868\u793a\u56fe\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u8bbf\u95ee\u77e9\u9635\u5143\u7d20\u6765\u83b7\u53d6\u8fb9\uff0c\u56e0\u6b64\u589e\u5220\u67e5\u64cd\u4f5c\u7684\u6548\u7387\u5f88\u9ad8\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u4e3a \\(O(1)\\) \u3002\u7136\u800c\uff0c\u77e9\u9635\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff0c\u5185\u5b58\u5360\u7528\u8f83\u5927\u3002

"},{"location":"chapter_graph/graph/#_2","title":"\u90bb\u63a5\u8868","text":"

\u300c\u90bb\u63a5\u8868 Adjacency List\u300d\u4f7f\u7528 \\(n\\) \u4e2a\u94fe\u8868\u6765\u8868\u793a\u56fe\uff0c\u94fe\u8868\u7ed3\u70b9\u8868\u793a\u9876\u70b9\u3002\u7b2c \\(i\\) \u6761\u94fe\u8868\u5bf9\u5e94\u9876\u70b9 \\(i\\) \uff0c\u5176\u4e2d\u5b58\u50a8\u4e86\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff08\u5373\u4e0e\u8be5\u9876\u70b9\u76f8\u8fde\u7684\u9876\u70b9\uff09\u3002

Fig. \u56fe\u7684\u90bb\u63a5\u8868\u8868\u793a

\u90bb\u63a5\u8868\u4ec5\u5b58\u50a8\u5b58\u5728\u7684\u8fb9\uff0c\u800c\u8fb9\u7684\u603b\u6570\u5f80\u5f80\u8fdc\u5c0f\u4e8e \\(n^2\\) \uff0c\u56e0\u6b64\u66f4\u52a0\u8282\u7701\u7a7a\u95f4\u3002\u4f46\u662f\uff0c\u56e0\u4e3a\u5728\u90bb\u63a5\u8868\u4e2d\u9700\u8981\u901a\u8fc7\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u8fb9\uff0c\u6240\u4ee5\u5176\u65f6\u95f4\u6548\u7387\u4e0d\u5982\u90bb\u63a5\u77e9\u9635\u3002

\u89c2\u5bdf\u4e0a\u56fe\u53d1\u73b0\uff0c\u90bb\u63a5\u8868\u7ed3\u6784\u4e0e\u54c8\u5e0c\u8868\u300c\u94fe\u5730\u5740\u6cd5\u300d\u975e\u5e38\u76f8\u4f3c\uff0c\u56e0\u6b64\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528\u7c7b\u4f3c\u65b9\u6cd5\u6765\u4f18\u5316\u6548\u7387\u3002\u6bd4\u5982\uff0c\u5f53\u94fe\u8868\u8f83\u957f\u65f6\uff0c\u53ef\u4ee5\u628a\u94fe\u8868\u8f6c\u5316\u4e3a AVL \u6811\u6216\u7ea2\u9ed1\u6811\uff0c\u4ece\u800c\u5c06\u65f6\u95f4\u6548\u7387\u4ece \\(O(n)\\) \u4f18\u5316\u81f3 \\(O(\\log n)\\) \uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e2d\u5e8f\u904d\u5386\u83b7\u53d6\u6709\u5e8f\u5e8f\u5217\uff1b\u8fd8\u53ef\u4ee5\u5c06\u94fe\u8868\u8f6c\u5316\u4e3a\u54c8\u5e0c\u8868\uff0c\u5c06\u65f6\u95f4\u590d\u6742\u5ea6\u964d\u4f4e\u81f3 \\(O(1)\\) \u3002

"},{"location":"chapter_graph/graph/#914","title":"9.1.4. \u00a0 \u56fe\u5e38\u89c1\u5e94\u7528","text":"

\u73b0\u5b9e\u4e2d\u7684\u8bb8\u591a\u7cfb\u7edf\u90fd\u53ef\u4ee5\u4f7f\u7528\u56fe\u6765\u5efa\u6a21\uff0c\u5bf9\u5e94\u7684\u5f85\u6c42\u89e3\u95ee\u9898\u4e5f\u53ef\u4ee5\u88ab\u7ea6\u5316\u4e3a\u56fe\u8ba1\u7b97\u95ee\u9898\u3002

\u9876\u70b9 \u8fb9 \u56fe\u8ba1\u7b97\u95ee\u9898 \u793e\u4ea4\u7f51\u7edc \u7528\u6237 \u597d\u53cb\u5173\u7cfb \u6f5c\u5728\u597d\u53cb\u63a8\u8350 \u5730\u94c1\u7ebf\u8def \u7ad9\u70b9 \u7ad9\u70b9\u95f4\u7684\u8fde\u901a\u6027 \u6700\u77ed\u8def\u7ebf\u63a8\u8350 \u592a\u9633\u7cfb \u661f\u4f53 \u661f\u4f53\u95f4\u7684\u4e07\u6709\u5f15\u529b\u4f5c\u7528 \u884c\u661f\u8f68\u9053\u8ba1\u7b97"},{"location":"chapter_graph/graph_operations/","title":"9.2. \u00a0 \u56fe\u57fa\u7840\u64cd\u4f5c","text":"

\u56fe\u7684\u57fa\u7840\u64cd\u4f5c\u5206\u4e3a\u5bf9\u300c\u8fb9\u300d\u7684\u64cd\u4f5c\u548c\u5bf9\u300c\u9876\u70b9\u300d\u7684\u64cd\u4f5c\uff0c\u5728\u300c\u90bb\u63a5\u77e9\u9635\u300d\u548c\u300c\u90bb\u63a5\u8868\u300d\u8fd9\u4e24\u79cd\u8868\u793a\u4e0b\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u540c\u3002

"},{"location":"chapter_graph/graph_operations/#921","title":"9.2.1. \u00a0 \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u7684\u5b9e\u73b0","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u6709\uff1a

  • \u6dfb\u52a0\u6216\u5220\u9664\u8fb9\uff1a\u76f4\u63a5\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u4fee\u6539\u6307\u5b9a\u8fb9\u7684\u5bf9\u5e94\u5143\u7d20\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002\u800c\u7531\u4e8e\u662f\u65e0\u5411\u56fe\uff0c\u56e0\u6b64\u9700\u8981\u540c\u65f6\u66f4\u65b0\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u6dfb\u52a0\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u77e9\u9635\u7684\u5c3e\u90e8\u6dfb\u52a0\u4e00\u884c\u4e00\u5217\uff0c\u5e76\u5168\u90e8\u586b \\(0\\) \u5373\u53ef\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\u3002
  • \u5220\u9664\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u4e00\u884c\u4e00\u5217\u3002\u5f53\u5220\u9664\u9996\u884c\u9996\u5217\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u9700\u8981\u5c06 \\((n-1)^2\\) \u4e2a\u5143\u7d20\u201c\u5411\u5de6\u4e0a\u79fb\u52a8\u201d\uff0c\u4ece\u800c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002
  • \u521d\u59cb\u5316\uff1a\u4f20\u5165 \\(n\\) \u4e2a\u9876\u70b9\uff0c\u521d\u59cb\u5316\u957f\u5ea6\u4e3a \\(n\\) \u7684\u9876\u70b9\u5217\u8868 vertices \uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b\u521d\u59cb\u5316 \\(n \\times n\\) \u5927\u5c0f\u7684\u90bb\u63a5\u77e9\u9635 adjMat \uff0c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002
\u521d\u59cb\u5316\u90bb\u63a5\u77e9\u9635\u6dfb\u52a0\u8fb9\u5220\u9664\u8fb9\u6dfb\u52a0\u9876\u70b9\u5220\u9664\u9876\u70b9

\u4ee5\u4e0b\u662f\u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u8868\u793a\u56fe\u7684\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_adjacency_matrix.java
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nList<Integer> vertices;     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nList<List<Integer>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u65b9\u6cd5 */\npublic GraphAdjMat(int[] vertices, int[][] edges) {\nthis.vertices = new ArrayList<>();\nthis.adjMat = new ArrayList<>();\n// \u6dfb\u52a0\u9876\u70b9\nfor (int val : vertices) {\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (int[] e : edges) {\naddEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size() {\nreturn vertices.size();\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(int val) {\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.add(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nList<Integer> newRow = new ArrayList<>(n);\nfor (int j = 0; j < n; j++) {\nnewRow.add(0);\n}\nadjMat.add(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (List<Integer> row : adjMat) {\nrow.add(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(int index) {\nif (index >= size())\nthrow new IndexOutOfBoundsException();\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.remove(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.remove(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (List<Integer> row : adjMat) {\nrow.remove(index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void addEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfBoundsException();\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat.get(i).set(j, 1);\nadjMat.get(j).set(i, 1);\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void removeEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfBoundsException();\nadjMat.get(i).set(j, 0);\nadjMat.get(j).set(i, 0);\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\npublic void print() {\nSystem.out.print(\"\u9876\u70b9\u5217\u8868 = \");\nSystem.out.println(vertices);\nSystem.out.println(\"\u90bb\u63a5\u77e9\u9635 =\");\nPrintUtil.printMatrix(adjMat);\n}\n}\n
graph_adjacency_matrix.cpp
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvector<int> vertices;       // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvector<vector<int>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nGraphAdjMat(const vector<int>& vertices, const vector<vector<int>>& edges) {\n// \u6dfb\u52a0\u9876\u70b9\nfor (int val : vertices) {\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const vector<int>& edge : edges) {\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nint size() const {\nreturn vertices.size();\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nvoid addVertex(int val) {\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.push_back(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nadjMat.emplace_back(n, 0);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (vector<int>& row : adjMat) {\nrow.push_back(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nvoid removeVertex(int index) {\nif (index >= size()) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.erase(vertices.begin() + index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.erase(adjMat.begin() + index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (vector<int>& row : adjMat) {\nrow.erase(row.begin() + index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nvoid addEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1;\nadjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nvoid removeEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\nadjMat[i][j] = 0;\nadjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nvoid print() {\ncout << \"\u9876\u70b9\u5217\u8868 = \";\nPrintUtil::printVector(vertices);\ncout << \"\u90bb\u63a5\u77e9\u9635 =\" << endl;\nPrintUtil::printVectorMatrix(adjMat);\n}\n};\n
graph_adjacency_matrix.py
class GraphAdjMat:\n\"\"\" \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b \"\"\"\n# \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvertices: List[int] = []\n# \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadj_mat: List[List[int]] = []\ndef __init__(self, vertices: List[int], edges: List[List[int]]) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.vertices: List[int] = []\nself.adj_mat: List[List[int]] = []\n# \u6dfb\u52a0\u9876\u70b9\nfor val in vertices:\nself.add_vertex(val)\n# \u6dfb\u52a0\u8fb9\n# \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor e in edges:\nself.add_edge(e[0], e[1])\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u9876\u70b9\u6570\u91cf \"\"\"\nreturn len(self.vertices)\ndef add_vertex(self, val: int) -> None:\n\"\"\" \u6dfb\u52a0\u9876\u70b9 \"\"\"\nn = self.size()\n# \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nself.vertices.append(val)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nnew_row = [0] * n\nself.adj_mat.append(new_row)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor row in self.adj_mat:\nrow.append(0)\ndef remove_vertex(self, index: int) -> None:\n\"\"\" \u5220\u9664\u9876\u70b9 \"\"\"\nif index >= self.size():\nraise IndexError()\n# \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nself.vertices.pop(index)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nself.adj_mat.pop(index)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor row in self.adj_mat:\nrow.pop(index)\ndef add_edge(self, i: int, j: int) -> None:\n\"\"\" \u6dfb\u52a0\u8fb9 \"\"\"\n# \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\n# \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 or j < 0 or i >= self.size() or j >= self.size() or i == j:\nraise IndexError()\n# \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nself.adj_mat[i][j] = 1\nself.adj_mat[j][i] = 1\ndef remove_edge(self, i: int, j: int) -> None:\n\"\"\" \u5220\u9664\u8fb9 \"\"\"\n# \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\n# \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 or j < 0 or i >= self.size() or j >= self.size() or i == j:\nraise IndexError()\nself.adj_mat[i][j] = 0\nself.adj_mat[j][i] = 0\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u90bb\u63a5\u77e9\u9635 \"\"\"\nprint(\"\u9876\u70b9\u5217\u8868 =\", self.vertices)\nprint(\"\u90bb\u63a5\u77e9\u9635 =\")\nprint_matrix(self.adj_mat)\n
graph_adjacency_matrix.go
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\ntype graphAdjMat struct {\n// \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvertices []int\n// \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat [][]int\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newGraphAdjMat(vertices []int, edges [][]int) *graphAdjMat {\n// \u6dfb\u52a0\u9876\u70b9\nn := len(vertices)\nadjMat := make([][]int, n)\nfor i := range adjMat {\nadjMat[i] = make([]int, n)\n}\n// \u521d\u59cb\u5316\u56fe\ng := &graphAdjMat{\nvertices: vertices,\nadjMat:   adjMat,\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor i := range edges {\ng.addEdge(edges[i][0], edges[i][1])\n}\nreturn g\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc (g *graphAdjMat) size() int {\nreturn len(g.vertices)\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc (g *graphAdjMat) addVertex(val int) {\nn := g.size()\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\ng.vertices = append(g.vertices, val)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nnewRow := make([]int, n)\ng.adjMat = append(g.adjMat, newRow)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor i := range g.adjMat {\ng.adjMat[i] = append(g.adjMat[i], 0)\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc (g *graphAdjMat) removeVertex(index int) {\nif index >= g.size() {\nreturn\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\ng.vertices = append(g.vertices[:index], g.vertices[index+1:]...)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\ng.adjMat = append(g.adjMat[:index], g.adjMat[index+1:]...)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor i := range g.adjMat {\ng.adjMat[i] = append(g.adjMat[i][:index], g.adjMat[i][index+1:]...)\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc (g *graphAdjMat) addEdge(i, j int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= g.size() || j >= g.size() || i == j {\nfmt.Errorf(\"%s\", \"Index Out Of Bounds Exception\")\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\ng.adjMat[i][j] = 1\ng.adjMat[j][i] = 1\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc (g *graphAdjMat) removeEdge(i, j int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= g.size() || j >= g.size() || i == j {\nfmt.Errorf(\"%s\", \"Index Out Of Bounds Exception\")\n}\ng.adjMat[i][j] = 0\ng.adjMat[j][i] = 0\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nfunc (g *graphAdjMat) print() {\nfmt.Printf(\"\\t\u9876\u70b9\u5217\u8868 = %v\\n\", g.vertices)\nfmt.Printf(\"\\t\u90bb\u63a5\u77e9\u9635 = \\n\")\nfor i := range g.adjMat {\nfmt.Printf(\"\\t\\t\\t%v\\n\", g.adjMat[i])\n}\n}\n
graph_adjacency_matrix.js
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvertices;   // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat;     // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\nconstructor(vertices, edges) {\nthis.vertices = [];\nthis.adjMat = [];\n// \u6dfb\u52a0\u9876\u70b9\nfor (const val of vertices) {\nthis.addVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const e of edges) {\nthis.addEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize() {\nreturn this.vertices.length;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(val) {\nconst n = this.size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nthis.vertices.push(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nconst newRow = [];\nfor (let j = 0; j < n; j++) {\nnewRow.push(0);\n}\nthis.adjMat.push(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (const row of this.adjMat) {\nrow.push(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(index) {\nif (index >= this.size()) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nthis.vertices.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nthis.adjMat.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (const row of this.adjMat) {\nrow.splice(index, 1);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\naddEdge(i, j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nthis.adjMat[i][j] = 1;\nthis.adjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nremoveEdge(i, j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\nthis.adjMat[i][j] = 0;\nthis.adjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nprint() {\nconsole.log(\"\u9876\u70b9\u5217\u8868 = \", this.vertices);\nconsole.log(\"\u90bb\u63a5\u77e9\u9635 =\", this.adjMat);\n}\n}\n
graph_adjacency_matrix.ts
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvertices: number[];     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat: number[][];     // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\nconstructor(vertices: number[], edges: number[][]) {\nthis.vertices = [];\nthis.adjMat = [];\n// \u6dfb\u52a0\u9876\u70b9\nfor (const val of vertices) {\nthis.addVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const e of edges) {\nthis.addEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize(): number {\nreturn this.vertices.length;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(val: number): void {\nconst n: number = this.size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nthis.vertices.push(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nconst newRow: number[] = [];\nfor (let j: number = 0; j < n; j++) {\nnewRow.push(0);\n}\nthis.adjMat.push(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (const row of this.adjMat) {\nrow.push(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(index: number): void {\nif (index >= this.size()) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nthis.vertices.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nthis.adjMat.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (const row of this.adjMat) {\nrow.splice(index, 1);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\naddEdge(i: number, j: number): void {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nthis.adjMat[i][j] = 1;\nthis.adjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nremoveEdge(i: number, j: number): void {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\nthis.adjMat[i][j] = 0;\nthis.adjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nprint(): void {\nconsole.log(\"\u9876\u70b9\u5217\u8868 = \", this.vertices);\nconsole.log(\"\u90bb\u63a5\u77e9\u9635 =\", this.adjMat);\n}\n}\n
graph_adjacency_matrix.c
[class]{graphAdjMat}-[func]{}\n
graph_adjacency_matrix.cs
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat\n{\nList<int> vertices;     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nList<List<int>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\npublic GraphAdjMat(int[] vertices, int[][] edges)\n{\nthis.vertices = new List<int>();\nthis.adjMat = new List<List<int>>();\n// \u6dfb\u52a0\u9876\u70b9\nforeach (int val in vertices)\n{\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nforeach (int[] e in edges)\n{\naddEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size()\n{\nreturn vertices.Count;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(int val)\n{\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.Add(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nList<int> newRow = new List<int>(n);\nfor (int j = 0; j < n; j++)\n{\nnewRow.Add(0);\n}\nadjMat.Add(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nforeach (List<int> row in adjMat)\n{\nrow.Add(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(int index)\n{\nif (index >= size())\nthrow new IndexOutOfRangeException();\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.RemoveAt(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.RemoveAt(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nforeach (List<int> row in adjMat)\n{\nrow.RemoveAt(index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void addEdge(int i, int j)\n{\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfRangeException();\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1;\nadjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void removeEdge(int i, int j)\n{\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfRangeException();\nadjMat[i][j] = 0;\nadjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\npublic void print()\n{\nConsole.Write(\"\u9876\u70b9\u5217\u8868 = \");\nPrintUtil.PrintList(vertices);\nConsole.WriteLine(\"\u90bb\u63a5\u77e9\u9635 =\");\nPrintUtil.printMatrix(adjMat);\n}\n}\n
graph_adjacency_matrix.swift
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nprivate var vertices: [Int] // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nprivate var adjMat: [[Int]] // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u65b9\u6cd5 */\ninit(vertices: [Int], edges: [[Int]]) {\nself.vertices = []\nadjMat = []\n// \u6dfb\u52a0\u9876\u70b9\nfor val in vertices {\naddVertex(val: val)\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor e in edges {\naddEdge(i: e[0], j: e[1])\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc size() -> Int {\nvertices.count\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc addVertex(val: Int) {\nlet n = size()\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.append(val)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nlet newRow = Array(repeating: 0, count: n)\nadjMat.append(newRow)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor i in adjMat.indices {\nadjMat[i].append(0)\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc removeVertex(index: Int) {\nif index >= size() {\nfatalError(\"\u8d8a\u754c\")\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.remove(at: index)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.remove(at: index)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor i in adjMat.indices {\nadjMat[i].remove(at: index)\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc addEdge(i: Int, j: Int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= size() || j >= size() || i == j {\nfatalError(\"\u8d8a\u754c\")\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1\nadjMat[j][i] = 1\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc removeEdge(i: Int, j: Int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= size() || j >= size() || i == j {\nfatalError(\"\u8d8a\u754c\")\n}\nadjMat[i][j] = 0\nadjMat[j][i] = 0\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nfunc print() {\nSwift.print(\"\u9876\u70b9\u5217\u8868 = \", terminator: \"\")\nSwift.print(vertices)\nSwift.print(\"\u90bb\u63a5\u77e9\u9635 =\")\nPrintUtil.printMatrix(matrix: adjMat)\n}\n}\n
graph_adjacency_matrix.zig
\n
"},{"location":"chapter_graph/graph_operations/#922","title":"9.2.2. \u00a0 \u57fa\u4e8e\u90bb\u63a5\u8868\u7684\u5b9e\u73b0","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u603b\u6570\u4e3a \\(n\\) \u3001\u8fb9\u603b\u6570\u4e3a \\(m\\) \uff0c\u5219\u6709\uff1a

  • \u6dfb\u52a0\u8fb9\uff1a\u5728\u9876\u70b9\u5bf9\u5e94\u94fe\u8868\u7684\u5c3e\u90e8\u6dfb\u52a0\u8fb9\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002\u56e0\u4e3a\u662f\u65e0\u5411\u56fe\uff0c\u6240\u4ee5\u9700\u8981\u540c\u65f6\u6dfb\u52a0\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u5220\u9664\u8fb9\uff1a\u5728\u9876\u70b9\u5bf9\u5e94\u94fe\u8868\u4e2d\u67e5\u8be2\u4e0e\u5220\u9664\u6307\u5b9a\u8fb9\uff0c\u4f7f\u7528 \\(O(m)\\) \u65f6\u95f4\u3002\u4e0e\u6dfb\u52a0\u8fb9\u4e00\u6837\uff0c\u9700\u8981\u540c\u65f6\u5220\u9664\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u6dfb\u52a0\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u94fe\u8868\u5373\u53ef\uff0c\u5e76\u4ee5\u65b0\u589e\u9876\u70b9\u4e3a\u94fe\u8868\u5934\u7ed3\u70b9\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002
  • \u5220\u9664\u9876\u70b9\uff1a\u9700\u8981\u904d\u5386\u6574\u4e2a\u90bb\u63a5\u8868\uff0c\u5220\u9664\u5305\u542b\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u8fb9\uff0c\u4f7f\u7528 \\(O(n + m)\\) \u65f6\u95f4\u3002
  • \u521d\u59cb\u5316\uff1a\u9700\u8981\u5728\u90bb\u63a5\u8868\u4e2d\u5efa\u7acb \\(n\\) \u4e2a\u7ed3\u70b9\u548c \\(2m\\) \u6761\u8fb9\uff0c\u4f7f\u7528 \\(O(n + m)\\) \u65f6\u95f4\u3002
\u521d\u59cb\u5316\u90bb\u63a5\u8868\u6dfb\u52a0\u8fb9\u5220\u9664\u8fb9\u6dfb\u52a0\u9876\u70b9\u5220\u9664\u9876\u70b9

\u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u56fe\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u6ce8\u610f\u5230\uff0c\u6211\u4eec\u5728\u90bb\u63a5\u8868\u4e2d\u4f7f\u7528 Vertex \u7ed3\u70b9\u7c7b\u6765\u8868\u793a\u9876\u70b9\uff0c\u8fd9\u6837\u505a\u7684\u539f\u56e0\u662f\uff1a

  • \u5982\u679c\u6211\u4eec\u9009\u62e9\u901a\u8fc7\u9876\u70b9\u503c\u6765\u533a\u5206\u4e0d\u540c\u9876\u70b9\uff0c\u90a3\u4e48\u503c\u91cd\u590d\u7684\u9876\u70b9\u5c06\u65e0\u6cd5\u88ab\u533a\u5206\u3002
  • \u5982\u679c\u7c7b\u4f3c\u90bb\u63a5\u77e9\u9635\u90a3\u6837\uff0c\u4f7f\u7528\u9876\u70b9\u5217\u8868\u7d22\u5f15\u6765\u533a\u5206\u4e0d\u540c\u9876\u70b9\u3002\u90a3\u4e48\uff0c\u5047\u8bbe\u6211\u4eec\u60f3\u8981\u5220\u9664\u7d22\u5f15\u4e3a \\(i\\) \u7684\u9876\u70b9\uff0c\u5219\u9700\u8981\u904d\u5386\u6574\u4e2a\u90bb\u63a5\u8868\uff0c\u5c06\u5176\u4e2d \\(> i\\) \u7684\u7d22\u5f15\u5168\u90e8\u6267\u884c \\(-1\\) \uff0c\u8fd9\u6837\u64cd\u4f5c\u6548\u7387\u592a\u4f4e\u3002
  • \u56e0\u6b64\u6211\u4eec\u8003\u8651\u5f15\u5165\u9876\u70b9\u7c7b Vertex \uff0c\u4f7f\u5f97\u6bcf\u4e2a\u9876\u70b9\u90fd\u662f\u552f\u4e00\u7684\u5bf9\u8c61\uff0c\u6b64\u65f6\u5220\u9664\u9876\u70b9\u65f6\u5c31\u65e0\u9700\u6539\u52a8\u5176\u4f59\u9876\u70b9\u4e86\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_adjacency_list.java
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nMap<Vertex, List<Vertex>> adjList;\n/* \u6784\u9020\u65b9\u6cd5 */\npublic GraphAdjList(Vertex[][] edges) {\nthis.adjList = new HashMap<>();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (Vertex[] edge : edges) {\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size() {\nreturn adjList.size();\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic void addEdge(Vertex vet1, Vertex vet2) {\nif (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)\nthrow new IllegalArgumentException();\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList.get(vet1).add(vet2);\nadjList.get(vet2).add(vet1);\n}\n/* \u5220\u9664\u8fb9 */\npublic void removeEdge(Vertex vet1, Vertex vet2) {\nif (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)\nthrow new IllegalArgumentException();\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList.get(vet1).remove(vet2);\nadjList.get(vet2).remove(vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(Vertex vet) {\nif (adjList.containsKey(vet))\nreturn;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList.put(vet, new ArrayList<>());\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(Vertex vet) {\nif (!adjList.containsKey(vet))\nthrow new IllegalArgumentException();\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.remove(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (List<Vertex> list : adjList.values()) {\nlist.remove(vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic void print() {\nSystem.out.println(\"\u90bb\u63a5\u8868 =\");\nfor (Map.Entry<Vertex, List<Vertex>> entry : adjList.entrySet()) {\nList<Integer> tmp = new ArrayList<>();\nfor (Vertex vertex : entry.getValue())\ntmp.add(vertex.val);\nSystem.out.println(entry.getKey().val + \": \" + tmp + \",\");\n}\n}\n}\n
graph_adjacency_list.cpp
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\npublic:\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nunordered_map<Vertex*, vector<Vertex*>> adjList;\n/* \u5728 vector \u4e2d\u5220\u9664\u6307\u5b9a\u7ed3\u70b9 */\nvoid remove(vector<Vertex*> &vec, Vertex *vet) {\nfor (int i = 0; i < vec.size(); i++) {\nif (vec[i] == vet) {\nvec.erase(vec.begin() + i);\nbreak;\n}\n}\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nGraphAdjList(const vector<vector<Vertex*>>& edges) {\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const vector<Vertex*>& edge : edges) {\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nint size() { return adjList.size(); }\n/* \u6dfb\u52a0\u8fb9 */\nvoid addEdge(Vertex* vet1, Vertex* vet2) {\nif (!adjList.count(vet1) || !adjList.count(vet2) || vet1 == vet2)\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1].push_back(vet2);\nadjList[vet2].push_back(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nvoid removeEdge(Vertex* vet1, Vertex* vet2) {\nif (!adjList.count(vet1) || !adjList.count(vet2) || vet1 == vet2)\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u5220\u9664\u8fb9 vet1 - vet2\nremove(adjList[vet1], vet2);\nremove(adjList[vet2], vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nvoid addVertex(Vertex* vet) {\nif (adjList.count(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList[vet] = vector<Vertex*>();\n}\n/* \u5220\u9664\u9876\u70b9 */\nvoid removeVertex(Vertex* vet) {\nif (!adjList.count(vet))\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.erase(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (auto& [key, vec] : adjList) {\nremove(vec, vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nvoid print() {\ncout << \"\u90bb\u63a5\u8868 =\" << endl;\nfor (auto& [key, vec] : adjList) {\ncout << key->val << \": \";\nPrintUtil::printVector(vetsToVals(vec));\n}\n}\n};\n
graph_adjacency_list.py
class GraphAdjList:\n\"\"\" \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b \"\"\"\ndef __init__(self, edges: List[List[Vertex]]) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nself.adj_list: Dict = {}\n# \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor edge in edges:\nself.add_vertex(edge[0])\nself.add_vertex(edge[1])\nself.add_edge(edge[0], edge[1])\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u9876\u70b9\u6570\u91cf \"\"\"\nreturn len(self.adj_list)\ndef add_edge(self, vet1: Vertex, vet2: Vertex) -> None:\n\"\"\" \u6dfb\u52a0\u8fb9 \"\"\"\nif vet1 not in self.adj_list or vet2 not in self.adj_list or vet1 == vet2:\nraise ValueError\n# \u6dfb\u52a0\u8fb9 vet1 - vet2\nself.adj_list[vet1].append(vet2)\nself.adj_list[vet2].append(vet1)\ndef remove_edge(self, vet1: Vertex, vet2: Vertex) -> None:\n\"\"\" \u5220\u9664\u8fb9 \"\"\"\nif vet1 not in self.adj_list or vet2 not in self.adj_list or vet1 == vet2:\nraise ValueError\n# \u5220\u9664\u8fb9 vet1 - vet2\nself.adj_list[vet1].remove(vet2)\nself.adj_list[vet2].remove(vet1)\ndef add_vertex(self, vet: Vertex) -> None:\n\"\"\" \u6dfb\u52a0\u9876\u70b9 \"\"\"\nif vet in self.adj_list:\nreturn\n# \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nself.adj_list[vet] = []\ndef remove_vertex(self, vet: Vertex) -> None:\n\"\"\" \u5220\u9664\u9876\u70b9 \"\"\"\nif vet not in self.adj_list:\nraise ValueError\n# \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nself.adj_list.pop(vet)\n# \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor vertex in self.adj_list:\nif vet in self.adj_list[vertex]:\nself.adj_list[vertex].remove(vet)\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u90bb\u63a5\u8868 \"\"\"\nprint(\"\u90bb\u63a5\u8868 =\")\nfor vertex in self.adj_list:\ntmp = [v.val for v in self.adj_list[vertex]]\nprint(f\"{vertex.val}: {tmp},\")\n
graph_adjacency_list.go
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\ntype graphAdjList struct {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList map[Vertex][]Vertex\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newGraphAdjList(edges [][]Vertex) *graphAdjList {\ng := &graphAdjList{\nadjList: make(map[Vertex][]Vertex),\n}\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor _, edge := range edges {\ng.addVertex(edge[0])\ng.addVertex(edge[1])\ng.addEdge(edge[0], edge[1])\n}\nreturn g\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc (g *graphAdjList) size() int {\nreturn len(g.adjList)\n}\n/* \u6dfb\u52a0\u8fb9 */\nfunc (g *graphAdjList) addEdge(vet1 Vertex, vet2 Vertex) {\n_, ok1 := g.adjList[vet1]\n_, ok2 := g.adjList[vet2]\nif !ok1 || !ok2 || vet1 == vet2 {\npanic(\"error\")\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2, \u6dfb\u52a0\u533f\u540d struct{},\ng.adjList[vet1] = append(g.adjList[vet1], vet2)\ng.adjList[vet2] = append(g.adjList[vet2], vet1)\n}\n/* \u5220\u9664\u8fb9 */\nfunc (g *graphAdjList) removeEdge(vet1 Vertex, vet2 Vertex) {\n_, ok1 := g.adjList[vet1]\n_, ok2 := g.adjList[vet2]\nif !ok1 || !ok2 || vet1 == vet2 {\npanic(\"error\")\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nDeleteSliceElms(g.adjList[vet1], vet2)\nDeleteSliceElms(g.adjList[vet2], vet1)\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc (g *graphAdjList) addVertex(vet Vertex) {\n_, ok := g.adjList[vet]\nif ok {\nreturn\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\ng.adjList[vet] = make([]Vertex, 0)\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc (g *graphAdjList) removeVertex(vet Vertex) {\n_, ok := g.adjList[vet]\nif !ok {\npanic(\"error\")\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\ndelete(g.adjList, vet)\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor _, list := range g.adjList {\nDeleteSliceElms(list, vet)\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nfunc (g *graphAdjList) print() {\nvar builder strings.Builder\nfmt.Printf(\"\u90bb\u63a5\u8868 = \\n\")\nfor k, v := range g.adjList {\nbuilder.WriteString(\"\\t\\t\" + strconv.Itoa(k.Val) + \": \")\nfor _, vet := range v {\nbuilder.WriteString(strconv.Itoa(vet.Val) + \" \")\n}\nfmt.Println(builder.String())\nbuilder.Reset()\n}\n}\n
graph_adjacency_list.js
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList;\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(edges) {\nthis.adjList = new Map();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const edge of edges) {\nthis.addVertex(edge[0]);\nthis.addVertex(edge[1]);\nthis.addEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize() {\nreturn this.adjList.size;\n}\n/* \u6dfb\u52a0\u8fb9 */\naddEdge(vet1, vet2) {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).push(vet2);\nthis.adjList.get(vet2).push(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nremoveEdge(vet1, vet2) {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).splice(this.adjList.get(vet1).indexOf(vet2), 1);\nthis.adjList.get(vet2).splice(this.adjList.get(vet2).indexOf(vet1), 1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(vet) {\nif (this.adjList.has(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nthis.adjList.set(vet, []);\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(vet) {\nif (!this.adjList.has(vet)) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nthis.adjList.delete(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (let set of this.adjList.values()) {\nconst index = set.indexOf(vet);\nif (index > -1) {\nset.splice(index, 1);\n}\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nprint() {\nconsole.log(\"\u90bb\u63a5\u8868 =\");\nfor (const [key, value] of this.adjList) {\nconst tmp = [];\nfor (const vertex of value) {\ntmp.push(vertex.val);\n}\nconsole.log(key.val + \": \" + tmp.join());\n}\n}\n}\n
graph_adjacency_list.ts
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList: Map<Vertex, Vertex[]>;\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(edges: Vertex[][]) {\nthis.adjList = new Map();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const edge of edges) {\nthis.addVertex(edge[0]);\nthis.addVertex(edge[1]);\nthis.addEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize(): number {\nreturn this.adjList.size;\n}\n/* \u6dfb\u52a0\u8fb9 */\naddEdge(vet1: Vertex, vet2: Vertex): void {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).push(vet2);\nthis.adjList.get(vet2).push(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nremoveEdge(vet1: Vertex, vet2: Vertex): void {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).splice(this.adjList.get(vet1).indexOf(vet2), 1);\nthis.adjList.get(vet2).splice(this.adjList.get(vet2).indexOf(vet1), 1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(vet: Vertex): void {\nif (this.adjList.has(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nthis.adjList.set(vet, []);\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(vet: Vertex): void {\nif (!this.adjList.has(vet)) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nthis.adjList.delete(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (let set of this.adjList.values()) {\nconst index: number = set.indexOf(vet);\nif (index > -1) {\nset.splice(index, 1);\n}\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nprint(): void {\nconsole.log('\u90bb\u63a5\u8868 =');\nfor (const [key, value] of this.adjList.entries()) {\nconst tmp = [];\nfor (const vertex of value) {\ntmp.push(vertex.val);\n}\nconsole.log(key.val + ': ' + tmp.join());\n}\n}\n}\n
graph_adjacency_list.c
[class]{graphAdjList}-[func]{}\n
graph_adjacency_list.cs
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList\n{\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\npublic Dictionary<Vertex, List<Vertex>> adjList;\n/* \u6784\u9020\u51fd\u6570 */\npublic GraphAdjList(Vertex[][] edges)\n{\nthis.adjList = new Dictionary<Vertex, List<Vertex>>();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nforeach (Vertex[] edge in edges)\n{\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size()\n{\nreturn adjList.Count;\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic void addEdge(Vertex vet1, Vertex vet2)\n{\nif (!adjList.ContainsKey(vet1) || !adjList.ContainsKey(vet2) || vet1 == vet2)\nthrow new InvalidOperationException();\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1].Add(vet2);\nadjList[vet2].Add(vet1);\n}\n/* \u5220\u9664\u8fb9 */\npublic void removeEdge(Vertex vet1, Vertex vet2)\n{\nif (!adjList.ContainsKey(vet1) || !adjList.ContainsKey(vet2) || vet1 == vet2)\nthrow new InvalidOperationException();\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList[vet1].Remove(vet2);\nadjList[vet2].Remove(vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(Vertex vet)\n{\nif (adjList.ContainsKey(vet))\nreturn;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList.Add(vet, new List<Vertex>());\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(Vertex vet)\n{\nif (!adjList.ContainsKey(vet))\nthrow new InvalidOperationException();\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.Remove(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nforeach (List<Vertex> list in adjList.Values)\n{\nlist.Remove(vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic void print()\n{\nConsole.WriteLine(\"\u90bb\u63a5\u8868 =\");\nforeach (KeyValuePair<Vertex, List<Vertex>> entry in adjList)\n{\nList<int> tmp = new List<int>();\nforeach (Vertex vertex in entry.Value)\ntmp.Add(vertex.Val);\nConsole.WriteLine(entry.Key.Val + \": [\" + string.Join(\", \", tmp) + \"],\");\n}\n}\n}\n
graph_adjacency_list.swift
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\npublic private(set) var adjList: [Vertex: [Vertex]]\n/* \u6784\u9020\u65b9\u6cd5 */\npublic init(edges: [[Vertex]]) {\nadjList = [:]\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor edge in edges {\naddVertex(vet: edge[0])\naddVertex(vet: edge[1])\naddEdge(vet1: edge[0], vet2: edge[1])\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic func size() -> Int {\nadjList.count\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic func addEdge(vet1: Vertex, vet2: Vertex) {\nif adjList[vet1] == nil || adjList[vet2] == nil || vet1 == vet2 {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1]?.append(vet2)\nadjList[vet2]?.append(vet1)\n}\n/* \u5220\u9664\u8fb9 */\npublic func removeEdge(vet1: Vertex, vet2: Vertex) {\nif adjList[vet1] == nil || adjList[vet2] == nil || vet1 == vet2 {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList[vet1]?.removeAll(where: { $0 == vet2 })\nadjList[vet2]?.removeAll(where: { $0 == vet1 })\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic func addVertex(vet: Vertex) {\nif adjList[vet] != nil {\nreturn\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList[vet] = []\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic func removeVertex(vet: Vertex) {\nif adjList[vet] == nil {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.removeValue(forKey: vet)\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor key in adjList.keys {\nadjList[key]?.removeAll(where: { $0 == vet })\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic func print() {\nSwift.print(\"\u90bb\u63a5\u8868 =\")\nfor entry in adjList {\nvar tmp: [Int] = []\nfor vertex in entry.value {\ntmp.append(vertex.val)\n}\nSwift.print(\"\\(entry.key.val): \\(tmp),\")\n}\n}\n}\n
graph_adjacency_list.zig
[class]{GraphAdjList}-[func]{}\n
"},{"location":"chapter_graph/graph_operations/#923","title":"9.2.3. \u00a0 \u6548\u7387\u5bf9\u6bd4","text":"

\u8bbe\u56fe\u4e2d\u5171\u6709 \\(n\\) \u4e2a\u9876\u70b9\u548c \\(m\\) \u6761\u8fb9\uff0c\u4e0b\u8868\u4e3a\u90bb\u63a5\u77e9\u9635\u548c\u90bb\u63a5\u8868\u7684\u65f6\u95f4\u548c\u7a7a\u95f4\u6548\u7387\u5bf9\u6bd4\u3002

\u90bb\u63a5\u77e9\u9635 \u90bb\u63a5\u8868\uff08\u94fe\u8868\uff09 \u90bb\u63a5\u8868\uff08\u54c8\u5e0c\u8868\uff09 \u5224\u65ad\u662f\u5426\u90bb\u63a5 \\(O(1)\\) \\(O(m)\\) \\(O(1)\\) \u6dfb\u52a0\u8fb9 \\(O(1)\\) \\(O(1)\\) \\(O(1)\\) \u5220\u9664\u8fb9 \\(O(1)\\) \\(O(m)\\) \\(O(1)\\) \u6dfb\u52a0\u9876\u70b9 \\(O(n)\\) \\(O(1)\\) \\(O(1)\\) \u5220\u9664\u9876\u70b9 \\(O(n^2)\\) \\(O(n + m)\\) \\(O(n)\\) \u5185\u5b58\u7a7a\u95f4\u5360\u7528 \\(O(n^2)\\) \\(O(n + m)\\) \\(O(n + m)\\)

\u89c2\u5bdf\u4e0a\u8868\uff0c\u8c8c\u4f3c\u90bb\u63a5\u8868\uff08\u54c8\u5e0c\u8868\uff09\u7684\u65f6\u95f4\u4e0e\u7a7a\u95f4\u6548\u7387\u6700\u4f18\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u64cd\u4f5c\u8fb9\u7684\u6548\u7387\u66f4\u9ad8\uff0c\u53ea\u9700\u8981\u4e00\u6b21\u6570\u7ec4\u8bbf\u95ee\u6216\u8d4b\u503c\u64cd\u4f5c\u5373\u53ef\u3002\u603b\u7ed3\u4ee5\u4e0a\uff0c\u90bb\u63a5\u77e9\u9635\u4f53\u73b0\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\uff0c\u90bb\u63a5\u8868\u4f53\u73b0\u201c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u201d\u3002

"},{"location":"chapter_graph/graph_traversal/","title":"9.3. \u00a0 \u56fe\u7684\u904d\u5386","text":"

\u56fe\u4e0e\u6811\u7684\u5173\u7cfb

\u6811\u4ee3\u8868\u7684\u662f\u201c\u4e00\u5bf9\u591a\u201d\u7684\u5173\u7cfb\uff0c\u800c\u56fe\u5219\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u53ef\u4ee5\u4ee3\u8868\u4efb\u610f\u201c\u591a\u5bf9\u591a\u201d\u5173\u7cfb\u3002\u672c\u8d28\u4e0a\uff0c\u53ef\u4ee5\u628a\u6811\u770b\u4f5c\u662f\u56fe\u7684\u4e00\u7c7b\u7279\u4f8b\u3002\u90a3\u4e48\u663e\u7136\uff0c\u6811\u904d\u5386\u64cd\u4f5c\u4e5f\u662f\u56fe\u904d\u5386\u64cd\u4f5c\u7684\u4e00\u4e2a\u7279\u4f8b\uff0c\u4e24\u8005\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u7c7b\u4f3c\u7684\uff0c\u5efa\u8bae\u4f60\u5728\u5b66\u4e60\u672c\u7ae0\u8282\u7684\u8fc7\u7a0b\u4e2d\u5c06\u4e24\u8005\u878d\u4f1a\u8d2f\u901a\u3002

\u300c\u56fe\u300d\u4e0e\u300c\u6811\u300d\u90fd\u662f\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u90fd\u9700\u8981\u4f7f\u7528\u300c\u641c\u7d22\u7b97\u6cd5\u300d\u6765\u5b9e\u73b0\u904d\u5386\u64cd\u4f5c\u3002

\u7c7b\u4f3c\u5730\uff0c\u56fe\u7684\u904d\u5386\u65b9\u5f0f\u4e5f\u5206\u4e3a\u4e24\u79cd\uff0c\u5373\u300c\u5e7f\u5ea6\u4f18\u5148\u904d\u5386 Breadth-First Traversal\u300d\u548c\u300c\u6df1\u5ea6\u4f18\u5148\u904d\u5386 Depth-First Travsersal\u300d\uff0c\u4e5f\u79f0\u300c\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22 Breadth-First Search\u300d\u548c\u300c\u6df1\u5ea6\u4f18\u5148\u641c\u7d22 Depth-First Search\u300d\uff0c\u7b80\u79f0\u4e3a BFS \u548c DFS \u3002

"},{"location":"chapter_graph/graph_traversal/#931","title":"9.3.1. \u00a0 \u5e7f\u5ea6\u4f18\u5148\u904d\u5386","text":"

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u4f18\u662f\u4e00\u79cd\u7531\u8fd1\u53ca\u8fdc\u7684\u904d\u5386\u65b9\u5f0f\uff0c\u4ece\u8ddd\u79bb\u6700\u8fd1\u7684\u9876\u70b9\u5f00\u59cb\u8bbf\u95ee\uff0c\u5e76\u4e00\u5c42\u5c42\u5411\u5916\u6269\u5f20\u3002\u5177\u4f53\u5730\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u5148\u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff0c\u968f\u540e\u904d\u5386\u4e0b\u4e2a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026

Fig. \u56fe\u7684\u5e7f\u5ea6\u4f18\u5148\u904d\u5386

"},{"location":"chapter_graph/graph_traversal/#_1","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

BFS \u5e38\u501f\u52a9\u300c\u961f\u5217\u300d\u6765\u5b9e\u73b0\u3002\u961f\u5217\u5177\u6709\u201c\u5148\u5165\u5148\u51fa\u201d\u7684\u6027\u8d28\uff0c\u8fd9\u4e0e BFS \u201c\u7531\u8fd1\u53ca\u8fdc\u201d\u7684\u601d\u60f3\u662f\u5f02\u66f2\u540c\u5de5\u7684\u3002

  1. \u5c06\u904d\u5386\u8d77\u59cb\u9876\u70b9 startVet \u52a0\u5165\u961f\u5217\uff0c\u5e76\u5f00\u542f\u5faa\u73af\uff1b
  2. \u5728\u5faa\u73af\u7684\u6bcf\u8f6e\u8fed\u4ee3\u4e2d\uff0c\u5f39\u51fa\u961f\u9996\u9876\u70b9\u5f39\u51fa\u5e76\u8bb0\u5f55\u8bbf\u95ee\uff0c\u5e76\u5c06\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\u52a0\u5165\u5230\u961f\u5217\u5c3e\u90e8\uff1b
  3. \u5faa\u73af 2. \uff0c\u76f4\u5230\u6240\u6709\u9876\u70b9\u8bbf\u95ee\u5b8c\u6210\u540e\u7ed3\u675f\uff1b

\u4e3a\u4e86\u9632\u6b62\u91cd\u590d\u904d\u5386\u9876\u70b9\uff0c\u6211\u4eec\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868 visited \u6765\u8bb0\u5f55\u54ea\u4e9b\u7ed3\u70b9\u5df2\u88ab\u8bbf\u95ee\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_bfs.java
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nList<Vertex> graphBFS(GraphAdjList graph, Vertex startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nList<Vertex> res = new ArrayList<>();\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nSet<Vertex> visited = new HashSet<>() {{ add(startVet); }};\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nQueue<Vertex> que = new LinkedList<>() {{ offer(startVet); }};\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (!que.isEmpty()) {\nVertex vet = que.poll(); // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.add(vet);            // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex adjVet : graph.adjList.get(vet)) {\nif (visited.contains(adjVet))\ncontinue;        // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.offer(adjVet);   // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.cpp
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nvector<Vertex*> graphBFS(GraphAdjList &graph, Vertex *startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvector<Vertex*> res;\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nunordered_set<Vertex*> visited = { startVet };\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nqueue<Vertex*> que;\nque.push(startVet);\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (!que.empty()) {\nVertex *vet = que.front();\nque.pop();          // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push_back(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (auto adjVet : graph.adjList[vet]) {\nif (visited.count(adjVet))\ncontinue;           // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.push(adjVet);       // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.emplace(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.py
def graph_bfs(graph: GraphAdjList, start_vet: Vertex) -> List[Vertex]:\n\"\"\" \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS \"\"\"\n# \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\n# \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres = []\n# \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited = set([start_vet])\n# \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nque = collections.deque([start_vet])\n# \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile len(que) > 0:\nvet = que.popleft()  # \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.append(vet)      # \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n# \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adj_vet in graph.adj_list[vet]:\nif adj_vet in visited:\ncontinue         # \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.append(adj_vet)  # \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adj_vet) # \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n# \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n
graph_bfs.go
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphBFS(g *graphAdjList, startVet Vertex) []Vertex {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres := make([]Vertex, 0)\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited := make(map[Vertex]struct{})\nvisited[startVet] = struct{}{}\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS, \u4f7f\u7528\u5207\u7247\u6a21\u62df\u961f\u5217\nqueue := make([]Vertex, 0)\nqueue = append(queue, startVet)\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nfor len(queue) > 0 {\n// \u961f\u9996\u9876\u70b9\u51fa\u961f\nvet := queue[0]\nqueue = queue[1:]\n// \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nres = append(res, vet)\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor _, adjVet := range g.adjList[vet] {\n_, isExist := visited[adjVet]\n// \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nif !isExist {\nqueue = append(queue, adjVet)\nvisited[adjVet] = struct{}{}\n}\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_bfs.js
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphBFS(graph, startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited = new Set();\nvisited.add(startVet);\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nconst que = [startVet];\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (que.length) {\nconst vet = que.shift();    // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push(vet);              // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet) ?? []) {\nif (visited.has(adjVet)) {\ncontinue;           // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.push(adjVet);       // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adjVet);    // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.ts
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphBFS(graph: GraphAdjList, startVet: Vertex): Vertex[] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res: Vertex[] = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited: Set<Vertex> = new Set();\nvisited.add(startVet);\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nconst que = [startVet];\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (que.length) {\nconst vet = que.shift(); // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet) ?? []) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.push(adjVet); // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\nvisited.add(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.c
[class]{}-[func]{graphBFS}\n
graph_bfs.cs
[class]{graph_bfs}-[func]{graphBFS}\n
graph_bfs.swift
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphBFS(graph: GraphAdjList, startVet: Vertex) -> [Vertex] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvar res: [Vertex] = []\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvar visited: Set<Vertex> = [startVet]\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nvar que: [Vertex] = [startVet]\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile !que.isEmpty {\nlet vet = que.removeFirst() // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.append(vet) // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adjList[vet] ?? [] {\nif visited.contains(adjVet) {\ncontinue // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.append(adjVet) // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.insert(adjVet) // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_bfs.zig
[class]{}-[func]{graphBFS}\n

\u4ee3\u7801\u76f8\u5bf9\u62bd\u8c61\uff0c\u5efa\u8bae\u5bf9\u7167\u4ee5\u4e0b\u52a8\u753b\u56fe\u793a\u6765\u52a0\u6df1\u7406\u89e3\u3002

<1><2><3><4><5><6><7><8><9><10><11>

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7684\u5e8f\u5217\u662f\u5426\u552f\u4e00\uff1f

\u4e0d\u552f\u4e00\u3002\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u53ea\u8981\u6c42\u201c\u7531\u8fd1\u53ca\u8fdc\u201d\uff0c\u800c\u591a\u4e2a\u76f8\u540c\u8ddd\u79bb\u7684\u9876\u70b9\u7684\u904d\u5386\u987a\u5e8f\u5141\u8bb8\u88ab\u4efb\u610f\u6253\u4e71\u3002\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\u9876\u70b9 \\(1\\) , \\(3\\) \u7684\u8bbf\u95ee\u987a\u5e8f\u53ef\u4ee5\u4ea4\u6362\u3001\u9876\u70b9 \\(2\\) , \\(4\\) , \\(6\\) \u7684\u8bbf\u95ee\u987a\u5e8f\u4e5f\u53ef\u4ee5\u4efb\u610f\u4ea4\u6362\u3001\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026

"},{"location":"chapter_graph/graph_traversal/#_2","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a \u6240\u6709\u9876\u70b9\u90fd\u4f1a\u5165\u961f\u3001\u51fa\u961f\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(|V|)\\) \u65f6\u95f4\uff1b\u5728\u904d\u5386\u90bb\u63a5\u9876\u70b9\u7684\u8fc7\u7a0b\u4e2d\uff0c\u7531\u4e8e\u662f\u65e0\u5411\u56fe\uff0c\u56e0\u6b64\u6240\u6709\u8fb9\u90fd\u4f1a\u88ab\u8bbf\u95ee \\(2\\) \u6b21\uff0c\u4f7f\u7528 \\(O(2|E|)\\) \u65f6\u95f4\uff1b\u603b\u4f53\u4f7f\u7528 \\(O(|V| + |E|)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a \u5217\u8868 res \uff0c\u54c8\u5e0c\u8868 visited \uff0c\u961f\u5217 que \u4e2d\u7684\u9876\u70b9\u6570\u91cf\u6700\u591a\u4e3a \\(|V|\\) \uff0c\u4f7f\u7528 \\(O(|V|)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_graph/graph_traversal/#932","title":"9.3.2. \u00a0 \u6df1\u5ea6\u4f18\u5148\u904d\u5386","text":"

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u4f18\u5148\u8d70\u5230\u5e95\u3001\u65e0\u8def\u53ef\u8d70\u518d\u56de\u5934\u7684\u904d\u5386\u65b9\u5f0f\u3002\u5177\u4f53\u5730\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u4e0d\u65ad\u5730\u8bbf\u95ee\u5f53\u524d\u7ed3\u70b9\u7684\u67d0\u4e2a\u90bb\u63a5\u9876\u70b9\uff0c\u76f4\u5230\u8d70\u5230\u5c3d\u5934\u65f6\u56de\u6eaf\uff0c\u518d\u7ee7\u7eed\u8d70\u5230\u5e95 + \u56de\u6eaf\uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u76f4\u81f3\u6240\u6709\u9876\u70b9\u904d\u5386\u5b8c\u6210\u65f6\u7ed3\u675f\u3002

Fig. \u56fe\u7684\u6df1\u5ea6\u4f18\u5148\u904d\u5386

"},{"location":"chapter_graph/graph_traversal/#_3","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

\u8fd9\u79cd\u201c\u8d70\u5230\u5934 + \u56de\u6eaf\u201d\u7684\u7b97\u6cd5\u5f62\u5f0f\u4e00\u822c\u57fa\u4e8e\u9012\u5f52\u6765\u5b9e\u73b0\u3002\u4e0e BFS \u7c7b\u4f3c\uff0c\u5728 DFS \u4e2d\u6211\u4eec\u4e5f\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868 visited \u6765\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u7684\u9876\u70b9\uff0c\u4ee5\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u9876\u70b9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_dfs.java
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nvoid dfs(GraphAdjList graph, Set<Vertex> visited, List<Vertex> res, Vertex vet) {\nres.add(vet);     // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex adjVet : graph.adjList.get(vet)) {\nif (visited.contains(adjVet))\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nList<Vertex> graphDFS(GraphAdjList graph, Vertex startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nList<Vertex> res = new ArrayList<>();\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nSet<Vertex> visited = new HashSet<>();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.cpp
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nvoid dfs(GraphAdjList& graph, unordered_set<Vertex*>& visited, vector<Vertex*>& res, Vertex* vet) {\nres.push_back(vet);   // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.emplace(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex* adjVet : graph.adjList[vet]) {\nif (visited.count(adjVet))\ncontinue;     // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nvector<Vertex*> graphDFS(GraphAdjList& graph, Vertex* startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvector<Vertex*> res;\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nunordered_set<Vertex*> visited;\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.py
def dfs(graph: GraphAdjList, visited: Set[Vertex], res: List[Vertex], vet: Vertex):\n\"\"\" \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 \"\"\"\nres.append(vet)     # \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet) # \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n# \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adj_list[vet]:\nif adjVet in visited:\ncontinue # \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n# \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet)\ndef graph_dfs(graph: GraphAdjList, start_vet: Vertex) -> List[Vertex]:\n\"\"\" \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \"\"\"\n# \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres = []\n# \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited = set()\ndfs(graph, visited, res, start_vet)\nreturn res\n
graph_dfs.go
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunc dfs(g *graphAdjList, visited map[Vertex]struct{}, res *[]Vertex, vet Vertex) {\n// append \u64cd\u4f5c\u4f1a\u8fd4\u56de\u65b0\u7684\u7684\u5f15\u7528\uff0c\u5fc5\u987b\u8ba9\u539f\u5f15\u7528\u91cd\u65b0\u8d4b\u503c\u4e3a\u65b0slice\u7684\u5f15\u7528\n*res = append(*res, vet)\nvisited[vet] = struct{}{}\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor _, adjVet := range g.adjList[vet] {\n_, isExist := visited[adjVet]\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\nif !isExist {\ndfs(g, visited, res, adjVet)\n}\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphDFS(g *graphAdjList, startVet Vertex) []Vertex {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres := make([]Vertex, 0)\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited := make(map[Vertex]struct{})\ndfs(g, visited, &res, startVet)\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_dfs.js
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction dfs(graph, visited, res, vet) {\nres.push(vet);      // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet);   // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet)) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphDFS(graph, startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited = new Set();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.ts
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunction dfs(graph: GraphAdjList, visited: Set<Vertex>, res: Vertex[], vet: Vertex): void {\nres.push(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet)) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphDFS(graph: GraphAdjList, startVet: Vertex): Vertex[] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res: Vertex[] = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited: Set<Vertex> = new Set();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.c
[class]{}-[func]{dfs}\n[class]{}-[func]{graphDFS}\n
graph_dfs.cs
[class]{graph_dfs}-[func]{dfs}\n[class]{graph_dfs}-[func]{graphDFS}\n
graph_dfs.swift
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunc dfs(graph: GraphAdjList, visited: inout Set<Vertex>, res: inout [Vertex], vet: Vertex) {\nres.append(vet) // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.insert(vet) // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adjList[vet] ?? [] {\nif visited.contains(adjVet) {\ncontinue // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph: graph, visited: &visited, res: &res, vet: adjVet)\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphDFS(graph: GraphAdjList, startVet: Vertex) -> [Vertex] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvar res: [Vertex] = []\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvar visited: Set<Vertex> = []\ndfs(graph: graph, visited: &visited, res: &res, vet: startVet)\nreturn res\n}\n
graph_dfs.zig
[class]{}-[func]{dfs}\n[class]{}-[func]{graphDFS}\n

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u7b97\u6cd5\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5176\u4e2d

  • \u76f4\u865a\u7ebf\u4ee3\u8868\u5411\u4e0b\u9012\u63a8\uff0c\u4ee3\u8868\u5f00\u542f\u4e86\u4e00\u4e2a\u65b0\u7684\u9012\u5f52\u65b9\u6cd5\u6765\u8bbf\u95ee\u65b0\u9876\u70b9\uff1b
  • \u66f2\u865a\u7ebf\u4ee3\u8868\u5411\u4e0a\u56de\u6eaf\uff0c\u4ee3\u8868\u6b64\u9012\u5f52\u65b9\u6cd5\u5df2\u7ecf\u8fd4\u56de\uff0c\u56de\u6eaf\u5230\u4e86\u5f00\u542f\u6b64\u9012\u5f52\u65b9\u6cd5\u7684\u4f4d\u7f6e\uff1b

\u4e3a\u4e86\u52a0\u6df1\u7406\u89e3\uff0c\u8bf7\u4f60\u5c06\u56fe\u793a\u4e0e\u4ee3\u7801\u7ed3\u5408\u8d77\u6765\uff0c\u5728\u8111\u4e2d\uff08\u6216\u8005\u7528\u7b14\u753b\u4e0b\u6765\uff09\u6a21\u62df\u6574\u4e2a DFS \u8fc7\u7a0b\uff0c\u5305\u62ec\u6bcf\u4e2a\u9012\u5f52\u65b9\u6cd5\u4f55\u65f6\u5f00\u542f\u3001\u4f55\u65f6\u8fd4\u56de\u3002

<1><2><3><4><5><6><7><8><9><10><11>

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u5e8f\u5217\u662f\u5426\u552f\u4e00\uff1f

\u4e0e\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7c7b\u4f3c\uff0c\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u5e8f\u5217\u7684\u987a\u5e8f\u4e5f\u4e0d\u662f\u552f\u4e00\u7684\u3002\u7ed9\u5b9a\u67d0\u9876\u70b9\uff0c\u5148\u5f80\u54ea\u4e2a\u65b9\u5411\u63a2\u7d22\u90fd\u884c\uff0c\u90fd\u662f\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u3002

\u4ee5\u6811\u7684\u904d\u5386\u4e3a\u4f8b\uff0c\u201c\u6839 \\(\\rightarrow\\) \u5de6 \\(\\rightarrow\\) \u53f3\u201d\u3001\u201c\u5de6 \\(\\rightarrow\\) \u6839 \\(\\rightarrow\\) \u53f3\u201d\u3001\u201c\u5de6 \\(\\rightarrow\\) \u53f3 \\(\\rightarrow\\) \u6839\u201d\u5206\u522b\u5bf9\u5e94\u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386\uff0c\u4f53\u73b0\u4e09\u79cd\u4e0d\u540c\u7684\u904d\u5386\u4f18\u5148\u7ea7\uff0c\u800c\u4e09\u8005\u90fd\u5c5e\u4e8e\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u3002

"},{"location":"chapter_graph/graph_traversal/#_4","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a \u6240\u6709\u9876\u70b9\u90fd\u88ab\u8bbf\u95ee\u4e00\u6b21\uff1b\u6240\u6709\u8fb9\u90fd\u88ab\u8bbf\u95ee\u4e86 \\(2\\) \u6b21\uff0c\u4f7f\u7528 \\(O(2|E|)\\) \u65f6\u95f4\uff1b\u603b\u4f53\u4f7f\u7528 \\(O(|V| + |E|)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a \u5217\u8868 res \uff0c\u54c8\u5e0c\u8868 visited \u9876\u70b9\u6570\u91cf\u6700\u591a\u4e3a \\(|V|\\) \uff0c\u9012\u5f52\u6df1\u5ea6\u6700\u5927\u4e3a \\(|V|\\) \uff0c\u56e0\u6b64\u4f7f\u7528 \\(O(|V|)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_graph/summary/","title":"9.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u56fe\u7531\u9876\u70b9\u548c\u8fb9\u7ec4\u6210\uff0c\u53ef\u4ee5\u8868\u793a\u4e3a\u4e00\u7ec4\u9876\u70b9\u548c\u4e00\u7ec4\u8fb9\u6784\u6210\u7684\u96c6\u5408\u3002
  • \u76f8\u6bd4\u7ebf\u6027\u5173\u7cfb\uff08\u94fe\u8868\uff09\u548c\u5206\u6cbb\u5173\u7cfb\uff08\u6811\uff09\uff0c\u7f51\u7edc\u5173\u7cfb\uff08\u56fe\uff09\u7684\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u4e5f\u4ece\u800c\u66f4\u4e3a\u590d\u6742\u3002
  • \u6709\u5411\u56fe\u7684\u8fb9\u5b58\u5728\u65b9\u5411\uff0c\u8fde\u901a\u56fe\u4e2d\u7684\u4efb\u610f\u9876\u70b9\u90fd\u53ef\u8fbe\uff0c\u6709\u6743\u56fe\u7684\u6bcf\u6761\u8fb9\u90fd\u5305\u542b\u6743\u91cd\u53d8\u91cf\u3002
  • \u90bb\u63a5\u77e9\u9635\u4f7f\u7528\u65b9\u9635\u6765\u8868\u793a\u56fe\uff0c\u6bcf\u4e00\u884c\uff08\u5217\uff09\u4ee3\u8868\u4e00\u4e2a\u9876\u70b9\uff0c\u77e9\u9635\u5143\u7d20\u4ee3\u8868\u8fb9\uff0c\u4f7f\u7528 \\(1\\) \u6216 \\(0\\) \u6765\u8868\u793a\u4e24\u4e2a\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u6216\u65e0\u8fb9\u3002\u90bb\u63a5\u77e9\u9635\u7684\u589e\u5220\u67e5\u64cd\u4f5c\u6548\u7387\u5f88\u9ad8\uff0c\u4f46\u5360\u7528\u7a7a\u95f4\u5927\u3002
  • \u90bb\u63a5\u8868\u4f7f\u7528\u591a\u4e2a\u94fe\u8868\u6765\u8868\u793a\u56fe\uff0c\u7b2c \\(i\\) \u6761\u94fe\u8868\u5bf9\u5e94\u9876\u70b9 \\(i\\) \uff0c\u5176\u4e2d\u5b58\u50a8\u4e86\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\u3002\u90bb\u63a5\u8868\u76f8\u5bf9\u90bb\u63a5\u77e9\u9635\u66f4\u52a0\u8282\u7701\u7a7a\u95f4\uff0c\u4f46\u7531\u4e8e\u9700\u8981\u901a\u8fc7\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u8fb9\uff0c\u56e0\u6b64\u65f6\u95f4\u6548\u7387\u8f83\u4f4e\u3002
  • \u5f53\u90bb\u63a5\u8868\u4e2d\u7684\u94fe\u8868\u8fc7\u957f\u65f6\uff0c\u53ef\u4ee5\u5c06\u5176\u8f6c\u5316\u4e3a\u7ea2\u9ed1\u6811\u6216\u54c8\u5e0c\u8868\uff0c\u4ece\u800c\u63d0\u5347\u67e5\u8be2\u6548\u7387\u3002
  • \u4ece\u7b97\u6cd5\u601d\u60f3\u89d2\u5ea6\u5206\u6790\uff0c\u90bb\u63a5\u77e9\u9635\u4f53\u73b0\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\uff0c\u90bb\u63a5\u8868\u4f53\u73b0\u201c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u201d
  • \u56fe\u53ef\u4ee5\u7528\u4e8e\u5efa\u6a21\u5404\u7c7b\u73b0\u5b9e\u7cfb\u7edf\uff0c\u4f8b\u5982\u793e\u4ea4\u7f51\u7edc\u3001\u5730\u94c1\u7ebf\u8def\u7b49\u3002
  • \u6811\u662f\u56fe\u7684\u4e00\u79cd\u7279\u4f8b\uff0c\u6811\u7684\u904d\u5386\u4e5f\u662f\u56fe\u7684\u904d\u5386\u7684\u4e00\u79cd\u7279\u4f8b\u3002
  • \u56fe\u7684\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u7531\u8fd1\u53ca\u8fdc\u3001\u5c42\u5c42\u6269\u5f20\u7684\u641c\u7d22\u65b9\u5f0f\uff0c\u5e38\u501f\u52a9\u961f\u5217\u5b9e\u73b0\u3002
  • \u56fe\u7684\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u4f18\u5148\u8d70\u5230\u5e95\u3001\u65e0\u8def\u53ef\u8d70\u518d\u56de\u5934\u7684\u641c\u7d22\u65b9\u5f0f\uff0c\u5e38\u57fa\u4e8e\u9012\u5f52\u6765\u5b9e\u73b0\u3002
"},{"location":"chapter_hashing/hash_collision/","title":"6.2. \u00a0 \u54c8\u5e0c\u51b2\u7a81","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u54c8\u5e0c\u51fd\u6570\u5e94\u8be5\u4e3a\u6bcf\u4e2a\u8f93\u5165\u4ea7\u751f\u552f\u4e00\u7684\u8f93\u51fa\uff0c\u4f7f\u5f97 key \u548c value \u4e00\u4e00\u5bf9\u5e94\u3002\u800c\u5b9e\u9645\u4e0a\uff0c\u5f80\u5f80\u5b58\u5728\u5411\u54c8\u5e0c\u51fd\u6570\u8f93\u5165\u4e0d\u540c\u7684 key \u800c\u4ea7\u751f\u76f8\u540c\u8f93\u51fa\u7684\u60c5\u51b5\uff0c\u8fd9\u79cd\u60c5\u51b5\u88ab\u79f0\u4e3a\u300c\u54c8\u5e0c\u51b2\u7a81 Hash Collision\u300d\u3002\u54c8\u5e0c\u51b2\u7a81\u4f1a\u5bfc\u81f4\u67e5\u8be2\u7ed3\u679c\u9519\u8bef\uff0c\u4ece\u800c\u4e25\u91cd\u5f71\u54cd\u54c8\u5e0c\u8868\u7684\u53ef\u7528\u6027\u3002

\u90a3\u4e48\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\u5462\uff1f\u672c\u8d28\u4e0a\u770b\uff0c\u7531\u4e8e\u54c8\u5e0c\u51fd\u6570\u7684\u8f93\u5165\u7a7a\u95f4\u5f80\u5f80\u8fdc\u5927\u4e8e\u8f93\u51fa\u7a7a\u95f4\uff0c\u56e0\u6b64\u4e0d\u53ef\u907f\u514d\u5730\u4f1a\u51fa\u73b0\u591a\u4e2a\u8f93\u5165\u4ea7\u751f\u76f8\u540c\u8f93\u51fa\u7684\u60c5\u51b5\uff0c\u5373\u4e3a\u54c8\u5e0c\u51b2\u7a81\u3002\u6bd4\u5982\uff0c\u8f93\u5165\u7a7a\u95f4\u662f\u5168\u4f53\u6574\u6570\uff0c\u8f93\u51fa\u7a7a\u95f4\u662f\u4e00\u4e2a\u56fa\u5b9a\u5927\u5c0f\u7684\u6876\uff08\u6570\u7ec4\uff09\u7684\u7d22\u5f15\u8303\u56f4\uff0c\u90a3\u4e48\u5fc5\u5b9a\u4f1a\u6709\u591a\u4e2a\u6574\u6570\u540c\u65f6\u6620\u5c04\u5230\u4e00\u4e2a\u6876\u7d22\u5f15\u3002

\u4e3a\u4e86\u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\uff0c\u4e00\u65b9\u9762\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u54c8\u5e0c\u8868\u6269\u5bb9\u6765\u51cf\u5c0f\u51b2\u7a81\u6982\u7387\u3002\u6781\u7aef\u60c5\u51b5\u4e0b\uff0c\u5f53\u8f93\u5165\u7a7a\u95f4\u548c\u8f93\u51fa\u7a7a\u95f4\u5927\u5c0f\u76f8\u7b49\u65f6\uff0c\u54c8\u5e0c\u8868\u5c31\u7b49\u4ef7\u4e8e\u6570\u7ec4\u4e86\uff0c\u53ef\u8c13\u201c\u5927\u529b\u51fa\u5947\u8ff9\u201d\u3002

\u53e6\u4e00\u65b9\u9762\uff0c\u8003\u8651\u901a\u8fc7\u4f18\u5316\u54c8\u5e0c\u8868\u7684\u8868\u793a\u65b9\u5f0f\u4ee5\u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u6709\u300c\u94fe\u5f0f\u5730\u5740\u300d\u548c\u300c\u5f00\u653e\u5bfb\u5740\u300d\u3002

"},{"location":"chapter_hashing/hash_collision/#621","title":"6.2.1. \u00a0 \u54c8\u5e0c\u8868\u6269\u5bb9","text":"

\u300c\u8d1f\u8f7d\u56e0\u5b50 Load Factor\u300d\u5b9a\u4e49\u4e3a \u54c8\u5e0c\u8868\u4e2d\u5143\u7d20\u6570\u91cf\u9664\u4ee5\u6876\u69fd\u6570\u91cf\uff08\u5373\u6570\u7ec4\u5927\u5c0f\uff09\uff0c\u4ee3\u8868\u54c8\u5e0c\u51b2\u7a81\u7684\u4e25\u91cd\u7a0b\u5ea6\u3002

\u8d1f\u8f7d\u56e0\u5b50\u5e38\u7528\u4f5c\u54c8\u5e0c\u8868\u6269\u5bb9\u7684\u89e6\u53d1\u6761\u4ef6\u3002\u6bd4\u5982\u5728 Java \u4e2d\uff0c\u5f53\u8d1f\u8f7d\u56e0\u5b50 \\(> 0.75\\) \u65f6\u5219\u89e6\u53d1\u6269\u5bb9\uff0c\u5c06 HashMap \u5927\u5c0f\u6269\u5145\u81f3\u539f\u5148\u7684 \\(2\\) \u500d\u3002

\u4e0e\u6570\u7ec4\u6269\u5bb9\u7c7b\u4f3c\uff0c\u54c8\u5e0c\u8868\u6269\u5bb9\u64cd\u4f5c\u7684\u5f00\u9500\u5f88\u5927\uff0c\u56e0\u4e3a\u9700\u8981\u5c06\u6240\u6709\u952e\u503c\u5bf9\u4ece\u539f\u54c8\u5e0c\u8868\u4f9d\u6b21\u79fb\u52a8\u81f3\u65b0\u54c8\u5e0c\u8868\u3002

"},{"location":"chapter_hashing/hash_collision/#622","title":"6.2.2. \u00a0 \u94fe\u5f0f\u5730\u5740","text":"

\u5728\u539f\u59cb\u54c8\u5e0c\u8868\u4e2d\uff0c\u6876\u5185\u7684\u6bcf\u4e2a\u5730\u5740\u53ea\u80fd\u5b58\u50a8\u4e00\u4e2a\u5143\u7d20\uff08\u5373\u952e\u503c\u5bf9\uff09\u3002\u8003\u8651\u5c06\u5355\u4e2a\u5143\u7d20\u8f6c\u5316\u6210\u4e00\u4e2a\u94fe\u8868\uff0c\u5c06\u6240\u6709\u51b2\u7a81\u5143\u7d20\u90fd\u5b58\u50a8\u5728\u4e00\u4e2a\u94fe\u8868\u4e2d\u3002

Fig. \u94fe\u5f0f\u5730\u5740

\u94fe\u5f0f\u5730\u5740\u4e0b\uff0c\u54c8\u5e0c\u8868\u64cd\u4f5c\u65b9\u6cd5\u4e3a\uff1a

  • \u67e5\u8be2\u5143\u7d20\uff1a\u5148\u5c06 key \u8f93\u5165\u5230\u54c8\u5e0c\u51fd\u6570\u5f97\u5230\u6876\u5185\u7d22\u5f15\uff0c\u5373\u53ef\u8bbf\u95ee\u94fe\u8868\u5934\u7ed3\u70b9\uff0c\u518d\u901a\u8fc7\u904d\u5386\u94fe\u8868\u67e5\u627e\u5bf9\u5e94 value \u3002
  • \u6dfb\u52a0\u5143\u7d20\uff1a\u5148\u901a\u8fc7\u54c8\u5e0c\u51fd\u6570\u8bbf\u95ee\u94fe\u8868\u5934\u90e8\uff0c\u518d\u5c06\u7ed3\u70b9\uff08\u5373\u952e\u503c\u5bf9\uff09\u6dfb\u52a0\u5230\u94fe\u8868\u5934\u90e8\u5373\u53ef\u3002
  • \u5220\u9664\u5143\u7d20\uff1a\u540c\u6837\u5148\u6839\u636e\u54c8\u5e0c\u51fd\u6570\u7ed3\u679c\u8bbf\u95ee\u94fe\u8868\u5934\u90e8\uff0c\u518d\u904d\u5386\u94fe\u8868\u67e5\u627e\u5bf9\u5e94\u7ed3\u70b9\uff0c\u5220\u9664\u4e4b\u5373\u53ef\u3002

\u94fe\u5f0f\u5730\u5740\u867d\u7136\u89e3\u51b3\u4e86\u54c8\u5e0c\u51b2\u7a81\u95ee\u9898\uff0c\u4f46\u4ecd\u5b58\u5728\u5c40\u9650\u6027\uff0c\u5305\u62ec\uff1a

  • \u5360\u7528\u7a7a\u95f4\u53d8\u5927\uff0c\u56e0\u4e3a\u94fe\u8868\u6216\u4e8c\u53c9\u6811\u5305\u542b\u7ed3\u70b9\u6307\u9488\uff0c\u76f8\u6bd4\u4e8e\u6570\u7ec4\u66f4\u52a0\u8017\u8d39\u5185\u5b58\u7a7a\u95f4\uff1b
  • \u67e5\u8be2\u6548\u7387\u964d\u4f4e\uff0c\u56e0\u4e3a\u9700\u8981\u7ebf\u6027\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u5bf9\u5e94\u5143\u7d20\uff1b

\u4e3a\u4e86\u63d0\u5347\u64cd\u4f5c\u6548\u7387\uff0c\u53ef\u4ee5\u628a\u300c\u94fe\u8868\u300d\u8f6c\u5316\u4e3a\u300cAVL \u6811\u300d\u6216\u300c\u7ea2\u9ed1\u6811\u300d\uff0c\u5c06\u67e5\u8be2\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(\\log n)\\) \u3002

"},{"location":"chapter_hashing/hash_collision/#623","title":"6.2.3. \u00a0 \u5f00\u653e\u5bfb\u5740","text":"

\u300c\u5f00\u653e\u5bfb\u5740\u300d\u4e0d\u5f15\u5165\u989d\u5916\u6570\u636e\u7ed3\u6784\uff0c\u800c\u662f\u901a\u8fc7\u201c\u591a\u6b21\u63a2\u6d4b\u201d\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u6839\u636e\u63a2\u6d4b\u65b9\u6cd5\u7684\u4e0d\u540c\uff0c\u4e3b\u8981\u5206\u4e3a \u7ebf\u6027\u63a2\u6d4b\u3001\u5e73\u65b9\u63a2\u6d4b\u3001\u591a\u6b21\u54c8\u5e0c\u3002

"},{"location":"chapter_hashing/hash_collision/#_1","title":"\u7ebf\u6027\u63a2\u6d4b","text":"

\u300c\u7ebf\u6027\u63a2\u6d4b\u300d\u4f7f\u7528\u56fa\u5b9a\u6b65\u957f\u7684\u7ebf\u6027\u67e5\u627e\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002

\u63d2\u5165\u5143\u7d20\uff1a\u5982\u679c\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\uff0c\u5219\u4ece\u51b2\u7a81\u4f4d\u7f6e\u5411\u540e\u7ebf\u6027\u904d\u5386\uff08\u6b65\u957f\u4e00\u822c\u53d6 1 \uff09\uff0c\u76f4\u5230\u627e\u5230\u4e00\u4e2a\u7a7a\u4f4d\uff0c\u5219\u5c06\u5143\u7d20\u63d2\u5165\u5230\u8be5\u7a7a\u4f4d\u4e2d\u3002

\u67e5\u627e\u5143\u7d20\uff1a\u82e5\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\uff0c\u5219\u4f7f\u7528\u76f8\u540c\u6b65\u957f\u6267\u884c\u7ebf\u6027\u67e5\u627e\uff0c\u4f1a\u9047\u5230\u4e24\u79cd\u60c5\u51b5\uff1a

  1. \u627e\u5230\u5bf9\u5e94\u5143\u7d20\uff0c\u8fd4\u56de value \u5373\u53ef\uff1b
  2. \u82e5\u9047\u5230\u7a7a\u4f4d\uff0c\u5219\u8bf4\u660e\u67e5\u627e\u952e\u503c\u5bf9\u4e0d\u5728\u54c8\u5e0c\u8868\u4e2d\uff1b

Fig. \u7ebf\u6027\u63a2\u6d4b

\u7ebf\u6027\u63a2\u6d4b\u5b58\u5728\u4ee5\u4e0b\u7f3a\u9677\uff1a

  • \u4e0d\u80fd\u76f4\u63a5\u5220\u9664\u5143\u7d20\u3002\u5220\u9664\u5143\u7d20\u4f1a\u5bfc\u81f4\u6876\u5185\u51fa\u73b0\u4e00\u4e2a\u7a7a\u4f4d\uff0c\u5728\u67e5\u627e\u5176\u4ed6\u5143\u7d20\u65f6\uff0c\u8be5\u7a7a\u4f4d\u6709\u53ef\u80fd\u5bfc\u81f4\u7a0b\u5e8f\u8ba4\u4e3a\u5143\u7d20\u4e0d\u5b58\u5728\uff08\u5373\u4e0a\u8ff0\u7b2c 2. \u79cd\u60c5\u51b5\uff09\u3002\u56e0\u6b64\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u6807\u5fd7\u4f4d\u6765\u6807\u8bb0\u5220\u9664\u5143\u7d20\u3002
  • \u5bb9\u6613\u4ea7\u751f\u805a\u96c6\u3002\u6876\u5185\u88ab\u5360\u7528\u7684\u8fde\u7eed\u4f4d\u7f6e\u8d8a\u957f\uff0c\u8fd9\u4e9b\u8fde\u7eed\u4f4d\u7f6e\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\u7684\u53ef\u80fd\u6027\u8d8a\u5927\uff0c\u4ece\u800c\u8fdb\u4e00\u6b65\u4fc3\u8fdb\u8fd9\u4e00\u4f4d\u7f6e\u7684\u201c\u805a\u5806\u751f\u957f\u201d\uff0c\u6700\u7ec8\u5bfc\u81f4\u589e\u5220\u67e5\u6539\u64cd\u4f5c\u6548\u7387\u7684\u52a3\u5316\u3002
"},{"location":"chapter_hashing/hash_collision/#_2","title":"\u591a\u6b21\u54c8\u5e0c","text":"

\u987e\u540d\u601d\u4e49\uff0c\u300c\u591a\u6b21\u54c8\u5e0c\u300d\u7684\u601d\u8def\u662f\u4f7f\u7528\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570 \\(f_1(x)\\) , \\(f_2(x)\\) , \\(f_3(x)\\) , \\(\\cdots\\) \u8fdb\u884c\u63a2\u6d4b\u3002

\u63d2\u5165\u5143\u7d20\uff1a\u82e5\u54c8\u5e0c\u51fd\u6570 \\(f_1(x)\\) \u51fa\u73b0\u51b2\u7a81\uff0c\u5219\u5c1d\u8bd5 \\(f_2(x)\\) \uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u76f4\u5230\u627e\u5230\u7a7a\u4f4d\u540e\u63d2\u5165\u5143\u7d20\u3002

\u67e5\u627e\u5143\u7d20\uff1a\u4ee5\u76f8\u540c\u7684\u54c8\u5e0c\u51fd\u6570\u987a\u5e8f\u67e5\u627e\uff0c\u5b58\u5728\u4e24\u79cd\u60c5\u51b5\uff1a

  1. \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u5219\u8fd4\u56de\u4e4b\uff1b
  2. \u5230\u7a7a\u4f4d\u6216\u5df2\u5c1d\u8bd5\u6240\u6709\u54c8\u5e0c\u51fd\u6570\uff0c\u8bf4\u660e\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64\u5143\u7d20\uff1b

\u76f8\u6bd4\u4e8e\u300c\u7ebf\u6027\u63a2\u6d4b\u300d\uff0c\u300c\u591a\u6b21\u54c8\u5e0c\u300d\u65b9\u6cd5\u66f4\u4e0d\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\uff0c\u4ee3\u4ef7\u662f\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u589e\u52a0\u4e86\u989d\u5916\u8ba1\u7b97\u91cf\u3002

\u5de5\u4e1a\u754c\u65b9\u6848

Java \u91c7\u7528\u300c\u94fe\u5f0f\u5730\u5740\u300d\u3002\u5728 JDK 1.8 \u4e4b\u540e\uff0cHashMap \u5185\u6570\u7ec4\u957f\u5ea6\u5927\u4e8e 64 \u65f6\uff0c\u957f\u5ea6\u5927\u4e8e 8 \u7684\u94fe\u8868\u4f1a\u88ab\u8f6c\u5316\u4e3a\u300c\u7ea2\u9ed1\u6811\u300d\uff0c\u4ee5\u63d0\u5347\u67e5\u627e\u6027\u80fd\u3002

Python \u91c7\u7528\u300c\u5f00\u653e\u5bfb\u5740\u300d\u3002\u5b57\u5178 dict \u4f7f\u7528\u4f2a\u968f\u673a\u6570\u8fdb\u884c\u63a2\u6d4b\u3002

"},{"location":"chapter_hashing/hash_map/","title":"6.1. \u00a0 \u54c8\u5e0c\u8868","text":"

\u54c8\u5e0c\u8868\u901a\u8fc7\u5efa\u7acb\u300c\u952e key\u300d\u548c\u300c\u503c value\u300d\u4e4b\u95f4\u7684\u6620\u5c04\uff0c\u5b9e\u73b0\u9ad8\u6548\u7684\u5143\u7d20\u67e5\u627e\u3002\u5177\u4f53\u5730\uff0c\u8f93\u5165\u4e00\u4e2a key \uff0c\u5728\u54c8\u5e0c\u8868\u4e2d\u67e5\u8be2\u5e76\u83b7\u53d6 value \uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \u3002

\u4f8b\u5982\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u5305\u542b \\(n\\) \u4e2a\u5b66\u751f\u7684\u6570\u636e\u5e93\uff0c\u6bcf\u4e2a\u5b66\u751f\u6709\u201c\u59d3\u540d name \u201d\u548c\u201c\u5b66\u53f7 id \u201d\u4e24\u9879\u6570\u636e\uff0c\u5e0c\u671b\u5b9e\u73b0\u4e00\u4e2a\u67e5\u8be2\u529f\u80fd\uff1a\u8f93\u5165\u4e00\u4e2a\u5b66\u53f7\uff0c\u8fd4\u56de\u5bf9\u5e94\u7684\u59d3\u540d\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u54c8\u5e0c\u8868\u5b9e\u73b0\u3002

Fig. \u54c8\u5e0c\u8868\u7684\u62bd\u8c61\u8868\u793a

"},{"location":"chapter_hashing/hash_map/#611","title":"6.1.1. \u00a0 \u54c8\u5e0c\u8868\u6548\u7387","text":"

\u9664\u4e86\u54c8\u5e0c\u8868\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6570\u636e\u7ed3\u6784\u6765\u5b9e\u73b0\u4e0a\u8ff0\u67e5\u8be2\u529f\u80fd\uff1a

  1. \u65e0\u5e8f\u6570\u7ec4\uff1a\u6bcf\u4e2a\u5143\u7d20\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff1b
  2. \u6709\u5e8f\u6570\u7ec4\uff1a\u5c06 1. \u4e2d\u7684\u6570\u7ec4\u6309\u7167\u5b66\u53f7\u4ece\u5c0f\u5230\u5927\u6392\u5e8f\uff1b
  3. \u94fe\u8868\uff1a\u6bcf\u4e2a\u7ed3\u70b9\u7684\u503c\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff1b
  4. \u4e8c\u53c9\u641c\u7d22\u6811\uff1a\u6bcf\u4e2a\u7ed3\u70b9\u7684\u503c\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff0c\u6839\u636e\u5b66\u53f7\u5927\u5c0f\u6765\u6784\u5efa\u6811\uff1b

\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5982\u4e0b\u8868\u6240\u793a\uff08\u5728\u6b64\u4e0d\u505a\u8d58\u8ff0\uff0c\u8be6\u89e3\u53ef\u89c1 \u4e8c\u53c9\u641c\u7d22\u6811\u7ae0\u8282\uff09\u3002\u65e0\u8bba\u662f\u67e5\u627e\u5143\u7d20\u3001\u8fd8\u662f\u589e\u5220\u5143\u7d20\uff0c\u54c8\u5e0c\u8868\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f \\(O(1)\\) \uff0c\u5168\u9762\u80dc\u51fa\uff01

\u65e0\u5e8f\u6570\u7ec4 \u6709\u5e8f\u6570\u7ec4 \u94fe\u8868 \u4e8c\u53c9\u641c\u7d22\u6811 \u54c8\u5e0c\u8868 \u67e5\u627e\u5143\u7d20 \\(O(n)\\) \\(O(\\log n)\\) \\(O(n)\\) \\(O(\\log n)\\) \\(O(1)\\) \u63d2\u5165\u5143\u7d20 \\(O(1)\\) \\(O(n)\\) \\(O(1)\\) \\(O(\\log n)\\) \\(O(1)\\) \u5220\u9664\u5143\u7d20 \\(O(n)\\) \\(O(n)\\) \\(O(n)\\) \\(O(\\log n)\\) \\(O(1)\\)"},{"location":"chapter_hashing/hash_map/#612","title":"6.1.2. \u00a0 \u54c8\u5e0c\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u54c8\u5e0c\u8868\u7684\u57fa\u672c\u64cd\u4f5c\u5305\u62ec \u521d\u59cb\u5316\u3001\u67e5\u8be2\u64cd\u4f5c\u3001\u6dfb\u52a0\u4e0e\u5220\u9664\u952e\u503c\u5bf9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hash_map.java
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nMap<Integer, String> map = new HashMap<>();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.put(12836, \"\u5c0f\u54c8\");   map.put(15937, \"\u5c0f\u5570\");   map.put(16750, \"\u5c0f\u7b97\");   map.put(13276, \"\u5c0f\u6cd5\");\nmap.put(10583, \"\u5c0f\u9e2d\");\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nString name = map.get(15937);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.remove(10583);\n
hash_map.cpp
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nunordered_map<int, string> map;\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap[12836] = \"\u5c0f\u54c8\";\nmap[15937] = \"\u5c0f\u5570\";\nmap[16750] = \"\u5c0f\u7b97\";\nmap[13276] = \"\u5c0f\u6cd5\";\nmap[10583] = \"\u5c0f\u9e2d\";\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nstring name = map[15937];\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.erase(10583);\n
hash_map.py
\"\"\" \u521d\u59cb\u5316\u54c8\u5e0c\u8868 \"\"\"\nmapp: Dict = {}\n\"\"\" \u6dfb\u52a0\u64cd\u4f5c \"\"\"\n# \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmapp[12836] = \"\u5c0f\u54c8\"\nmapp[15937] = \"\u5c0f\u5570\"\nmapp[16750] = \"\u5c0f\u7b97\"\nmapp[13276] = \"\u5c0f\u6cd5\"\nmapp[10583] = \"\u5c0f\u9e2d\"\n\"\"\" \u67e5\u8be2\u64cd\u4f5c \"\"\"\n# \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nname: str = mapp[15937]\n\"\"\" \u5220\u9664\u64cd\u4f5c \"\"\"\n# \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmapp.pop(10583)\n
hash_map.go
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nmapp := make(map[int]string)\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmapp[12836] = \"\u5c0f\u54c8\"\nmapp[15937] = \"\u5c0f\u5570\"\nmapp[16750] = \"\u5c0f\u7b97\"\nmapp[13276] = \"\u5c0f\u6cd5\"\nmapp[10583] = \"\u5c0f\u9e2d\"\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nname := mapp[15937]\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\ndelete(mapp, 10583)\n
hash_map.js
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nconst map = new ArrayHashMap();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.set(12836, '\u5c0f\u54c8');\nmap.set(15937, '\u5c0f\u5570');\nmap.set(16750, '\u5c0f\u7b97');\nmap.set(13276, '\u5c0f\u6cd5');\nmap.set(10583, '\u5c0f\u9e2d');\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map.get(15937);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.delete(10583);\n
hash_map.ts
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nconst map = new Map<number, string>();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.set(12836, '\u5c0f\u54c8');\nmap.set(15937, '\u5c0f\u5570');\nmap.set(16750, '\u5c0f\u7b97');\nmap.set(13276, '\u5c0f\u6cd5');\nmap.set(10583, '\u5c0f\u9e2d');\nconsole.info('\\n\u6dfb\u52a0\u5b8c\u6210\u540e\uff0c\u54c8\u5e0c\u8868\u4e3a\\nKey -> Value');\nconsole.info(map);\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map.get(15937);\nconsole.info('\\n\u8f93\u5165\u5b66\u53f7 15937 \uff0c\u67e5\u8be2\u5230\u59d3\u540d ' + name);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.delete(10583);\nconsole.info('\\n\u5220\u9664 10583 \u540e\uff0c\u54c8\u5e0c\u8868\u4e3a\\nKey -> Value');\nconsole.info(map);\n
hash_map.c
\n
hash_map.cs
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nDictionary<int, String> map = new ();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.Add(12836, \"\u5c0f\u54c8\");\nmap.Add(15937, \"\u5c0f\u5570\");\nmap.Add(16750, \"\u5c0f\u7b97\");\nmap.Add(13276, \"\u5c0f\u6cd5\");\nmap.Add(10583, \"\u5c0f\u9e2d\");\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nString name = map[15937];\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.Remove(10583);\n
hash_map.swift
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nvar map: [Int: String] = [:]\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap[12836] = \"\u5c0f\u54c8\"\nmap[15937] = \"\u5c0f\u5570\"\nmap[16750] = \"\u5c0f\u7b97\"\nmap[13276] = \"\u5c0f\u6cd5\"\nmap[10583] = \"\u5c0f\u9e2d\"\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map[15937]!\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.removeValue(forKey: 10583)\n
hash_map.zig
\n

\u904d\u5386\u54c8\u5e0c\u8868\u6709\u4e09\u79cd\u65b9\u5f0f\uff0c\u5373 \u904d\u5386\u952e\u503c\u5bf9\u3001\u904d\u5386\u952e\u3001\u904d\u5386\u503c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hash_map.java
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor (Map.Entry <Integer, String> kv: map.entrySet()) {\nSystem.out.println(kv.getKey() + \" -> \" + kv.getValue());\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor (int key: map.keySet()) {\nSystem.out.println(key);\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor (String val: map.values()) {\nSystem.out.println(val);\n}\n
hash_map.cpp
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor (auto kv: map) {\ncout << kv.first << \" -> \" << kv.second << endl;\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor (auto key: map) {\ncout << key.first << endl;\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor (auto val: map) {\ncout << val.second << endl;\n}\n
hash_map.py
\"\"\" \u904d\u5386\u54c8\u5e0c\u8868 \"\"\"\n# \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor key, value in mapp.items():\nprint(key, \"->\", value)\n# \u5355\u72ec\u904d\u5386\u952e key\nfor key in mapp.keys():\nprint(key)\n# \u5355\u72ec\u904d\u5386\u503c value\nfor value in mapp.values():\nprint(value)\n
hash_map_test.go
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor key, value := range mapp {\nfmt.Println(key, \"->\", value)\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor key := range mapp {\nfmt.Println(key)\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor _, value := range mapp {\nfmt.Println(value)\n}\n
hash_map.js
/* \u904d\u5386\u54c8\u5e0c\u8868 */\nconsole.info('\\n\u904d\u5386\u952e\u503c\u5bf9 Key->Value');\nfor (const [k, v] of map.entries()) {\nconsole.info(k + ' -> ' + v);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u952e Key');\nfor (const k of map.keys()) {\nconsole.info(k);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u503c Value');\nfor (const v of map.values()) {\nconsole.info(v);\n}\n
hash_map.ts
/* \u904d\u5386\u54c8\u5e0c\u8868 */\nconsole.info('\\n\u904d\u5386\u952e\u503c\u5bf9 Key->Value');\nfor (const [k, v] of map.entries()) {\nconsole.info(k + ' -> ' + v);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u952e Key');\nfor (const k of map.keys()) {\nconsole.info(k);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u503c Value');\nfor (const v of map.values()) {\nconsole.info(v);\n}\n
hash_map.c
\n
hash_map.cs
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 Key->Value\nforeach (var kv in map)\n{\nConsole.WriteLine(kv.Key + \" -> \" + kv.Value);\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nforeach (int key in map.Keys)\n{\nConsole.WriteLine(key);\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nforeach (String val in map.Values)\n{\nConsole.WriteLine(val);\n}\n
hash_map.swift
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 Key->Value\nfor (key, value) in map {\nprint(\"\\(key) -> \\(value)\")\n}\n// \u5355\u72ec\u904d\u5386\u952e Key\nfor key in map.keys {\nprint(key)\n}\n// \u5355\u72ec\u904d\u5386\u503c Value\nfor value in map.values {\nprint(value)\n}\n
hash_map.zig
\n
"},{"location":"chapter_hashing/hash_map/#613","title":"6.1.3. \u00a0 \u54c8\u5e0c\u51fd\u6570","text":"

\u54c8\u5e0c\u8868\u4e2d\u5b58\u50a8\u5143\u7d20\u7684\u6570\u636e\u7ed3\u6784\u88ab\u79f0\u4e3a\u300c\u6876 Bucket\u300d\uff0c\u5e95\u5c42\u5b9e\u73b0\u53ef\u80fd\u662f\u6570\u7ec4\u3001\u94fe\u8868\u3001\u4e8c\u53c9\u6811\uff08\u7ea2\u9ed1\u6811\uff09\uff0c\u6216\u662f\u5b83\u4eec\u7684\u7ec4\u5408\u3002

\u6700\u7b80\u5355\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u4ec5\u7528\u4e00\u4e2a\u300c\u6570\u7ec4\u300d\u6765\u5b9e\u73b0\u54c8\u5e0c\u8868\u3002\u9996\u5148\uff0c\u5c06\u6240\u6709 value \u653e\u5165\u6570\u7ec4\u4e2d\uff0c\u90a3\u4e48\u6bcf\u4e2a value \u5728\u6570\u7ec4\u4e2d\u90fd\u6709\u552f\u4e00\u7684\u300c\u7d22\u5f15\u300d\u3002\u663e\u7136\uff0c\u8bbf\u95ee value \u9700\u8981\u7ed9\u5b9a\u7d22\u5f15\uff0c\u800c\u4e3a\u4e86 \u5efa\u7acb key \u548c\u7d22\u5f15\u4e4b\u95f4\u7684\u6620\u5c04\u5173\u7cfb\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u300c\u54c8\u5e0c\u51fd\u6570 Hash Function\u300d\u3002

\u8bbe\u6570\u7ec4\u4e3a bucket \uff0c\u54c8\u5e0c\u51fd\u6570\u4e3a f(x) \uff0c\u8f93\u5165\u952e\u4e3a key \u3002\u90a3\u4e48\u83b7\u53d6 value \u7684\u6b65\u9aa4\u4e3a\uff1a

  1. \u901a\u8fc7\u54c8\u5e0c\u51fd\u6570\u8ba1\u7b97\u51fa\u7d22\u5f15\uff0c\u5373 index = f(key) \uff1b
  2. \u901a\u8fc7\u7d22\u5f15\u5728\u6570\u7ec4\u4e2d\u83b7\u53d6\u503c\uff0c\u5373 value = bucket[index] \uff1b

\u4ee5\u4e0a\u8ff0\u5b66\u751f\u6570\u636e key \u5b66\u53f7 -> value \u59d3\u540d \u4e3a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u300c\u54c8\u5e0c\u51fd\u6570\u300d\u8bbe\u8ba1\u4e3a

\\[ f(x) = x \\% 100 \\]

Fig. \u7b80\u5355\u54c8\u5e0c\u51fd\u6570\u793a\u4f8b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_hash_map.java
/* \u952e\u503c\u5bf9 int->String */\nclass Entry {\npublic int key;\npublic String val;\npublic Entry(int key, String val) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate List<Entry> bucket;\npublic ArrayHashMap() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket = new ArrayList<>();\nfor (int i = 0; i < 100; i++) {\nbucket.add(null);\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate int hashFunc(int key) {\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic String get(int key) {\nint index = hashFunc(key);\nEntry pair = bucket.get(index);\nif (pair == null) return null;\nreturn pair.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic void put(int key, String val) {\nEntry pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket.set(index, pair);\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic void remove(int key) {\nint index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nbucket.set(index, null);\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic List<Entry> entrySet() {\nList<Entry> entrySet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nentrySet.add(pair);\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic List<Integer> keySet() {\nList<Integer> keySet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nkeySet.add(pair.key);\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic List<String> valueSet() {\nList<String> valueSet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nvalueSet.add(pair.val);\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic void print() {\nfor (Entry kv: entrySet()) {\nSystem.out.println(kv.key + \" -> \" + kv.val);\n}\n}\n}\n
array_hash_map.cpp
/* \u952e\u503c\u5bf9 int->String */\nstruct Entry {\npublic:\nint key;\nstring val;\nEntry(int key, string val) {\nthis->key = key;\nthis->val = val;\n}\n};\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate:\nvector<Entry*> bucket;\npublic:\nArrayHashMap() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket= vector<Entry*>(100);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nint hashFunc(int key) {\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nstring get(int key) {\nint index = hashFunc(key);\nEntry* pair = bucket[index];\nif (pair == nullptr)\nreturn nullptr;\nreturn pair->val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nvoid put(int key, string val) {\nEntry* pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket[index] = pair;\n}\n/* \u5220\u9664\u64cd\u4f5c */\nvoid remove(int key) {\nint index = hashFunc(key);\n// \u7f6e\u4e3a nullptr \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = nullptr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nvector<Entry*> entrySet() {\nvector<Entry*> entrySet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr) {\nentrySet.push_back(pair);\n}\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nvector<int> keySet() {\nvector<int> keySet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr) {\nkeySet.push_back(pair->key);\n}\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nvector<string> valueSet() {\nvector<string> valueSet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr){\nvalueSet.push_back(pair->val);\n}\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nvoid print() {\nfor (Entry* kv: entrySet()) {\ncout << kv->key << \" -> \" << kv->val << endl;\n}\n}\n};\n
array_hash_map.py
class Entry:\n\"\"\" \u952e\u503c\u5bf9 int->String \"\"\"\ndef __init__(self, key: int, val: str):\nself.key = key\nself.val = val\nclass ArrayHashMap:\n\"\"\" \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nself.bucket: List[Optional[Entry]] = [None] * 100\ndef hash_func(self, key: int) -> int:\n\"\"\" \u54c8\u5e0c\u51fd\u6570 \"\"\"\nindex: int = key % 100\nreturn index\ndef get(self, key: int) -> str:\n\"\"\" \u67e5\u8be2\u64cd\u4f5c \"\"\"\nindex: int = self.hash_func(key)\npair: Entry = self.bucket[index]\nif pair is None:\nreturn None\nreturn pair.val\ndef put(self, key: int, val: str) -> None:\n\"\"\" \u6dfb\u52a0\u64cd\u4f5c \"\"\"\npair = Entry(key, val)\nindex: int = self.hash_func(key)\nself.bucket[index] = pair\ndef remove(self, key: int) -> None:\n\"\"\" \u5220\u9664\u64cd\u4f5c \"\"\"\nindex: int = self.hash_func(key)\n# \u7f6e\u4e3a None \uff0c\u4ee3\u8868\u5220\u9664\nself.bucket[index] = None\ndef entry_set(self) -> List[Entry]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 \"\"\"\nresult: List[Entry] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair)\nreturn result\ndef key_set(self) -> List[int]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u952e \"\"\"\nresult: List[int] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair.key)\nreturn result\ndef value_set(self) -> List[str]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u503c \"\"\"\nresult: List[str] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair.val)\nreturn result\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u54c8\u5e0c\u8868 \"\"\"\nfor pair in self.bucket:\nif pair is not None:\nprint(pair.key, \"->\", pair.val)\n
array_hash_map.go
/* \u952e\u503c\u5bf9 int->String */\ntype entry struct {\nkey int\nval string\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\ntype arrayHashMap struct {\nbucket []*entry\n}\n/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nfunc newArrayHashMap() *arrayHashMap {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket := make([]*entry, 100)\nreturn &arrayHashMap{bucket: bucket}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nfunc (a *arrayHashMap) hashFunc(key int) int {\nindex := key % 100\nreturn index\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nfunc (a *arrayHashMap) get(key int) string {\nindex := a.hashFunc(key)\npair := a.bucket[index]\nif pair == nil {\nreturn \"Not Found\"\n}\nreturn pair.val\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nfunc (a *arrayHashMap) put(key int, val string) {\npair := &entry{key: key, val: val}\nindex := a.hashFunc(key)\na.bucket[index] = pair\n}\n/* \u5220\u9664\u64cd\u4f5c */\nfunc (a *arrayHashMap) remove(key int) {\nindex := a.hashFunc(key)\n// \u7f6e\u4e3a nil \uff0c\u4ee3\u8868\u5220\u9664\na.bucket[index] = nil\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u5bf9 */\nfunc (a *arrayHashMap) entrySet() []*entry {\nvar pairs []*entry\nfor _, pair := range a.bucket {\nif pair != nil {\npairs = append(pairs, pair)\n}\n}\nreturn pairs\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nfunc (a *arrayHashMap) keySet() []int {\nvar keys []int\nfor _, pair := range a.bucket {\nif pair != nil {\nkeys = append(keys, pair.key)\n}\n}\nreturn keys\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nfunc (a *arrayHashMap) valueSet() []string {\nvar values []string\nfor _, pair := range a.bucket {\nif pair != nil {\nvalues = append(values, pair.val)\n}\n}\nreturn values\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nfunc (a *arrayHashMap) print() {\nfor _, pair := range a.bucket {\nif pair != nil {\nfmt.Println(pair.key, \"->\", pair.val)\n}\n}\n}\n
array_hash_map.js
/* \u952e\u503c\u5bf9 Number -> String */\nclass Entry {\nconstructor(key, val) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\n#bucket;\nconstructor() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nthis.#bucket = new Array(100).fill(null);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\n#hashFunc(key) {\nreturn key % 100;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nget(key) {\nlet index = this.#hashFunc(key);\nlet entry = this.#bucket[index];\nif (entry === null) return null;\nreturn entry.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nset(key, val) {\nlet index = this.#hashFunc(key);\nthis.#bucket[index] = new Entry(key, val);\n}\n/* \u5220\u9664\u64cd\u4f5c */\ndelete(key) {\nlet index = this.#hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nthis.#bucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nentries() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nkeys() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]?.key);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nvalues() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]?.val);\n}\n}\nreturn arr;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nprint() {\nlet entrySet = this.entries();\nfor (const entry of entrySet) {\nif (!entry) continue;\nconsole.info(`${entry.key} -> ${entry.val}`);\n}\n}\n}\n
array_hash_map.ts
/* \u952e\u503c\u5bf9 Number -> String */\nclass Entry {\npublic key: number;\npublic val: string;\nconstructor(key: number, val: string) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate readonly bucket: (Entry | null)[];\nconstructor() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nthis.bucket = (new Array(100)).fill(null);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate hashFunc(key: number): number {\nreturn key % 100;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic get(key: number): string | null {\nlet index = this.hashFunc(key);\nlet entry = this.bucket[index];\nif (entry === null) return null;\nreturn entry.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic set(key: number, val: string) {\nlet index = this.hashFunc(key);\nthis.bucket[index] = new Entry(key, val);\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic delete(key: number) {\nlet index = this.hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nthis.bucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic entries(): (Entry | null)[] {\nlet arr: (Entry | null)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic keys(): (number | undefined)[] {\nlet arr: (number | undefined)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]?.key);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic values(): (string | undefined)[] {\nlet arr: (string | undefined)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]?.val);\n}\n}\nreturn arr;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic print() {\nlet entrySet = this.entries();\nfor (const entry of entrySet) {\nif (!entry) continue;\nconsole.info(`${entry.key} -> ${entry.val}`);\n}\n}\n}\n
array_hash_map.c
[class]{entry}-[func]{}\n[class]{arrayHashMap}-[func]{}\n
array_hash_map.cs
/* \u952e\u503c\u5bf9 int->String */\nclass Entry\n{\npublic int key;\npublic String val;\npublic Entry(int key, String val)\n{\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap\n{\nprivate List<Entry?> bucket;\npublic ArrayHashMap()\n{\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket = new();\nfor (int i = 0; i < 100; i++)\n{\nbucket.Add(null);\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate int hashFunc(int key)\n{\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic String? get(int key)\n{\nint index = hashFunc(key);\nEntry? pair = bucket[index];\nif (pair == null) return null;\nreturn pair.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic void put(int key, String val)\n{\nEntry pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket[index] = pair;\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic void remove(int key)\n{\nint index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic List<Entry> entrySet()\n{\nList<Entry> entrySet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nentrySet.Add(pair);\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic List<int> keySet()\n{\nList<int> keySet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nkeySet.Add(pair.key);\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic List<String> valueSet()\n{\nList<String> valueSet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nvalueSet.Add(pair.val);\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic void print()\n{\nforeach (Entry kv in entrySet())\n{\nConsole.WriteLine(kv.key + \" -> \" + kv.val);\n}\n}\n}\n
array_hash_map.swift
/* \u952e\u503c\u5bf9 int->String */\nclass Entry {\nvar key: Int\nvar val: String\ninit(key: Int, val: String) {\nself.key = key\nself.val = val\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate var bucket: [Entry?] = []\ninit() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nfor _ in 0 ..< 100 {\nbucket.append(nil)\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate func hashFunc(key: Int) -> Int {\nlet index = key % 100\nreturn index\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nfunc get(key: Int) -> String? {\nlet index = hashFunc(key: key)\nlet pair = bucket[index]\nreturn pair?.val\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nfunc put(key: Int, val: String) {\nlet pair = Entry(key: key, val: val)\nlet index = hashFunc(key: key)\nbucket[index] = pair\n}\n/* \u5220\u9664\u64cd\u4f5c */\nfunc remove(key: Int) {\nlet index = hashFunc(key: key)\n// \u7f6e\u4e3a nil \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = nil\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nfunc entrySet() -> [Entry] {\nvar entrySet: [Entry] = []\nfor pair in bucket {\nif let pair = pair {\nentrySet.append(pair)\n}\n}\nreturn entrySet\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nfunc keySet() -> [Int] {\nvar keySet: [Int] = []\nfor pair in bucket {\nif let pair = pair {\nkeySet.append(pair.key)\n}\n}\nreturn keySet\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nfunc valueSet() -> [String] {\nvar valueSet: [String] = []\nfor pair in bucket {\nif let pair = pair {\nvalueSet.append(pair.val)\n}\n}\nreturn valueSet\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nfunc print() {\nfor entry in entrySet() {\nSwift.print(\"\\(entry.key) -> \\(entry.val)\")\n}\n}\n}\n
array_hash_map.zig
// \u952e\u503c\u5bf9 int->String\nconst Entry = struct {\nkey: usize = undefined,\nval: []const u8 = undefined,\npub fn init(key: usize, val: []const u8) Entry {\nreturn Entry {\n.key = key,\n.val = val,\n};\n}\n};\n// \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868\nfn ArrayHashMap(comptime T: type) type {\nreturn struct {\nbucket: ?std.ArrayList(?T) = null,\nmem_allocator: std.mem.Allocator = undefined,\nconst Self = @This();\n// \u6784\u9020\u65b9\u6cd5\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nself.mem_allocator = allocator;\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nself.bucket = std.ArrayList(?T).init(self.mem_allocator);\nvar i: i32 = 0;\nwhile (i < 100) : (i += 1) {\ntry self.bucket.?.append(null);\n}\n}\n// \u6790\u6784\u65b9\u6cd5\npub fn deinit(self: *Self) void {\nif (self.bucket != null) self.bucket.?.deinit();\n}\n// \u54c8\u5e0c\u51fd\u6570\nfn hashFunc(key: usize) usize {\nvar index = key % 100;\nreturn index;\n}\n// \u67e5\u8be2\u64cd\u4f5c\npub fn get(self: *Self, key: usize) []const u8 {\nvar index = hashFunc(key);\nvar pair = self.bucket.?.items[index];\nreturn pair.?.val;\n}\n// \u6dfb\u52a0\u64cd\u4f5c\npub fn put(self: *Self, key: usize, val: []const u8) !void {\nvar pair = Entry.init(key, val);\nvar index = hashFunc(key);\nself.bucket.?.items[index] = pair;\n}\n// \u5220\u9664\u64cd\u4f5c\npub fn remove(self: *Self, key: usize) !void {\nvar index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nself.bucket.?.items[index] = null;\n}       // \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9\npub fn entrySet(self: *Self) !*std.ArrayList(T) {\nvar entry_set = std.ArrayList(T).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry entry_set.append(item.?);\n}\nreturn &entry_set;\n}  // \u83b7\u53d6\u6240\u6709\u952e\npub fn keySet(self: *Self) !*std.ArrayList(usize) {\nvar key_set = std.ArrayList(usize).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry key_set.append(item.?.key);\n}\nreturn &key_set;\n}  // \u83b7\u53d6\u6240\u6709\u503c\npub fn valueSet(self: *Self) !*std.ArrayList([]const u8) {\nvar value_set = std.ArrayList([]const u8).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry value_set.append(item.?.val);\n}\nreturn &value_set;\n}\n// \u6253\u5370\u54c8\u5e0c\u8868\npub fn print(self: *Self) !void {\nvar entry_set = try self.entrySet();\ndefer entry_set.deinit();\nfor (entry_set.items) |item| {\nstd.debug.print(\"{} -> {s}\\n\", .{item.key, item.val});\n}\n}\n};\n}\n
"},{"location":"chapter_hashing/hash_map/#614","title":"6.1.4. \u00a0 \u54c8\u5e0c\u51b2\u7a81","text":"

\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u4f1a\u53d1\u73b0\uff0c\u54c8\u5e0c\u51fd\u6570 \\(f(x) = x \\% 100\\) \u4f1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5931\u6548\u3002\u5177\u4f53\u5730\uff0c\u5f53\u8f93\u5165\u7684 key \u540e\u4e24\u4f4d\u76f8\u540c\u65f6\uff0c\u54c8\u5e0c\u51fd\u6570\u7684\u8ba1\u7b97\u7ed3\u679c\u4e5f\u76f8\u540c\uff0c\u6307\u5411\u540c\u4e00\u4e2a value \u3002\u4f8b\u5982\uff0c\u5206\u522b\u67e5\u8be2\u4e24\u4e2a\u5b66\u53f7 \\(12836\\) \u548c \\(20336\\) \uff0c\u5219\u6709

\\[ f(12836) = f(20336) = 36 \\]

\u4e24\u4e2a\u5b66\u53f7\u6307\u5411\u4e86\u540c\u4e00\u4e2a\u59d3\u540d\uff0c\u8fd9\u660e\u663e\u662f\u4e0d\u5bf9\u7684\uff0c\u6211\u4eec\u5c06\u8fd9\u79cd\u73b0\u8c61\u79f0\u4e3a\u300c\u54c8\u5e0c\u51b2\u7a81 Hash Collision\u300d\u3002\u5982\u4f55\u907f\u514d\u54c8\u5e0c\u51b2\u7a81\u7684\u95ee\u9898\u5c06\u88ab\u7559\u5728\u4e0b\u7ae0\u8ba8\u8bba\u3002

Fig. \u54c8\u5e0c\u51b2\u7a81\u793a\u4f8b

\u7efc\u4e0a\u6240\u8ff0\uff0c\u4e00\u4e2a\u4f18\u79c0\u7684\u300c\u54c8\u5e0c\u51fd\u6570\u300d\u5e94\u8be5\u5177\u5907\u4ee5\u4e0b\u7279\u6027\uff1a

  • \u5c3d\u91cf\u5c11\u5730\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\uff1b
  • \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff0c\u8ba1\u7b97\u5c3d\u53ef\u80fd\u9ad8\u6548\uff1b
  • \u7a7a\u95f4\u4f7f\u7528\u7387\u9ad8\uff0c\u5373\u201c\u952e\u503c\u5bf9\u5360\u7528\u7a7a\u95f4 / \u54c8\u5e0c\u8868\u603b\u5360\u7528\u7a7a\u95f4\u201d\u5c3d\u53ef\u80fd\u5927\uff1b
"},{"location":"chapter_hashing/summary/","title":"6.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u5411\u54c8\u5e0c\u8868\u4e2d\u8f93\u5165\u4e00\u4e2a\u952e key \uff0c\u67e5\u8be2\u5230\u503c value \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002
  • \u54c8\u5e0c\u8868\u7684\u5e38\u7528\u64cd\u4f5c\u5305\u62ec\u67e5\u8be2\u3001\u6dfb\u52a0\u4e0e\u5220\u9664\u952e\u503c\u5bf9\u3001\u904d\u5386\u952e\u503c\u5bf9\u7b49\u3002
  • \u54c8\u5e0c\u51fd\u6570\u5c06 key \u6620\u5c04\u5230\u6876\uff08\u6570\u7ec4\uff09\u7d22\u5f15\uff0c\u4ece\u800c\u8bbf\u95ee\u5230\u5bf9\u5e94\u7684\u503c value \u3002
  • \u4e24\u4e2a\u4e0d\u540c\u7684 key \u7ecf\u8fc7\u54c8\u5e0c\u51fd\u6570\u53ef\u80fd\u5f97\u5230\u76f8\u540c\u7684\u6876\u7d22\u5f15\uff0c\u8fdb\u800c\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\uff0c\u5bfc\u81f4\u67e5\u8be2\u9519\u8bef\u3002
  • \u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\u7684\u9014\u5f84\u6709\u4e24\u79cd\uff1a\u54c8\u5e0c\u8868\u6269\u5bb9\u3001\u4f18\u5316\u54c8\u5e0c\u8868\u7684\u8868\u793a\u65b9\u5f0f\u3002
  • \u8d1f\u8f7d\u56e0\u5b50\u5b9a\u4e49\u4e3a\u54c8\u5e0c\u8868\u4e2d\u5143\u7d20\u6570\u91cf\u9664\u4ee5\u6876\u69fd\u6570\u91cf\uff0c\u4f53\u73b0\u54c8\u5e0c\u51b2\u7a81\u7684\u4e25\u91cd\u7a0b\u5ea6\uff0c\u5e38\u7528\u4f5c\u54c8\u5e0c\u8868\u6269\u5bb9\u7684\u89e6\u53d1\u6761\u4ef6\u3002\u4e0e\u6570\u7ec4\u6269\u5bb9\u7684\u539f\u7406\u7c7b\u4f3c\uff0c\u54c8\u5e0c\u8868\u6269\u5bb9\u64cd\u4f5c\u5f00\u9500\u4e5f\u5f88\u5927\u3002
  • \u94fe\u5f0f\u5730\u5740\u8003\u8651\u5c06\u5355\u4e2a\u5143\u7d20\u8f6c\u5316\u6210\u4e00\u4e2a\u94fe\u8868\uff0c\u5c06\u6240\u6709\u51b2\u7a81\u5143\u7d20\u90fd\u5b58\u50a8\u5728\u4e00\u4e2a\u94fe\u8868\u4e2d\uff0c\u4ece\u800c\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u94fe\u8868\u8fc7\u957f\u4f1a\u5bfc\u81f4\u67e5\u8be2\u6548\u7387\u53d8\u4f4e\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u94fe\u8868\u8f6c\u5316\u4e3a AVL \u6811\u6216\u7ea2\u9ed1\u6811\u6765\u89e3\u51b3\u3002
  • \u5f00\u653e\u5bfb\u5740\u901a\u8fc7\u591a\u6b21\u63a2\u6d4b\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u7ebf\u6027\u63a2\u6d4b\u4f7f\u7528\u56fa\u5b9a\u6b65\u957f\uff0c\u7f3a\u70b9\u662f\u4e0d\u80fd\u5220\u9664\u5143\u7d20\u4e14\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\u3002\u591a\u6b21\u54c8\u5e0c\u4f7f\u7528\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u8fdb\u884c\u63a2\u6d4b\uff0c\u76f8\u5bf9\u7ebf\u6027\u63a2\u6d4b\u4e0d\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\uff0c\u4ee3\u4ef7\u662f\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u589e\u52a0\u4e86\u8ba1\u7b97\u91cf\u3002
  • \u5728\u5de5\u4e1a\u754c\u4e2d\uff0cJava \u7684 HashMap \u91c7\u7528\u94fe\u5f0f\u5730\u5740\u3001Python \u7684 Dict \u91c7\u7528\u5f00\u653e\u5bfb\u5740\u3002
"},{"location":"chapter_heap/build_heap/","title":"8.2. \u00a0 \u5efa\u5806\u64cd\u4f5c *","text":"

\u5982\u679c\u6211\u4eec\u60f3\u8981\u6839\u636e\u8f93\u5165\u5217\u8868\u6765\u751f\u6210\u4e00\u4e2a\u5806\uff0c\u8fd9\u6837\u7684\u64cd\u4f5c\u88ab\u79f0\u4e3a\u300c\u5efa\u5806\u300d\u3002

"},{"location":"chapter_heap/build_heap/#821","title":"8.2.1. \u00a0 \u4e24\u79cd\u5efa\u5806\u65b9\u6cd5","text":""},{"location":"chapter_heap/build_heap/#_1","title":"\u501f\u52a9\u5165\u5806\u65b9\u6cd5\u5b9e\u73b0","text":"

\u6700\u76f4\u63a5\u5730\uff0c\u8003\u8651\u501f\u52a9\u300c\u5143\u7d20\u5165\u5806\u300d\u65b9\u6cd5\uff0c\u5148\u5efa\u7acb\u4e00\u4e2a\u7a7a\u5806\uff0c\u518d\u5c06\u5217\u8868\u5143\u7d20\u4f9d\u6b21\u5165\u5806\u5373\u53ef\u3002

"},{"location":"chapter_heap/build_heap/#_2","title":"\u57fa\u4e8e\u5806\u5316\u64cd\u4f5c\u5b9e\u73b0","text":"

\u7136\u800c\uff0c\u5b58\u5728\u4e00\u79cd\u66f4\u52a0\u9ad8\u6548\u7684\u5efa\u5806\u65b9\u6cd5\u3002\u8bbe\u5143\u7d20\u6570\u91cf\u4e3a \\(n\\) \uff0c\u6211\u4eec\u5148\u5c06\u5217\u8868\u6240\u6709\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\uff0c\u7136\u540e\u8fed\u4ee3\u5730\u5bf9\u5404\u4e2a\u7ed3\u70b9\u6267\u884c\u300c\u4ece\u9876\u81f3\u5e95\u5806\u5316\u300d\u3002\u5f53\u7136\uff0c\u65e0\u9700\u5bf9\u53f6\u7ed3\u70b9\u6267\u884c\u5806\u5316\uff0c\u56e0\u4e3a\u5176\u6ca1\u6709\u5b50\u7ed3\u70b9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(List<Integer> nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = new ArrayList<>(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (int i = parent(size() - 1); i >= 0; i--) {\nsiftDown(i);\n}\n}\n
my_heap.cpp
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(vector<int> nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = nums;\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (int i = parent(size() - 1); i >= 0; i--) {\nsiftDown(i);\n}\n}\n
my_heap.py
def __init__(self, nums: List[int]):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nself.max_heap = nums\n# \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor i in range(self.parent(self.size() - 1), -1, -1):\nself.sift_down(i)\n
my_heap.go
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u5207\u7247\u5efa\u5806 */\nfunc newMaxHeap(nums []any) *maxHeap {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nh := &maxHeap{data: nums}\nfor i := len(h.data) - 1; i >= 0; i-- {\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nh.siftDown(i)\n}\nreturn h\n}\n
my_heap.js
/* \u6784\u9020\u65b9\u6cd5\uff0c\u5efa\u7acb\u7a7a\u5806\u6216\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nconstructor(nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nthis.#maxHeap = nums === undefined ? [] : [...nums];\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (let i = this.#parent(this.size() - 1); i >= 0; i--) {\nthis.#siftDown(i);\n}\n}\n
my_heap.ts
/* \u6784\u9020\u65b9\u6cd5\uff0c\u5efa\u7acb\u7a7a\u5806\u6216\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nconstructor(nums?: number[]) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nthis.maxHeap = nums === undefined ? [] : [...nums];\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (let i = this.parent(this.size() - 1); i >= 0; i--) {\nthis.siftDown(i);\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{newMaxHeap}\n
my_heap.cs
/* \u6784\u9020\u51fd\u6570\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(IEnumerable<int> nums)\n{\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = new List<int>(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nvar size = parent(this.size() - 1);\nfor (int i = size; i >= 0; i--)\n{\nsiftDown(i);\n}\n}\n
my_heap.swift
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\ninit(nums: [Int]) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = nums\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor i in stride(from: parent(i: size() - 1), through: 0, by: -1) {\nsiftDown(i: i)\n}\n}\n
my_heap.zig
// \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806\nfn init(self: *Self, allocator: std.mem.Allocator, nums: []const T) !void {\nif (self.maxHeap != null) return;\nself.maxHeap = std.ArrayList(T).init(allocator);\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\ntry self.maxHeap.?.appendSlice(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nvar i: usize = parent(self.size() - 1) + 1;\nwhile (i > 0) : (i -= 1) {\ntry self.siftDown(i - 1);\n}\n}\n
"},{"location":"chapter_heap/build_heap/#822","title":"8.2.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u5bf9\u4e8e\u7b2c\u4e00\u79cd\u5efa\u5806\u65b9\u6cd5\uff0c\u5143\u7d20\u5165\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u800c\u5e73\u5747\u957f\u5ea6\u4e3a \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u8be5\u65b9\u6cd5\u7684\u603b\u4f53\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \u3002

\u90a3\u4e48\uff0c\u7b2c\u4e8c\u79cd\u5efa\u5806\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u591a\u5c11\u5462\uff1f\u6211\u4eec\u6765\u5c55\u5f00\u63a8\u7b97\u4e00\u4e0b\u3002

  • \u5b8c\u5168\u4e8c\u53c9\u6811\u4e2d\uff0c\u8bbe\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u53f6\u7ed3\u70b9\u6570\u91cf\u4e3a \\((n + 1) / 2\\) \uff0c\u5176\u4e2d \\(/\\) \u4e3a\u5411\u4e0b\u6574\u9664\u3002\u56e0\u6b64\u5728\u6392\u9664\u53f6\u7ed3\u70b9\u540e\uff0c\u9700\u8981\u5806\u5316\u7ed3\u70b9\u6570\u91cf\u4e3a \\((n - 1)/2\\) \uff0c\u5373\u4e3a \\(O(n)\\) \uff1b
  • \u4ece\u9876\u81f3\u5e95\u5806\u5316\u4e2d\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u6700\u591a\u5806\u5316\u81f3\u53f6\u7ed3\u70b9\uff0c\u56e0\u6b64\u6700\u5927\u8fed\u4ee3\u6b21\u6570\u4e3a\u4e8c\u53c9\u6811\u9ad8\u5ea6 \\(O(\\log n)\\) \uff1b

\u5c06\u4e0a\u8ff0\u4e24\u8005\u76f8\u4e58\uff0c\u53ef\u5f97\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \u3002\u7136\u800c\uff0c\u8be5\u4f30\u7b97\u7ed3\u679c\u4ecd\u4e0d\u591f\u51c6\u786e\uff0c\u56e0\u4e3a\u6211\u4eec\u6ca1\u6709\u8003\u8651\u5230 \u4e8c\u53c9\u6811\u5e95\u5c42\u7ed3\u70b9\u8fdc\u591a\u4e8e\u9876\u5c42\u7ed3\u70b9 \u7684\u6027\u8d28\u3002

\u4e0b\u9762\u6211\u4eec\u6765\u5c1d\u8bd5\u5c55\u5f00\u8ba1\u7b97\u3002\u4e3a\u4e86\u51cf\u5c0f\u8ba1\u7b97\u96be\u5ea6\uff0c\u6211\u4eec\u5047\u8bbe\u6811\u662f\u4e00\u4e2a\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff0c\u8be5\u5047\u8bbe\u4e0d\u4f1a\u5f71\u54cd\u8ba1\u7b97\u7ed3\u679c\u7684\u6b63\u786e\u6027\u3002\u8bbe\u4e8c\u53c9\u6811\uff08\u5373\u5806\uff09\u7ed3\u70b9\u6570\u91cf\u4e3a \\(n\\) \uff0c\u6811\u9ad8\u5ea6\u4e3a \\(h\\) \u3002\u4e0a\u6587\u63d0\u5230\uff0c\u7ed3\u70b9\u5806\u5316\u6700\u5927\u8fed\u4ee3\u6b21\u6570\u7b49\u4e8e\u8be5\u7ed3\u70b9\u5230\u53f6\u7ed3\u70b9\u7684\u8ddd\u79bb\uff0c\u800c\u8fd9\u6b63\u662f\u201c\u7ed3\u70b9\u9ad8\u5ea6\u201d\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5c06\u5404\u5c42\u7684\u201c\u7ed3\u70b9\u6570\u91cf \\(\\times\\) \u7ed3\u70b9\u9ad8\u5ea6\u201d\u6c42\u548c\uff0c\u5373\u53ef\u5f97\u5230\u6240\u6709\u7ed3\u70b9\u7684\u5806\u5316\u7684\u8fed\u4ee3\u6b21\u6570\u603b\u548c\u3002

\\[ T(h) = 2^0h + 2^1(h-1) + 2^2(h-2) + \\cdots + 2^{(h-1)}\\times1 \\]

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u5404\u5c42\u7ed3\u70b9\u6570\u91cf

\u5316\u7b80\u4e0a\u5f0f\u9700\u8981\u501f\u52a9\u4e2d\u5b66\u7684\u6570\u5217\u77e5\u8bc6\uff0c\u5148\u5bf9 \\(T(h)\\) \u4e58\u4ee5 \\(2\\) \uff0c\u6613\u5f97

\\[ \\begin{aligned} T(h) & = 2^0h + 2^1(h-1) + 2^2(h-2) + \\cdots + 2^{h-1}\\times1 \\newline 2 T(h) & = 2^1h + 2^2(h-1) + 2^3(h-2) + \\cdots + 2^{h}\\times1 \\newline \\end{aligned} \\]

\u4f7f\u7528\u9519\u4f4d\u76f8\u51cf\u6cd5\uff0c\u4ee4\u4e0b\u5f0f \\(2 T(h)\\) \u51cf\u53bb\u4e0a\u5f0f \\(T(h)\\) \uff0c\u53ef\u5f97

\\[ 2T(h) - T(h) = T(h) = -2^0h + 2^1 + 2^2 + \\cdots + 2^{h-1} + 2^h \\]

\u89c2\u5bdf\u4e0a\u5f0f\uff0c\\(T(h)\\) \u662f\u4e00\u4e2a\u7b49\u6bd4\u6570\u5217\uff0c\u53ef\u76f4\u63a5\u4f7f\u7528\u6c42\u548c\u516c\u5f0f\uff0c\u5f97\u5230\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a

\\[ \\begin{aligned} T(h) & = 2 \\frac{1 - 2^h}{1 - 2} - h \\newline & = 2^{h+1} - h \\newline & = O(2^h) \\end{aligned} \\]

\u8fdb\u4e00\u6b65\u5730\uff0c\u9ad8\u5ea6\u4e3a \\(h\\) \u7684\u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u7ed3\u70b9\u6570\u91cf\u4e3a \\(n = 2^{h+1} - 1\\) \uff0c\u6613\u5f97\u590d\u6742\u5ea6\u4e3a \\(O(2^h) = O(n)\\)\u3002\u4ee5\u4e0a\u63a8\u7b97\u8868\u660e\uff0c\u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002

"},{"location":"chapter_heap/heap/","title":"8.1. \u00a0 \u5806","text":"

\u300c\u5806 Heap\u300d\u662f\u4e00\u68f5\u9650\u5b9a\u6761\u4ef6\u4e0b\u7684\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u3002\u6839\u636e\u6210\u7acb\u6761\u4ef6\uff0c\u5806\u4e3b\u8981\u5206\u4e3a\u4e24\u79cd\u7c7b\u578b\uff1a

  • \u300c\u5927\u9876\u5806 Max Heap\u300d\uff0c\u4efb\u610f\u7ed3\u70b9\u7684\u503c \\(\\geq\\) \u5176\u5b50\u7ed3\u70b9\u7684\u503c\uff1b
  • \u300c\u5c0f\u9876\u5806 Min Heap\u300d\uff0c\u4efb\u610f\u7ed3\u70b9\u7684\u503c \\(\\leq\\) \u5176\u5b50\u7ed3\u70b9\u7684\u503c\uff1b

Fig. \u5c0f\u9876\u5806\u4e0e\u5927\u9876\u5806

"},{"location":"chapter_heap/heap/#811","title":"8.1.1. \u00a0 \u5806\u672f\u8bed\u4e0e\u6027\u8d28","text":"
  • \u7531\u4e8e\u5806\u662f\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u56e0\u6b64\u6700\u5e95\u5c42\u7ed3\u70b9\u9760\u5de6\u586b\u5145\uff0c\u5176\u5b83\u5c42\u7ed3\u70b9\u7686\u88ab\u586b\u6ee1\u3002
  • \u4e8c\u53c9\u6811\u4e2d\u7684\u6839\u7ed3\u70b9\u5bf9\u5e94\u300c\u5806\u9876\u300d\uff0c\u5e95\u5c42\u6700\u9760\u53f3\u7ed3\u70b9\u5bf9\u5e94\u300c\u5806\u5e95\u300d\u3002
  • \u5bf9\u4e8e\u5927\u9876\u5806 / \u5c0f\u9876\u5806\uff0c\u5176\u5806\u9876\u5143\u7d20\uff08\u5373\u6839\u7ed3\u70b9\uff09\u7684\u503c\u6700\u5927 / \u6700\u5c0f\u3002
"},{"location":"chapter_heap/heap/#812","title":"8.1.2. \u00a0 \u5806\u5e38\u7528\u64cd\u4f5c","text":"

\u503c\u5f97\u8bf4\u660e\u7684\u662f\uff0c\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u63d0\u4f9b\u7684\u662f\u300c\u4f18\u5148\u961f\u5217 Priority Queue\u300d\uff0c\u5176\u662f\u4e00\u79cd\u62bd\u8c61\u6570\u636e\u7ed3\u6784\uff0c\u5b9a\u4e49\u4e3a\u5177\u6709\u51fa\u961f\u4f18\u5148\u7ea7\u7684\u961f\u5217\u3002

\u800c\u6070\u597d\uff0c\u5806\u7684\u5b9a\u4e49\u4e0e\u4f18\u5148\u961f\u5217\u7684\u64cd\u4f5c\u903b\u8f91\u5b8c\u5168\u543b\u5408\uff0c\u5927\u9876\u5806\u5c31\u662f\u4e00\u4e2a\u5143\u7d20\u4ece\u5927\u5230\u5c0f\u51fa\u961f\u7684\u4f18\u5148\u961f\u5217\u3002\u4ece\u4f7f\u7528\u89d2\u5ea6\u770b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u300c\u4f18\u5148\u961f\u5217\u300d\u548c\u300c\u5806\u300d\u7406\u89e3\u4e3a\u7b49\u4ef7\u7684\u6570\u636e\u7ed3\u6784\u3002\u56e0\u6b64\uff0c\u672c\u6587\u4e0e\u4ee3\u7801\u5bf9\u4e24\u8005\u4e0d\u505a\u7279\u522b\u533a\u5206\uff0c\u7edf\u4e00\u4f7f\u7528\u300c\u5806\u300d\u6765\u547d\u540d\u3002

\u5806\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff08\u65b9\u6cd5\u547d\u540d\u4ee5 Java \u4e3a\u4f8b\uff09\u3002

\u65b9\u6cd5 \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 add() \u5143\u7d20\u5165\u5806 \\(O(\\log n)\\) poll() \u5806\u9876\u5143\u7d20\u51fa\u5806 \\(O(\\log n)\\) peek() \u8bbf\u95ee\u5806\u9876\u5143\u7d20\uff08\u5927 / \u5c0f\u9876\u5806\u5206\u522b\u4e3a\u6700\u5927 / \u5c0f\u503c\uff09 \\(O(1)\\) size() \u83b7\u53d6\u5806\u7684\u5143\u7d20\u6570\u91cf \\(O(1)\\) isEmpty() \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u63d0\u4f9b\u7684\u5806\u7c7b\uff08\u6216\u4f18\u5148\u961f\u5217\u7c7b\uff09\u3002

Tip

\u7c7b\u4f3c\u4e8e\u6392\u5e8f\u4e2d\u201c\u4ece\u5c0f\u5230\u5927\u6392\u5217\u201d\u548c\u201c\u4ece\u5927\u5230\u5c0f\u6392\u5217\u201d\uff0c\u201c\u5927\u9876\u5806\u201d\u548c\u201c\u5c0f\u9876\u5806\u201d\u53ef\u4ec5\u901a\u8fc7\u4fee\u6539 Comparator \u6765\u4e92\u76f8\u8f6c\u6362\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig heap.java
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\nQueue<Integer> minHeap = new PriorityQueue<>();\n// \u521d\u59cb\u5316\u5927\u9876\u5806\uff08\u4f7f\u7528 lambda \u8868\u8fbe\u5f0f\u4fee\u6539 Comparator \u5373\u53ef\uff09\nQueue<Integer> maxHeap = new PriorityQueue<>((a, b) -> b - a);\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.add(1);\nmaxHeap.add(3);\nmaxHeap.add(2);\nmaxHeap.add(5);\nmaxHeap.add(4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.peek(); // 5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\npeek = heap.poll();  // 5\npeek = heap.poll();  // 4\npeek = heap.poll();  // 3\npeek = heap.poll();  // 2\npeek = heap.poll();  // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.size();\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = maxHeap.isEmpty();\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nminHeap = new PriorityQueue<>(Arrays.asList(1, 3, 2, 5, 4));\n
heap.cpp
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\npriority_queue<int, vector<int>, greater<int>> minHeap;\n// \u521d\u59cb\u5316\u5927\u9876\u5806\npriority_queue<int, vector<int>, less<int>> maxHeap;\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.push(1);\nmaxHeap.push(3);\nmaxHeap.push(2);\nmaxHeap.push(5);\nmaxHeap.push(4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.top(); // 5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\nmaxHeap.pop(); // 5\nmaxHeap.pop(); // 4\nmaxHeap.pop(); // 3\nmaxHeap.pop(); // 2\nmaxHeap.pop(); // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.size();\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = maxHeap.empty();\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nvector<int> input{1, 3, 2, 5, 4};\npriority_queue<int, vector<int>, greater<int>> minHeap(input.begin(), input.end());\n
heap.py
# \u521d\u59cb\u5316\u5c0f\u9876\u5806\nmin_heap, flag = [], 1\n# \u521d\u59cb\u5316\u5927\u9876\u5806\nmax_heap, flag = [], -1\n# Python \u7684 heapq \u6a21\u5757\u9ed8\u8ba4\u5b9e\u73b0\u5c0f\u9876\u5806\n# \u8003\u8651\u5c06\u201c\u5143\u7d20\u53d6\u8d1f\u201d\u540e\u518d\u5165\u5806\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5c06\u5927\u5c0f\u5173\u7cfb\u98a0\u5012\uff0c\u4ece\u800c\u5b9e\u73b0\u5927\u9876\u5806\n# \u5728\u672c\u793a\u4f8b\u4e2d\uff0cflag = 1 \u65f6\u5bf9\u5e94\u5c0f\u9876\u5806\uff0cflag = -1 \u65f6\u5bf9\u5e94\u5927\u9876\u5806\n\"\"\" \u5143\u7d20\u5165\u5806 \"\"\"\nheapq.heappush(max_heap, flag * 1)\nheapq.heappush(max_heap, flag * 3)\nheapq.heappush(max_heap, flag * 2)\nheapq.heappush(max_heap, flag * 5)\nheapq.heappush(max_heap, flag * 4)\n\"\"\" \u83b7\u53d6\u5806\u9876\u5143\u7d20 \"\"\"\npeek: int = flag * max_heap[0] # 5\n\"\"\" \u5806\u9876\u5143\u7d20\u51fa\u5806 \"\"\"\n# \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\nval = flag * heapq.heappop(max_heap) # 5\nval = flag * heapq.heappop(max_heap) # 4\nval = flag * heapq.heappop(max_heap) # 3\nval = flag * heapq.heappop(max_heap) # 2\nval = flag * heapq.heappop(max_heap) # 1\n\"\"\" \u83b7\u53d6\u5806\u5927\u5c0f \"\"\"\nsize: int = len(max_heap)\n\"\"\" \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = not max_heap\n\"\"\" \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 \"\"\"\nmin_heap: List[int] = [1, 3, 2, 5, 4]\nheapq.heapify(min_heap)\n
heap.go
// Go \u8bed\u8a00\u4e2d\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 heap.Interface \u6765\u6784\u5efa\u6574\u6570\u5927\u9876\u5806\n// \u5b9e\u73b0 heap.Interface \u9700\u8981\u540c\u65f6\u5b9e\u73b0 sort.Interface\ntype intHeap []any\n// Push heap.Interface \u7684\u65b9\u6cd5\uff0c\u5b9e\u73b0\u63a8\u5165\u5143\u7d20\u5230\u5806\nfunc (h *intHeap) Push(x any) {\n// Push \u548c Pop \u4f7f\u7528 pointer receiver \u4f5c\u4e3a\u53c2\u6570\n// \u56e0\u4e3a\u5b83\u4eec\u4e0d\u4ec5\u4f1a\u5bf9\u5207\u7247\u7684\u5185\u5bb9\u8fdb\u884c\u8c03\u6574\uff0c\u8fd8\u4f1a\u4fee\u6539\u5207\u7247\u7684\u957f\u5ea6\u3002\n*h = append(*h, x.(int))\n}\n// Pop heap.Interface \u7684\u65b9\u6cd5\uff0c\u5b9e\u73b0\u5f39\u51fa\u5806\u9876\u5143\u7d20\nfunc (h *intHeap) Pop() any {\n// \u5f85\u51fa\u5806\u5143\u7d20\u5b58\u653e\u5728\u6700\u540e\nlast := (*h)[len(*h)-1]\n*h = (*h)[:len(*h)-1]\nreturn last\n}\n// Len sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Len() int {\nreturn len(*h)\n}\n// Less sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Less(i, j int) bool {\n// \u5982\u679c\u5b9e\u73b0\u5c0f\u9876\u5806\uff0c\u5219\u9700\u8981\u8c03\u6574\u4e3a\u5c0f\u4e8e\u53f7\nreturn (*h)[i].(int) > (*h)[j].(int)\n}\n// Swap sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Swap(i, j int) {\n(*h)[i], (*h)[j] = (*h)[j], (*h)[i]\n}\n// Top \u83b7\u53d6\u5806\u9876\u5143\u7d20\nfunc (h *intHeap) Top() any {\nreturn (*h)[0]\n}\n/* Driver Code */\nfunc TestHeap(t *testing.T) {\n/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5927\u9876\u5806\nmaxHeap := &intHeap{}\nheap.Init(maxHeap)\n/* \u5143\u7d20\u5165\u5806 */\n// \u8c03\u7528 heap.Interface \u7684\u65b9\u6cd5\uff0c\u6765\u6dfb\u52a0\u5143\u7d20\nheap.Push(maxHeap, 1)\nheap.Push(maxHeap, 3)\nheap.Push(maxHeap, 2)\nheap.Push(maxHeap, 4)\nheap.Push(maxHeap, 5)\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\ntop := maxHeap.Top()\nfmt.Printf(\"\u5806\u9876\u5143\u7d20\u4e3a %d\\n\", top)\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u8c03\u7528 heap.Interface \u7684\u65b9\u6cd5\uff0c\u6765\u79fb\u9664\u5143\u7d20\nheap.Pop(maxHeap)\nheap.Pop(maxHeap)\nheap.Pop(maxHeap)\nheap.Pop(maxHeap)\nheap.Pop(maxHeap)\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nsize := len(*maxHeap)\nfmt.Printf(\"\u5806\u5143\u7d20\u6570\u91cf\u4e3a %d\\n\", size)\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nisEmpty := len(*maxHeap) == 0\nfmt.Printf(\"\u5806\u662f\u5426\u4e3a\u7a7a %t\\n\", isEmpty)\n}\n
heap.js
// JavaScript \u672a\u63d0\u4f9b\u5185\u7f6e heap \u7c7b\n
heap.ts
// TypeScript \u672a\u63d0\u4f9b\u5185\u7f6e\u5806 Heap \u7c7b\n
heap.c
\n
heap.cs
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\nPriorityQueue<int, int> minHeap = new PriorityQueue<int, int>();\n// \u521d\u59cb\u5316\u5927\u9876\u5806\uff08\u4f7f\u7528 lambda \u8868\u8fbe\u5f0f\u4fee\u6539 Comparator \u5373\u53ef\uff09\nPriorityQueue<int, int> maxHeap = new PriorityQueue<int, int>(Comparer<int>.Create((x, y) => y - x));\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.Enqueue(1, 1);\nmaxHeap.Enqueue(3, 3);\nmaxHeap.Enqueue(2, 2);\nmaxHeap.Enqueue(5, 5);\nmaxHeap.Enqueue(4, 4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.Peek();//5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\npeek = maxHeap.Dequeue();  // 5\npeek = maxHeap.Dequeue();  // 4\npeek = maxHeap.Dequeue();  // 3\npeek = maxHeap.Dequeue();  // 2\npeek = maxHeap.Dequeue();  // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.Count;\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = maxHeap.Count == 0;\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nminHeap = new PriorityQueue<int, int>(new List<(int, int)> { (1, 1), (3, 3), (2, 2), (5, 5), (4, 4), });\n
heap.swift
// Swift \u672a\u63d0\u4f9b\u5185\u7f6e heap \u7c7b\n
heap.zig
\n
"},{"location":"chapter_heap/heap/#813","title":"8.1.3. \u00a0 \u5806\u7684\u5b9e\u73b0","text":"

\u4e0b\u6587\u5b9e\u73b0\u7684\u662f\u300c\u5927\u9876\u5806\u300d\uff0c\u82e5\u60f3\u8f6c\u6362\u4e3a\u300c\u5c0f\u9876\u5806\u300d\uff0c\u5c06\u6240\u6709\u5927\u5c0f\u903b\u8f91\u5224\u65ad\u53d6\u9006\uff08\u4f8b\u5982\u5c06 \\(\\geq\\) \u66ff\u6362\u4e3a \\(\\leq\\) \uff09\u5373\u53ef\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_heap/heap/#_1","title":"\u5806\u7684\u5b58\u50a8\u4e0e\u8868\u793a","text":"

\u5728\u4e8c\u53c9\u6811\u7ae0\u8282\u6211\u4eec\u5b66\u8fc7\uff0c\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u975e\u5e38\u9002\u5408\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u6765\u8868\u793a\uff0c\u800c\u5806\u6070\u597d\u662f\u4e00\u68f5\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u56e0\u800c\u6211\u4eec\u91c7\u7528\u300c\u6570\u7ec4\u300d\u6765\u5b58\u50a8\u300c\u5806\u300d\u3002

\u4e8c\u53c9\u6811\u6307\u9488\u3002\u4f7f\u7528\u6570\u7ec4\u8868\u793a\u4e8c\u53c9\u6811\u65f6\uff0c\u5143\u7d20\u4ee3\u8868\u7ed3\u70b9\u503c\uff0c\u7d22\u5f15\u4ee3\u8868\u7ed3\u70b9\u5728\u4e8c\u53c9\u6811\u4e2d\u7684\u4f4d\u7f6e\uff0c\u800c\u7ed3\u70b9\u6307\u9488\u901a\u8fc7\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u6765\u5b9e\u73b0\u3002

\u5177\u4f53\u5730\uff0c\u7ed9\u5b9a\u7d22\u5f15 \\(i\\) \uff0c\u90a3\u4e48\u5176\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 1\\) \u3001\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 2\\) \u3001\u7236\u7ed3\u70b9\u7d22\u5f15\u4e3a \\((i - 1) / 2\\) \uff08\u5411\u4e0b\u6574\u9664\uff09\u3002\u5f53\u7d22\u5f15\u8d8a\u754c\u65f6\uff0c\u4ee3\u8868\u7a7a\u7ed3\u70b9\u6216\u7ed3\u70b9\u4e0d\u5b58\u5728\u3002

Fig. \u5806\u7684\u8868\u793a\u4e0e\u5b58\u50a8

\u6211\u4eec\u5c06\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u5c01\u88c5\u6210\u51fd\u6570\uff0c\u4ee5\u4fbf\u540e\u7eed\u4f7f\u7528\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i) {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i) {\nreturn (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.cpp
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i) {\nreturn 2 * i + 2;\n} /* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i) {\nreturn (i - 1) / 2; // \u5411\u4e0b\u53d6\u6574\n}\n
my_heap.py
def left(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn 2 * i + 1\ndef right(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn 2 * i + 2\ndef parent(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn (i - 1) // 2  # \u5411\u4e0b\u6574\u9664\n
my_heap.go
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) left(i int) int {\nreturn 2*i + 1\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) right(i int) int {\nreturn 2*i + 2\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) parent(i int) int {\n// \u5411\u4e0b\u6574\u9664\nreturn (i - 1) / 2\n}\n
my_heap.js
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\n#left(i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\n#right(i) {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\n#parent(i) {\nreturn Math.floor((i - 1) / 2); // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.ts
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nleft(i: number): number {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nright(i: number): number {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nparent(i: number): number {\nreturn Math.floor((i - 1) / 2); // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.c
[class]{maxHeap}-[func]{left}\n[class]{maxHeap}-[func]{right}\n[class]{maxHeap}-[func]{parent}\n
my_heap.cs
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i)\n{\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i)\n{\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i)\n{\nreturn (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.swift
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc left(i: Int) -> Int {\n2 * i + 1\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc right(i: Int) -> Int {\n2 * i + 2\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nfunc parent(i: Int) -> Int {\n(i - 1) / 2 // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.zig
// \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\nfn left(i: usize) usize {\nreturn 2 * i + 1;\n}\n// \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\nfn right(i: usize) usize {\nreturn 2 * i + 2;\n}\n// \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15\nfn parent(i: usize) usize {\n// return (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\nreturn @divFloor(i - 1, 2);\n}\n
"},{"location":"chapter_heap/heap/#_2","title":"\u8bbf\u95ee\u5806\u9876\u5143\u7d20","text":"

\u5806\u9876\u5143\u7d20\u662f\u4e8c\u53c9\u6811\u7684\u6839\u7ed3\u70b9\uff0c\u5373\u5217\u8868\u9996\u5143\u7d20\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek() {\nreturn maxHeap.get(0);\n}\n
my_heap.cpp
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek() {\nreturn maxHeap[0];\n}\n
my_heap.py
def peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u5806\u9876\u5143\u7d20 \"\"\"\nreturn self.max_heap[0]\n
my_heap.go
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nfunc (h *maxHeap) peek() any {\nreturn h.data[0]\n}\n
my_heap.js
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\npeek() {\nreturn this.#maxHeap[0];\n}\n
my_heap.ts
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\npeek(): number {\nreturn this.maxHeap[0];\n}\n
my_heap.c
[class]{maxHeap}-[func]{peek}\n
my_heap.cs
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek()\n{\nreturn maxHeap[0];\n}\n
my_heap.swift
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nmaxHeap[0]\n}\n
my_heap.zig
// \u8bbf\u95ee\u5806\u9876\u5143\u7d20\nfn peek(self: *Self) T {\nreturn self.maxHeap.?.items[0];\n}  
"},{"location":"chapter_heap/heap/#_3","title":"\u5143\u7d20\u5165\u5806","text":"

\u7ed9\u5b9a\u5143\u7d20 val \uff0c\u6211\u4eec\u5148\u5c06\u5176\u6dfb\u52a0\u5230\u5806\u5e95\u3002\u6dfb\u52a0\u540e\uff0c\u7531\u4e8e val \u53ef\u80fd\u5927\u4e8e\u5806\u4e2d\u5176\u5b83\u5143\u7d20\uff0c\u6b64\u65f6\u5806\u7684\u6210\u7acb\u6761\u4ef6\u53ef\u80fd\u5df2\u7ecf\u88ab\u7834\u574f\uff0c\u56e0\u6b64\u9700\u8981\u4fee\u590d\u4ece\u63d2\u5165\u7ed3\u70b9\u5230\u6839\u7ed3\u70b9\u8fd9\u6761\u8def\u5f84\u4e0a\u7684\u5404\u4e2a\u7ed3\u70b9\uff0c\u8be5\u64cd\u4f5c\u88ab\u79f0\u4e3a\u300c\u5806\u5316 Heapify\u300d\u3002

\u8003\u8651\u4ece\u5165\u5806\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u6267\u884c\u5806\u5316\u3002\u5177\u4f53\u5730\uff0c\u6bd4\u8f83\u63d2\u5165\u7ed3\u70b9\u4e0e\u5176\u7236\u7ed3\u70b9\u7684\u503c\uff0c\u82e5\u63d2\u5165\u7ed3\u70b9\u66f4\u5927\u5219\u5c06\u5b83\u4eec\u4ea4\u6362\uff1b\u5e76\u5faa\u73af\u4ee5\u4e0a\u64cd\u4f5c\uff0c\u4ece\u5e95\u81f3\u9876\u5730\u4fee\u590d\u5806\u4e2d\u7684\u5404\u4e2a\u7ed3\u70b9\uff1b\u76f4\u81f3\u8d8a\u8fc7\u6839\u7ed3\u70b9\u65f6\u7ed3\u675f\uff0c\u6216\u5f53\u9047\u5230\u65e0\u9700\u4ea4\u6362\u7684\u7ed3\u70b9\u65f6\u63d0\u524d\u7ed3\u675f\u3002

<1><2><3><4><5><6>

\u8bbe\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u6811\u7684\u9ad8\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u6613\u5f97\u5806\u5316\u64cd\u4f5c\u7684\u5faa\u73af\u8f6e\u6570\u6700\u591a\u4e3a \\(O(\\log n)\\) \uff0c\u56e0\u800c\u5143\u7d20\u5165\u5806\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.add(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p = parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap.get(i) <= maxHeap.get(p))\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.cpp
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.push_back(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p =  parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap[i] <= maxHeap[p])\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(maxHeap[i], maxHeap[p]);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.py
def push(self, val: int):\n\"\"\" \u5143\u7d20\u5165\u5806 \"\"\"\n# \u6dfb\u52a0\u7ed3\u70b9\nself.max_heap.append(val)\n# \u4ece\u5e95\u81f3\u9876\u5806\u5316\nself.sift_up(self.size() - 1)\ndef sift_up(self, i: int):\n\"\"\" \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 \"\"\"\nwhile True:\n# \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\np = self.parent(i)\n# \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 or self.max_heap[i] <= self.max_heap[p]:\nbreak\n# \u4ea4\u6362\u4e24\u7ed3\u70b9\nself.swap(i, p)\n# \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n
my_heap.go
/* \u5143\u7d20\u5165\u5806 */\nfunc (h *maxHeap) push(val any) {\n// \u6dfb\u52a0\u7ed3\u70b9\nh.data = append(h.data, val)\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nh.siftUp(len(h.data) - 1)\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nfunc (h *maxHeap) siftUp(i int) {\nfor true {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\np := h.parent(i)\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 || h.data[i].(int) <= h.data[p].(int) {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nh.swap(i, p)\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n}\n}\n
my_heap.js
/* \u5143\u7d20\u5165\u5806 */\npush(val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nthis.#maxHeap.push(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nthis.#siftUp(this.size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\n#siftUp(i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nconst p = this.#parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || this.#maxHeap[i] <= this.#maxHeap[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.#swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.ts
/* \u5143\u7d20\u5165\u5806 */\npush(val: number): void {\n// \u6dfb\u52a0\u7ed3\u70b9\nthis.maxHeap.push(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nthis.siftUp(this.size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nsiftUp(i: number): void {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nconst p = this.parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || this.maxHeap[i] <= this.maxHeap[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{push}\n[class]{maxHeap}-[func]{siftUp}\n
my_heap.cs
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val)\n{\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.Add(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i)\n{\nwhile (true)\n{\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p = parent(i);\n// \u82e5\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\uff0c\u5219\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap[i] <= maxHeap[p])\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.swift
/* \u5143\u7d20\u5165\u5806 */\nfunc push(val: Int) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.append(val)\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(i: size() - 1)\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nfunc siftUp(i: Int) {\nvar i = i\nwhile true {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nlet p = parent(i: i)\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 || maxHeap[i] <= maxHeap[p] {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i: i, j: p)\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n}\n}\n
my_heap.zig
// \u5143\u7d20\u5165\u5806\nfn push(self: *Self, val: T) !void {\n// \u6dfb\u52a0\u7ed3\u70b9\ntry self.maxHeap.?.append(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\ntry self.siftUp(self.size() - 1);\n}  // \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316\nfn siftUp(self: *Self, i_: usize) !void {\nvar i = i_;\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nvar p = parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 or self.maxHeap.?.items[i] <= self.maxHeap.?.items[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\ntry self.swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
"},{"location":"chapter_heap/heap/#_4","title":"\u5806\u9876\u5143\u7d20\u51fa\u5806","text":"

\u5806\u9876\u5143\u7d20\u662f\u4e8c\u53c9\u6811\u6839\u7ed3\u70b9\uff0c\u5373\u5217\u8868\u9996\u5143\u7d20\uff0c\u5982\u679c\u6211\u4eec\u76f4\u63a5\u5c06\u9996\u5143\u7d20\u4ece\u5217\u8868\u4e2d\u5220\u9664\uff0c\u5219\u4e8c\u53c9\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u90fd\u4f1a\u968f\u4e4b\u53d1\u751f\u79fb\u4f4d\uff08\u7d22\u5f15\u53d1\u751f\u53d8\u5316\uff09\uff0c\u8fd9\u6837\u540e\u7eed\u4f7f\u7528\u5806\u5316\u4fee\u590d\u5c31\u5f88\u9ebb\u70e6\u4e86\u3002\u4e3a\u4e86\u5c3d\u91cf\u51cf\u5c11\u5143\u7d20\u7d22\u5f15\u53d8\u52a8\uff0c\u91c7\u53d6\u4ee5\u4e0b\u64cd\u4f5c\u6b65\u9aa4\uff1a

  1. \u4ea4\u6362\u5806\u9876\u5143\u7d20\u4e0e\u5806\u5e95\u5143\u7d20\uff08\u5373\u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff09\uff1b
  2. \u4ea4\u6362\u5b8c\u6210\u540e\uff0c\u5c06\u5806\u5e95\u4ece\u5217\u8868\u4e2d\u5220\u9664\uff08\u6ce8\u610f\uff0c\u56e0\u4e3a\u5df2\u7ecf\u4ea4\u6362\uff0c\u5b9e\u9645\u4e0a\u5220\u9664\u7684\u662f\u539f\u6765\u7684\u5806\u9876\u5143\u7d20\uff09\uff1b
  3. \u4ece\u6839\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u6267\u884c\u5806\u5316\uff1b

\u987e\u540d\u601d\u4e49\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316\u7684\u64cd\u4f5c\u65b9\u5411\u4e0e\u4ece\u5e95\u81f3\u9876\u5806\u5316\u76f8\u53cd\uff0c\u6211\u4eec\u6bd4\u8f83\u6839\u7ed3\u70b9\u7684\u503c\u4e0e\u5176\u4e24\u4e2a\u5b50\u7ed3\u70b9\u7684\u503c\uff0c\u5c06\u6700\u5927\u7684\u5b50\u7ed3\u70b9\u4e0e\u6839\u7ed3\u70b9\u6267\u884c\u4ea4\u6362\uff0c\u5e76\u5faa\u73af\u4ee5\u4e0a\u64cd\u4f5c\uff0c\u76f4\u5230\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u65f6\u7ed3\u675f\uff0c\u6216\u5f53\u9047\u5230\u65e0\u9700\u4ea4\u6362\u7684\u7ed3\u70b9\u65f6\u63d0\u524d\u7ed3\u675f\u3002

<1><2><3><4><5><6><7><8><9><10>

\u4e0e\u5143\u7d20\u5165\u5806\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u5806\u9876\u5143\u7d20\u51fa\u5806\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u5143\u7d20\u51fa\u5806 */\nint poll() {\n// \u5224\u7a7a\u5904\u7406\nif (isEmpty())\nthrow new EmptyStackException();\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(0, size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nint val = maxHeap.remove(size() - 1);\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\nif (l < size() && maxHeap.get(l) > maxHeap.get(ma))\nma = l;\nif (r < size() && maxHeap.get(r) > maxHeap.get(ma))\nma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.cpp
/* \u5143\u7d20\u51fa\u5806 */\nvoid poll() {\n// \u5224\u7a7a\u5904\u7406\nif (empty()) {\nthrow out_of_range(\"\u5806\u4e3a\u7a7a\");\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(maxHeap[0], maxHeap[size() - 1]);\n// \u5220\u9664\u7ed3\u70b9\nmaxHeap.pop_back();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (l < size() && maxHeap[l] > maxHeap[ma]) ma = l;\nif (r < size() && maxHeap[r] > maxHeap[ma])\nma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\nswap(maxHeap[i], maxHeap[ma]);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.py
def poll(self) -> int:\n\"\"\" \u5143\u7d20\u51fa\u5806 \"\"\"\n# \u5224\u7a7a\u5904\u7406\nassert not self.is_empty()\n# \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nself.swap(0, self.size() - 1)\n# \u5220\u9664\u7ed3\u70b9\nval = self.max_heap.pop()\n# \u4ece\u9876\u81f3\u5e95\u5806\u5316\nself.sift_down(0)\n# \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\ndef sift_down(self, i: int):\n\"\"\" \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 \"\"\"\nwhile True:\n# \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nl, r, ma = self.left(i), self.right(i), i\nif l < self.size() and self.max_heap[l] > self.max_heap[ma]:\nma = l\nif r < self.size() and self.max_heap[r] > self.max_heap[ma]:\nma = r\n# \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif ma == i:\nbreak\n# \u4ea4\u6362\u4e24\u7ed3\u70b9\nself.swap(i, ma)\n# \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma\n
my_heap.go
/* \u5143\u7d20\u51fa\u5806 */\nfunc (h *maxHeap) poll() any {\n// \u5224\u7a7a\u5904\u7406\nif h.isEmpty() {\nfmt.Println(\"error\")\nreturn nil\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nh.swap(0, h.size()-1)\n// \u5220\u9664\u7ed3\u70b9\nval := h.data[len(h.data)-1]\nh.data = h.data[:len(h.data)-1]\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nh.siftDown(0)\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nfunc (h *maxHeap) siftDown(i int) {\nfor true {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a max\nl, r, max := h.left(i), h.right(i), i\nif l < h.size() && h.data[l].(int) > h.data[max].(int) {\nmax = l\n}\nif r < h.size() && h.data[r].(int) > h.data[max].(int) {\nmax = r\n}\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif max == i {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nh.swap(i, max)\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = max\n}\n}\n
my_heap.js
/* \u5143\u7d20\u51fa\u5806 */\npoll() {\n// \u5224\u7a7a\u5904\u7406\nif (this.isEmpty()) throw new Error(\"\u5806\u4e3a\u7a7a\");\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nthis.#swap(0, this.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nconst val = this.#maxHeap.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nthis.#siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\n#siftDown(i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nconst l = this.#left(i),\nr = this.#right(i);\nlet ma = i;\nif (l < this.size() && this.#maxHeap[l] > this.#maxHeap[ma]) ma = l;\nif (r < this.size() && this.#maxHeap[r] > this.#maxHeap[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.#swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.ts
/* \u5143\u7d20\u51fa\u5806 */\npoll(): number {\n// \u5224\u7a7a\u5904\u7406\nif (this.isEmpty()) throw new RangeError('Heap is empty.');\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nthis.swap(0, this.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nconst val = this.maxHeap.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nthis.siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nsiftDown(i: number): void {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nconst l = this.left(i),\nr = this.right(i);\nlet ma = i;\nif (l < this.size() && this.maxHeap[l] > this.maxHeap[ma]) ma = l;\nif (r < this.size() && this.maxHeap[r] > this.maxHeap[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{poll}\n[class]{maxHeap}-[func]{siftDown}\n
my_heap.cs
/* \u5143\u7d20\u51fa\u5806 */\nint poll()\n{\n// \u5224\u7a7a\u5904\u7406\nif (isEmpty())\nthrow new IndexOutOfRangeException();\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(0, size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nint val = maxHeap.Last();\nmaxHeap.RemoveAt(size() - 1);\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i)\n{\nwhile (true)\n{\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\nif (l < size() && maxHeap[l] > maxHeap[ma])\nma = l;\nif (r < size() && maxHeap[r] > maxHeap[ma])\nma = r;\n// \u82e5\u201c\u7ed3\u70b9 i \u6700\u5927\u201d\u6216\u201c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u201d\uff0c\u5219\u7ed3\u675f\u5806\u5316\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.swift
/* \u5143\u7d20\u51fa\u5806 */\nfunc poll() -> Int {\n// \u5224\u7a7a\u5904\u7406\nif isEmpty() {\nfatalError(\"\u5806\u4e3a\u7a7a\")\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(i: 0, j: size() - 1)\n// \u5220\u9664\u7ed3\u70b9\nlet val = maxHeap.remove(at: size() - 1)\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(i: 0)\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nfunc siftDown(i: Int) {\nvar i = i\nwhile true {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nlet l = left(i: i)\nlet r = right(i: i)\nvar ma = i\nif l < size(), maxHeap[l] > maxHeap[ma] {\nma = l\n}\nif r < size(), maxHeap[r] > maxHeap[ma] {\nma = r\n}\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif ma == i {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i: i, j: ma)\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma\n}\n}\n
my_heap.zig
// \u5143\u7d20\u51fa\u5806\nfn poll(self: *Self) !T {\n// \u5224\u65ad\u5904\u7406\nif (self.isEmpty()) unreachable;\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\ntry self.swap(0, self.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nvar val = self.maxHeap.?.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\ntry self.siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n} // \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316\nfn siftDown(self: *Self, i_: usize) !void {\nvar i = i_;\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nvar l = left(i);\nvar r = right(i);\nvar ma = i;\nif (l < self.size() and self.maxHeap.?.items[l] > self.maxHeap.?.items[ma]) ma = l;\nif (r < self.size() and self.maxHeap.?.items[r] > self.maxHeap.?.items[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\ntry self.swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
"},{"location":"chapter_heap/heap/#814","title":"8.1.4. \u00a0 \u5806\u5e38\u89c1\u5e94\u7528","text":"
  • \u4f18\u5148\u961f\u5217\u3002\u5806\u5e38\u4f5c\u4e3a\u5b9e\u73b0\u4f18\u5148\u961f\u5217\u7684\u9996\u9009\u6570\u636e\u7ed3\u6784\uff0c\u5165\u961f\u548c\u51fa\u961f\u64cd\u4f5c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u5efa\u961f\u64cd\u4f5c\u4e3a \\(O(n)\\) \uff0c\u7686\u975e\u5e38\u9ad8\u6548\u3002
  • \u5806\u6392\u5e8f\u3002\u7ed9\u5b9a\u4e00\u7ec4\u6570\u636e\uff0c\u6211\u4eec\u4f7f\u7528\u5176\u5efa\u5806\uff0c\u5e76\u4f9d\u6b21\u5168\u90e8\u5f39\u51fa\uff0c\u5219\u53ef\u4ee5\u5f97\u5230\u6709\u5e8f\u7684\u5e8f\u5217\u3002\u5f53\u7136\uff0c\u5806\u6392\u5e8f\u4e00\u822c\u65e0\u9700\u5f39\u51fa\u5143\u7d20\uff0c\u4ec5\u9700\u6bcf\u8f6e\u5c06\u5806\u9876\u5143\u7d20\u4ea4\u6362\u81f3\u6570\u7ec4\u5c3e\u90e8\u5e76\u51cf\u5c0f\u5806\u7684\u957f\u5ea6\u5373\u53ef\u3002
  • \u83b7\u53d6\u6700\u5927\u7684 \\(k\\) \u4e2a\u5143\u7d20\u3002\u8fd9\u65e2\u662f\u4e00\u9053\u7ecf\u5178\u7b97\u6cd5\u9898\u76ee\uff0c\u4e5f\u662f\u4e00\u79cd\u5e38\u89c1\u5e94\u7528\uff0c\u4f8b\u5982\u9009\u53d6\u70ed\u5ea6\u524d 10 \u7684\u65b0\u95fb\u4f5c\u4e3a\u5fae\u535a\u70ed\u641c\uff0c\u9009\u53d6\u524d 10 \u9500\u91cf\u7684\u5546\u54c1\u7b49\u3002
"},{"location":"chapter_heap/summary/","title":"8.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u5806\u662f\u4e00\u68f5\u9650\u5b9a\u6761\u4ef6\u4e0b\u7684\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u6839\u636e\u6210\u7acb\u6761\u4ef6\u53ef\u5206\u4e3a\u5927\u9876\u5806\u548c\u5c0f\u9876\u5806\u3002\u5927\uff08\u5c0f\uff09\u9876\u5806\u7684\u5806\u9876\u5143\u7d20\u6700\u5927\uff08\u5c0f\uff09\u3002
  • \u4f18\u5148\u961f\u5217\u5b9a\u4e49\u4e3a\u4e00\u79cd\u5177\u6709\u51fa\u961f\u4f18\u5148\u7ea7\u7684\u961f\u5217\u3002\u5806\u662f\u5b9e\u73b0\u4f18\u5148\u961f\u5217\u7684\u6700\u5e38\u7528\u6570\u636e\u7ed3\u6784\u3002
  • \u5806\u7684\u5e38\u7528\u64cd\u4f5c\u548c\u5bf9\u5e94\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a\u5143\u7d20\u5165\u5806 \\(O(\\log n)\\) \u3001\u5806\u9876\u5143\u7d20\u51fa\u5806 \\(O(\\log n)\\) \u3001\u8bbf\u95ee\u5806\u9876\u5143\u7d20 \\(O(1)\\) \u7b49\u3002
  • \u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u7528\u6570\u7ec4\u6765\u8868\u793a\uff0c\u56e0\u6b64\u6211\u4eec\u4e00\u822c\u7528\u6570\u7ec4\u6765\u5b58\u50a8\u5806\u3002
  • \u5806\u5316\u64cd\u4f5c\u7528\u4e8e\u4fee\u590d\u5806\u7684\u7279\u6027\uff0c\u5728\u5165\u5806\u548c\u51fa\u5806\u64cd\u4f5c\u4e2d\u90fd\u4f1a\u4f7f\u7528\u5230\u3002
  • \u8f93\u5165 \\(n\\) \u4e2a\u5143\u7d20\u5e76\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u88ab\u4f18\u5316\u81f3 \\(O(n)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002
"},{"location":"chapter_introduction/algorithms_are_everywhere/","title":"1.1. \u00a0 \u7b97\u6cd5\u65e0\u5904\u4e0d\u5728","text":"

\u542c\u5230\u201c\u7b97\u6cd5\u201d\u8fd9\u4e2a\u8bcd\uff0c\u6211\u4eec\u4e00\u822c\u4f1a\u8054\u60f3\u5230\u6570\u5b66\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u5927\u591a\u6570\u7b97\u6cd5\u5e76\u4e0d\u5305\u542b\u590d\u6742\u7684\u6570\u5b66\uff0c\u800c\u66f4\u50cf\u662f\u5728\u8003\u5bdf\u57fa\u672c\u903b\u8f91\uff0c\u800c\u8fd9\u4e9b\u903b\u8f91\u5728\u6211\u4eec\u65e5\u5e38\u751f\u6d3b\u4e2d\u5904\u5904\u53ef\u89c1\u3002

\u5728\u6b63\u5f0f\u4ecb\u7ecd\u7b97\u6cd5\u4e4b\u524d\uff0c\u6211\u60f3\u544a\u8bc9\u4f60\u4e00\u4ef6\u6709\u8da3\u7684\u4e8b\uff1a\u5176\u5b9e\uff0c\u4f60\u5728\u8fc7\u53bb\u5df2\u7ecf\u5b66\u4f1a\u4e86\u5f88\u591a\u7b97\u6cd5\uff0c\u5e76\u4e14\u5df2\u7ecf\u4e60\u60ef\u5c06\u5b83\u4eec\u5e94\u7528\u5230\u65e5\u5e38\u751f\u6d3b\u4e2d\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u4ecb\u7ecd\u4e24\u4e2a\u5177\u4f53\u4f8b\u5b50\u6765\u4f50\u8bc1\u3002

\u4f8b\u4e00\uff1a\u62fc\u79ef\u6728\u3002\u4e00\u5957\u79ef\u6728\uff0c\u9664\u4e86\u6709\u8bb8\u591a\u90e8\u4ef6\u4e4b\u5916\uff0c\u8fd8\u4f1a\u9644\u9001\u8be6\u7ec6\u7684\u62fc\u88c5\u8bf4\u660e\u4e66\u3002\u6211\u4eec\u6309\u7167\u8bf4\u660e\u4e66\u4e0a\u4e00\u6b65\u6b65\u64cd\u4f5c\uff0c\u5373\u53ef\u62fc\u51fa\u590d\u6742\u7684\u79ef\u6728\u6a21\u578b\u3002

\u5982\u679c\u4ece\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u89d2\u5ea6\u770b\uff0c\u5927\u5927\u5c0f\u5c0f\u7684\u300c\u79ef\u6728\u300d\u5c31\u662f\u6570\u636e\u7ed3\u6784\uff0c\u800c\u300c\u62fc\u88c5\u8bf4\u660e\u4e66\u300d\u4e0a\u7684\u4e00\u7cfb\u5217\u6b65\u9aa4\u5c31\u662f\u7b97\u6cd5\u3002

\u4f8b\u4e8c\uff1a\u67e5\u5b57\u5178\u3002\u5728\u5b57\u5178\u4e2d\uff0c\u6bcf\u4e2a\u6c49\u5b57\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u62fc\u97f3\uff0c\u800c\u5b57\u5178\u662f\u6309\u7167\u62fc\u97f3\u7684\u82f1\u6587\u5b57\u6bcd\u8868\u987a\u5e8f\u6392\u5217\u7684\u3002\u5047\u8bbe\u9700\u8981\u5728\u5b57\u5178\u4e2d\u67e5\u8be2\u4efb\u610f\u4e00\u4e2a\u62fc\u97f3\u9996\u5b57\u6bcd\u4e3a \\(r\\) \u7684\u5b57\uff0c\u4e00\u822c\u6211\u4eec\u4f1a\u8fd9\u6837\u505a\uff1a

  1. \u6253\u5f00\u5b57\u5178\u5927\u81f4\u4e00\u534a\u9875\u6570\u7684\u4f4d\u7f6e\uff0c\u67e5\u770b\u6b64\u9875\u7684\u9996\u5b57\u6bcd\u662f\u4ec0\u4e48\uff08\u5047\u8bbe\u4e3a \\(m\\) \uff09\uff1b
  2. \u7531\u4e8e\u5728\u82f1\u6587\u5b57\u6bcd\u8868\u4e2d \\(r\\) \u5728 \\(m\\) \u7684\u540e\u9762\uff0c\u56e0\u6b64\u5e94\u6392\u9664\u5b57\u5178\u524d\u534a\u90e8\u5206\uff0c\u67e5\u627e\u8303\u56f4\u4ec5\u5269\u540e\u534a\u90e8\u5206\uff1b
  3. \u5faa\u73af\u6267\u884c\u6b65\u9aa4 1-2 \uff0c\u76f4\u5230\u627e\u5230\u62fc\u97f3\u9996\u5b57\u6bcd\u4e3a \\(r\\) \u7684\u9875\u7801\u65f6\u7ec8\u6b62\u3002
<1><2><3><4><5>

\u67e5\u5b57\u5178\u8fd9\u4e2a\u5c0f\u5b66\u751f\u7684\u6807\u914d\u6280\u80fd\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u5927\u540d\u9f0e\u9f0e\u7684\u300c\u4e8c\u5206\u67e5\u627e\u300d\u3002\u4ece\u6570\u636e\u7ed3\u6784\u89d2\u5ea6\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u5178\u770b\u4f5c\u662f\u4e00\u4e2a\u5df2\u6392\u5e8f\u7684\u300c\u6570\u7ec4\u300d\uff1b\u800c\u4ece\u7b97\u6cd5\u89d2\u5ea6\uff0c\u6211\u4eec\u53ef\u5c06\u4e0a\u8ff0\u67e5\u5b57\u5178\u7684\u4e00\u7cfb\u5217\u6307\u4ee4\u770b\u4f5c\u662f\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7b97\u6cd5\u3002

\u5c0f\u5230\u70f9\u996a\u4e00\u9053\u83dc\u3001\u5927\u5230\u661f\u9645\u822a\u884c\uff0c\u51e0\u4e4e\u6240\u6709\u95ee\u9898\u7684\u89e3\u51b3\u90fd\u79bb\u4e0d\u5f00\u7b97\u6cd5\u3002\u8ba1\u7b97\u673a\u7684\u51fa\u73b0\uff0c\u4f7f\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u7f16\u7a0b\u5c06\u6570\u636e\u7ed3\u6784\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u7f16\u5199\u4ee3\u7801\u6765\u8c03\u7528 CPU, GPU \u6267\u884c\u7b97\u6cd5\uff0c\u4ece\u800c\u5c06\u751f\u6d3b\u4e2d\u7684\u95ee\u9898\u642c\u8fd0\u5230\u8ba1\u7b97\u673a\u4e2d\uff0c\u66f4\u52a0\u9ad8\u6548\u5730\u89e3\u51b3\u5404\u5f0f\u5404\u6837\u7684\u590d\u6742\u95ee\u9898\u3002

Tip

\u8bfb\u5230\u8fd9\u91cc\uff0c\u5982\u679c\u4f60\u611f\u5230\u5bf9\u6570\u636e\u7ed3\u6784\u3001\u7b97\u6cd5\u3001\u6570\u7ec4\u3001\u4e8c\u5206\u67e5\u627e\u7b49\u6b64\u7c7b\u6982\u5ff5\u4e00\u77e5\u534a\u89e3\uff0c\u90a3\u4e48\u5c31\u592a\u597d\u4e86\uff01\u56e0\u4e3a\u8fd9\u6b63\u662f\u672c\u4e66\u5b58\u5728\u7684\u4ef7\u503c\uff0c\u63a5\u4e0b\u6765\uff0c\u672c\u4e66\u5c06\u4f1a\u4e00\u6b65\u6b65\u5730\u5f15\u5bfc\u4f60\u8fdb\u5165\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u77e5\u8bc6\u6bbf\u5802\u3002

"},{"location":"chapter_introduction/summary/","title":"1.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u7b97\u6cd5\u5728\u751f\u6d3b\u4e2d\u968f\u5904\u53ef\u89c1\uff0c\u5e76\u4e0d\u9ad8\u6df1\u83ab\u6d4b\u3002\u6211\u4eec\u5df2\u7ecf\u4e0d\u77e5\u4e0d\u89c9\u5730\u5b66\u4e60\u5230\u8bb8\u591a\u201c\u7b97\u6cd5\u201d\uff0c\u7528\u4e8e\u89e3\u51b3\u751f\u6d3b\u4e2d\u5927\u5927\u5c0f\u5c0f\u7684\u95ee\u9898\u3002
  • \u201c\u67e5\u5b57\u5178\u201d\u7684\u539f\u7406\u548c\u4e8c\u5206\u67e5\u627e\u7b97\u6cd5\u4e00\u81f4\u3002\u4e8c\u5206\u4f53\u73b0\u5206\u800c\u6cbb\u4e4b\u7684\u91cd\u8981\u7b97\u6cd5\u601d\u60f3\u3002
  • \u7b97\u6cd5\u662f\u5728\u6709\u9650\u65f6\u95f4\u5185\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u7684\u4e00\u7ec4\u6307\u4ee4\u6216\u64cd\u4f5c\u6b65\u9aa4\uff0c\u6570\u636e\u7ed3\u6784\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\u3002
  • \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e24\u8005\u7d27\u5bc6\u8054\u7cfb\u3002\u6570\u636e\u7ed3\u6784\u662f\u7b97\u6cd5\u7684\u5e95\u5ea7\uff0c\u7b97\u6cd5\u662f\u53d1\u6325\u6570\u636e\u7ed3\u6784\u7684\u821e\u53f0\u3002
  • \u4e50\u9ad8\u79ef\u6728\u5bf9\u5e94\u6570\u636e\uff0c\u79ef\u6728\u5f62\u72b6\u548c\u8fde\u63a5\u5f62\u5f0f\u5bf9\u5e94\u6570\u636e\u7ed3\u6784\uff0c\u62fc\u88c5\u79ef\u6728\u7684\u6d41\u7a0b\u6b65\u9aa4\u5bf9\u5e94\u7b97\u6cd5\u3002
"},{"location":"chapter_introduction/what_is_dsa/","title":"1.2. \u00a0 \u7b97\u6cd5\u662f\u4ec0\u4e48","text":""},{"location":"chapter_introduction/what_is_dsa/#121","title":"1.2.1. \u00a0 \u7b97\u6cd5\u5b9a\u4e49","text":"

\u300c\u7b97\u6cd5 Algorithm\u300d\u662f\u5728\u6709\u9650\u65f6\u95f4\u5185\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u7684\u4e00\u7ec4\u6307\u4ee4\u6216\u64cd\u4f5c\u6b65\u9aa4\u3002\u7b97\u6cd5\u5177\u6709\u4ee5\u4e0b\u7279\u6027\uff1a

  • \u95ee\u9898\u662f\u660e\u786e\u7684\uff0c\u9700\u8981\u62e5\u6709\u660e\u786e\u7684\u8f93\u5165\u548c\u8f93\u51fa\u5b9a\u4e49\u3002
  • \u89e3\u5177\u6709\u786e\u5b9a\u6027\uff0c\u5373\u7ed9\u5b9a\u76f8\u540c\u8f93\u5165\u65f6\uff0c\u8f93\u51fa\u4e00\u5b9a\u76f8\u540c\u3002
  • \u5177\u6709\u53ef\u884c\u6027\uff0c\u53ef\u5728\u6709\u9650\u6b65\u9aa4\u3001\u6709\u9650\u65f6\u95f4\u3001\u6709\u9650\u5185\u5b58\u7a7a\u95f4\u4e0b\u5b8c\u6210\u3002
  • \u72ec\u7acb\u4e8e\u7f16\u7a0b\u8bed\u8a00\uff0c\u5373\u53ef\u7528\u591a\u79cd\u8bed\u8a00\u5b9e\u73b0\u3002
"},{"location":"chapter_introduction/what_is_dsa/#122","title":"1.2.2. \u00a0 \u6570\u636e\u7ed3\u6784\u5b9a\u4e49","text":"

\u300c\u6570\u636e\u7ed3\u6784 Data Structure\u300d\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\u3002\u4e3a\u4e86\u63d0\u9ad8\u6570\u636e\u5b58\u50a8\u548c\u64cd\u4f5c\u6027\u80fd\uff0c\u6570\u636e\u7ed3\u6784\u7684\u8bbe\u8ba1\u539f\u5219\u6709\uff1a

  • \u7a7a\u95f4\u5360\u7528\u5c3d\u53ef\u80fd\u5c0f\uff0c\u8282\u7701\u8ba1\u7b97\u673a\u5185\u5b58\u3002
  • \u6570\u636e\u64cd\u4f5c\u5c3d\u91cf\u5feb\uff0c\u5305\u62ec\u6570\u636e\u8bbf\u95ee\u3001\u6dfb\u52a0\u3001\u5220\u9664\u3001\u66f4\u65b0\u7b49\u3002
  • \u63d0\u4f9b\u7b80\u6d01\u7684\u6570\u636e\u8868\u793a\u548c\u903b\u8f91\u4fe1\u606f\uff0c\u4ee5\u4fbf\u7b97\u6cd5\u9ad8\u6548\u8fd0\u884c\u3002

\u6570\u636e\u7ed3\u6784\u7684\u8bbe\u8ba1\u662f\u4e00\u4e2a\u5145\u6ee1\u6743\u8861\u7684\u8fc7\u7a0b\uff0c\u8fd9\u610f\u5473\u7740\u5982\u679c\u83b7\u5f97\u67d0\u65b9\u9762\u7684\u4f18\u52bf\uff0c\u5219\u5f80\u5f80\u9700\u8981\u5728\u53e6\u4e00\u65b9\u9762\u505a\u51fa\u59a5\u534f\u3002\u4f8b\u5982\uff0c\u94fe\u8868\u76f8\u5bf9\u4e8e\u6570\u7ec4\uff0c\u6570\u636e\u6dfb\u52a0\u5220\u9664\u64cd\u4f5c\u66f4\u52a0\u65b9\u4fbf\uff0c\u4f46\u727a\u7272\u4e86\u6570\u636e\u7684\u8bbf\u95ee\u901f\u5ea6\uff1b\u56fe\u76f8\u5bf9\u4e8e\u94fe\u8868\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u903b\u8f91\u4fe1\u606f\uff0c\u4f46\u9700\u8981\u5360\u7528\u66f4\u591a\u7684\u5185\u5b58\u7a7a\u95f4\u3002

"},{"location":"chapter_introduction/what_is_dsa/#123","title":"1.2.3. \u00a0 \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u5173\u7cfb","text":"

\u300c\u6570\u636e\u7ed3\u6784\u300d\u4e0e\u300c\u7b97\u6cd5\u300d\u662f\u9ad8\u5ea6\u76f8\u5173\u3001\u7d27\u5bc6\u5d4c\u5408\u7684\uff0c\u4f53\u73b0\u5728\uff1a

  • \u6570\u636e\u7ed3\u6784\u662f\u7b97\u6cd5\u7684\u5e95\u5ea7\u3002\u6570\u636e\u7ed3\u6784\u4e3a\u7b97\u6cd5\u63d0\u4f9b\u7ed3\u6784\u5316\u5b58\u50a8\u7684\u6570\u636e\uff0c\u4ee5\u53ca\u64cd\u4f5c\u6570\u636e\u7684\u5bf9\u5e94\u65b9\u6cd5\u3002
  • \u7b97\u6cd5\u662f\u6570\u636e\u7ed3\u6784\u53d1\u6325\u7684\u821e\u53f0\u3002\u6570\u636e\u7ed3\u6784\u4ec5\u5b58\u50a8\u6570\u636e\u4fe1\u606f\uff0c\u7ed3\u5408\u7b97\u6cd5\u624d\u53ef\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u3002
  • \u7b97\u6cd5\u6709\u5bf9\u5e94\u6700\u4f18\u7684\u6570\u636e\u7ed3\u6784\u3002\u7ed9\u5b9a\u7b97\u6cd5\uff0c\u4e00\u822c\u53ef\u57fa\u4e8e\u4e0d\u540c\u7684\u6570\u636e\u7ed3\u6784\u5b9e\u73b0\uff0c\u800c\u6700\u7ec8\u6267\u884c\u6548\u7387\u5f80\u5f80\u76f8\u5dee\u5f88\u5927\u3002

Fig. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u5173\u7cfb

\u5982\u679c\u5c06\u300cLEGO \u4e50\u9ad8\u300d\u7c7b\u6bd4\u5230\u300c\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300d\uff0c\u90a3\u4e48\u53ef\u4ee5\u5f97\u5230\u4e0b\u8868\u6240\u793a\u7684\u5bf9\u5e94\u5173\u7cfb\u3002

\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5 LEGO \u4e50\u9ad8 \u8f93\u5165\u6570\u636e \u672a\u62fc\u88c5\u7684\u79ef\u6728 \u6570\u636e\u7ed3\u6784 \u79ef\u6728\u7ec4\u7ec7\u5f62\u5f0f\uff0c\u5305\u62ec\u5f62\u72b6\u3001\u5927\u5c0f\u3001\u8fde\u63a5\u65b9\u5f0f\u7b49 \u7b97\u6cd5 \u628a\u79ef\u6728\u62fc\u6210\u76ee\u6807\u5f62\u6001\u7684\u4e00\u7cfb\u5217\u64cd\u4f5c\u6b65\u9aa4 \u8f93\u51fa\u6570\u636e \u79ef\u6728\u6a21\u578b

\u7ea6\u5b9a\u4fd7\u6210\u7684\u7b80\u79f0

\u5728\u5b9e\u9645\u8ba8\u8bba\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4f1a\u5c06\u300c\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300d\u76f4\u63a5\u7b80\u79f0\u4e3a\u300c\u7b97\u6cd5\u300d\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u719f\u79f0\u7684 LeetCode \u7b97\u6cd5\u9898\u76ee\uff0c\u5b9e\u9645\u4e0a\u540c\u65f6\u8003\u5bdf\u4e86\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\u4e24\u90e8\u5206\u77e5\u8bc6\u3002

"},{"location":"chapter_preface/about_the_book/","title":"0.1. \u00a0 \u5173\u4e8e\u672c\u4e66","text":"

\u672c\u9879\u76ee\u81f4\u529b\u4e8e\u6784\u5efa\u4e00\u672c\u5f00\u6e90\u514d\u8d39\u3001\u65b0\u624b\u53cb\u597d\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5165\u95e8\u4e66\u3002

  • \u5168\u4e66\u91c7\u7528\u52a8\u753b\u56fe\u89e3\uff0c\u7ed3\u6784\u5316\u5730\u8bb2\u89e3\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u77e5\u8bc6\uff0c\u5185\u5bb9\u6e05\u6670\u6613\u61c2\u3001\u5b66\u4e60\u66f2\u7ebf\u5e73\u6ed1\uff1b
  • \u7b97\u6cd5\u6e90\u4ee3\u7801\u7686\u53ef\u4e00\u952e\u8fd0\u884c\uff0c\u652f\u6301 Java, C++, Python, Go, JS, TS, C#, Swift, Zig \u7b49\u8bed\u8a00\uff1b
  • \u9f13\u52b1\u8bfb\u8005\u5728\u7ae0\u8282\u8ba8\u8bba\u533a\u4e92\u5e2e\u4e92\u52a9\u3001\u5171\u540c\u8fdb\u6b65\uff0c\u63d0\u95ee\u4e0e\u8bc4\u8bba\u4e00\u822c\u80fd\u5728\u4e24\u65e5\u5185\u5f97\u5230\u56de\u590d\uff1b
"},{"location":"chapter_preface/about_the_book/#011","title":"0.1.1. \u00a0 \u8bfb\u8005\u5bf9\u8c61","text":"

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u521d\u5b66\u8005\u300d\uff0c\u5b8c\u5168\u6ca1\u6709\u63a5\u89e6\u8fc7\u7b97\u6cd5\uff0c\u6216\u8005\u5df2\u7ecf\u6709\u5c11\u91cf\u5237\u9898\uff0c\u5bf9\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u6709\u6726\u80e7\u7684\u7406\u89e3\uff0c\u5728\u4f1a\u4e0e\u4e0d\u4f1a\u4e4b\u95f4\u53cd\u590d\u6a2a\u8df3\uff0c\u90a3\u4e48\u8fd9\u672c\u4e66\u5c31\u662f\u4e3a\u4f60\u800c\u5199\uff01

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u8001\u624b\u300d\uff0c\u5df2\u7ecf\u79ef\u7d2f\u4e00\u5b9a\u5237\u9898\u91cf\uff0c\u63a5\u89e6\u8fc7\u5927\u591a\u6570\u9898\u578b\uff0c\u90a3\u4e48\u672c\u4e66\u53ef\u4ee5\u5e2e\u52a9\u4f60\u56de\u987e\u4e0e\u68b3\u7406\u7b97\u6cd5\u77e5\u8bc6\u4f53\u7cfb\uff0c\u4ed3\u5e93\u6e90\u4ee3\u7801\u53ef\u4ee5\u88ab\u5f53\u4f5c\u201c\u5237\u9898\u5de5\u5177\u5e93\u201d\u6216\u201c\u7b97\u6cd5\u5b57\u5178\u201d\u6765\u4f7f\u7528\u3002

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u5927\u4f6c\u300d\uff0c\u5e0c\u671b\u53ef\u4ee5\u5f97\u5230\u4f60\u7684\u5b9d\u8d35\u610f\u89c1\u5efa\u8bae\uff0c\u6216\u8005\u4e00\u8d77\u53c2\u4e0e\u521b\u4f5c\u3002

\u524d\u7f6e\u6761\u4ef6

\u60a8\u9700\u8981\u81f3\u5c11\u5177\u5907\u4efb\u4e00\u8bed\u8a00\u7684\u7f16\u7a0b\u57fa\u7840\uff0c\u80fd\u591f\u9605\u8bfb\u548c\u7f16\u5199\u7b80\u5355\u4ee3\u7801\u3002

"},{"location":"chapter_preface/about_the_book/#012","title":"0.1.2. \u00a0 \u5185\u5bb9\u7ed3\u6784","text":"

\u672c\u4e66\u4e3b\u8981\u5185\u5bb9\u6709\uff1a

  • \u590d\u6742\u5ea6\u5206\u6790\uff1a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u8bc4\u4ef7\u7ef4\u5ea6\u3001\u7b97\u6cd5\u6548\u7387\u7684\u8bc4\u4f30\u65b9\u6cd5\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u3001\u7a7a\u95f4\u590d\u6742\u5ea6\uff0c\u5305\u62ec\u63a8\u7b97\u65b9\u6cd5\u3001\u5e38\u89c1\u7c7b\u578b\u3001\u793a\u4f8b\u7b49\u3002
  • \u6570\u636e\u7ed3\u6784\uff1a\u5e38\u7528\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u6570\u636e\u5728\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u65b9\u5f0f\u3001\u6570\u636e\u7ed3\u6784\u5206\u7c7b\u65b9\u6cd5\u3002\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u6563\u5217\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u7b49\u6570\u636e\u7ed3\u6784\uff0c\u5185\u5bb9\u5305\u62ec\u5b9a\u4e49\u3001\u4f18\u52a3\u52bf\u3001\u5e38\u7528\u64cd\u4f5c\u3001\u5e38\u89c1\u7c7b\u578b\u3001\u5178\u578b\u5e94\u7528\u3001\u5b9e\u73b0\u65b9\u6cd5\u7b49\u3002
  • \u7b97\u6cd5\uff1a\u67e5\u627e\u7b97\u6cd5\u3001\u6392\u5e8f\u7b97\u6cd5\u3001\u641c\u7d22\u4e0e\u56de\u6eaf\u3001\u52a8\u6001\u89c4\u5212\u3001\u5206\u6cbb\u7b97\u6cd5\uff0c\u5185\u5bb9\u5305\u62ec\u5b9a\u4e49\u3001\u4f7f\u7528\u573a\u666f\u3001\u4f18\u52a3\u52bf\u3001\u65f6\u7a7a\u6548\u7387\u3001\u5b9e\u73b0\u65b9\u6cd5\u3001\u793a\u4f8b\u9898\u76ee\u7b49\u3002

Fig. Hello \u7b97\u6cd5\u5185\u5bb9\u7ed3\u6784

"},{"location":"chapter_preface/about_the_book/#013","title":"0.1.3. \u00a0 \u81f4\u8c22","text":"

\u672c\u4e66\u7684\u6210\u4e66\u8fc7\u7a0b\u4e2d\uff0c\u6211\u83b7\u5f97\u4e86\u8bb8\u591a\u4eba\u7684\u5e2e\u52a9\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a

  • \u611f\u8c22\u6211\u5728\u516c\u53f8\u7684\u5bfc\u5e08\u674e\u6c50\u535a\u58eb\uff0c\u5728\u4e00\u6b21\u7545\u8c08\u65f6\u60a8\u544a\u8bc9\u6211\u201c\u89c9\u5f97\u5e94\u8be5\u505a\u5c31\u53bb\u505a\u201d\uff0c\u575a\u5b9a\u4e86\u6211\u5199\u8fd9\u672c\u4e66\u7684\u51b3\u5fc3\u3002
  • \u611f\u8c22\u6211\u7684\u5973\u670b\u53cb\u6ce1\u6ce1\u62c5\u4efb\u672c\u4e66\u7684\u9996\u4f4d\u8bfb\u8005\uff0c\u4ece\u7b97\u6cd5\u5c0f\u767d\u7684\u89c6\u89d2\u63d0\u51fa\u4e86\u8bb8\u591a\u5efa\u8bae\uff0c\u4f7f\u8fd9\u672c\u4e66\u66f4\u52a0\u9002\u5408\u521d\u5b66\u8005\u6765\u9605\u8bfb\u3002
  • \u611f\u8c22\u817e\u5b9d\u3001\u7426\u5b9d\u3001\u98de\u5b9d\u4e3a\u672c\u4e66\u8d77\u4e86\u4e2a\u597d\u542c\u53c8\u6709\u6897\u540d\u5b57\uff0c\u76f4\u63a5\u5524\u8d77\u6211\u6700\u521d\u6572\u4e0b\u7b2c\u4e00\u884c\u4ee3\u7801 \"Hello World!\" \u7684\u56de\u5fc6\u3002
  • \u611f\u8c22\u82cf\u6f7c\u4e3a\u672c\u4e66\u8bbe\u8ba1\u4e86\u5c01\u9762\u548c LOGO \uff0c\u5728\u6211\u7684\u5f3a\u8feb\u75c7\u4e0b\u524d\u540e\u591a\u6b21\u5e2e\u5fd9\u4fee\u6539\uff0c\u8c22\u8c22\u4f60\u7684\u8010\u5fc3\u3002
  • \u611f\u8c22 @squidfunk \u7ed9\u51fa\u7684\u5199\u4f5c\u6392\u7248\u5efa\u8bae\uff0c\u4ee5\u53ca\u4f18\u79c0\u5f00\u6e90\u9879\u76ee Material-for-MkDocs \u3002

\u672c\u4e66\u9f13\u52b1\u201c\u624b\u8111\u5e76\u7528\u201d\u7684\u5b66\u4e60\u65b9\u5f0f\uff0c\u5728\u8fd9\u70b9\u4e0a\u53d7\u5230\u4e86\u300a\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\u300b\u5f88\u5927\u5f71\u54cd\uff0c\u4e5f\u5728\u6b64\u5411\u5404\u4f4d\u540c\u5b66\u5f3a\u70c8\u63a8\u8350\u8fd9\u672c\u8457\u4f5c\uff0c\u5305\u62ec\u4e2d\u6587\u7248\u3001\u82f1\u6587\u7248\u3001\u674e\u6c90\u8001\u5e08 bilibili \u4e3b\u9875\u3002

\u5728\u5199\u4f5c\u8fc7\u7a0b\u4e2d\uff0c\u6211\u9605\u8bfb\u4e86\u8bb8\u591a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u6559\u6750\u4e0e\u6587\u7ae0\uff0c\u8fd9\u4e9b\u8457\u4f5c\u4e3a\u672c\u4e66\u4f5c\u51fa\u4e86\u5f88\u597d\u7684\u699c\u6837\uff0c\u4fdd\u8bc1\u4e86\u672c\u4e66\u5185\u5bb9\u7684\u6b63\u786e\u6027\u4e0e\u8d28\u91cf\uff0c\u611f\u8c22\u5404\u4f4d\u8001\u5e08\u4e0e\u524d\u8f88\u7684\u7cbe\u5f69\u521b\u4f5c\uff01

\u611f\u8c22\u7236\u6bcd\uff0c\u4f60\u4eec\u4e00\u8d2f\u7684\u652f\u6301\u4e0e\u9f13\u52b1\u7ed9\u4e86\u6211\u81ea\u7531\u5ea6\u6765\u505a\u8fd9\u4e9b\u6709\u8da3\u7684\u4e8b\u3002

"},{"location":"chapter_preface/suggestions/","title":"0.2. \u00a0 \u5982\u4f55\u4f7f\u7528\u672c\u4e66","text":"

\u5efa\u8bae\u901a\u8bfb\u672c\u8282\u5185\u5bb9\uff0c\u4ee5\u83b7\u53d6\u6700\u4f73\u9605\u8bfb\u4f53\u9a8c\u3002

"},{"location":"chapter_preface/suggestions/#021","title":"0.2.1. \u00a0 \u7b97\u6cd5\u5b66\u4e60\u8def\u7ebf","text":"

\u603b\u4f53\u4e0a\u770b\uff0c\u6211\u8ba4\u4e3a\u53ef\u5c06\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u8fc7\u7a0b\u5206\u4e3a\u4e09\u4e2a\u9636\u6bb5\u3002

  1. \u7b97\u6cd5\u5165\u95e8\u3002\u719f\u6089\u5404\u79cd\u6570\u636e\u7ed3\u6784\u7684\u7279\u70b9\u3001\u7528\u6cd5\uff0c\u5b66\u4e60\u5404\u79cd\u7b97\u6cd5\u7684\u539f\u7406\u3001\u6d41\u7a0b\u3001\u7528\u9014\u3001\u6548\u7387\u7b49\u3002
  2. \u5237\u7b97\u6cd5\u9898\u3002\u53ef\u4ee5\u5148\u4ece\u70ed\u95e8\u9898\u5355\u5f00\u5237\uff0c\u63a8\u8350\u5251\u6307 Offer\u3001LeetCode Hot 100\uff0c\u5148\u79ef\u7d2f\u81f3\u5c11 100 \u9053\u9898\u91cf\uff0c\u719f\u6089\u5927\u591a\u6570\u7684\u7b97\u6cd5\u95ee\u9898\u3002\u521a\u5f00\u59cb\u5237\u9898\u65f6\uff0c\u201c\u9057\u5fd8\u201d\u662f\u6700\u5927\u7684\u56f0\u6270\u70b9\uff0c\u4f46\u8fd9\u662f\u5f88\u6b63\u5e38\u7684\uff0c\u8bf7\u4e0d\u8981\u62c5\u5fc3\u3002\u5b66\u4e60\u4e2d\u6709\u4e00\u79cd\u6982\u5ff5\u53eb\u201c\u5468\u671f\u6027\u56de\u987e\u201d\uff0c\u540c\u4e00\u9053\u9898\u9694\u6bb5\u65f6\u95f4\u505a\u4e00\u6b21\uff0c\u5728\u91cd\u590d 3 \u8f6e\u4ee5\u4e0a\u540e\uff0c\u5f80\u5f80\u5c31\u80fd\u7262\u8bb0\u4e8e\u5fc3\u4e86\u3002
  3. \u642d\u5efa\u77e5\u8bc6\u4f53\u7cfb\u3002\u5728\u5b66\u4e60\u65b9\u9762\uff0c\u53ef\u4ee5\u9605\u8bfb\u7b97\u6cd5\u4e13\u680f\u6587\u7ae0\u3001\u89e3\u9898\u6846\u67b6\u3001\u7b97\u6cd5\u6559\u6750\uff0c\u4e0d\u65ad\u5730\u4e30\u5bcc\u77e5\u8bc6\u4f53\u7cfb\u3002\u5728\u5237\u9898\u65b9\u9762\uff0c\u53ef\u4ee5\u5f00\u59cb\u91c7\u7528\u8fdb\u9636\u5237\u9898\u65b9\u6848\uff0c\u4f8b\u5982\u6309\u4e13\u9898\u5206\u7c7b\u3001\u4e00\u9898\u591a\u89e3\u3001\u4e00\u89e3\u591a\u9898\u7b49\uff0c\u76f8\u5173\u5237\u9898\u5fc3\u5f97\u53ef\u4ee5\u5728\u5404\u4e2a\u793e\u533a\u4e2d\u627e\u5230\u3002

\u4f5c\u4e3a\u4e00\u672c\u5165\u95e8\u6559\u7a0b\uff0c\u672c\u4e66\u5185\u5bb9\u4e3b\u8981\u5bf9\u5e94\u201c\u7b2c\u4e00\u9636\u6bb5\u201d\uff0c\u81f4\u529b\u4e8e\u5e2e\u52a9\u4f60\u66f4\u9ad8\u6548\u5730\u5f00\u5c55\u7b2c\u4e8c\u3001\u4e09\u9636\u6bb5\u7684\u5b66\u4e60\u3002

Fig. \u7b97\u6cd5\u5b66\u4e60\u8def\u7ebf

"},{"location":"chapter_preface/suggestions/#022","title":"0.2.2. \u00a0 \u884c\u6587\u98ce\u683c\u7ea6\u5b9a","text":"

\u6807\u9898\u540e\u6807\u6ce8 * \u7684\u662f\u9009\u8bfb\u7ae0\u8282\uff0c\u5185\u5bb9\u76f8\u5bf9\u8f83\u96be\u3002\u5982\u679c\u4f60\u7684\u65f6\u95f4\u6709\u9650\uff0c\u5efa\u8bae\u53ef\u4ee5\u5148\u8df3\u8fc7\u3002

\u6587\u7ae0\u4e2d\u7684\u91cd\u8981\u540d\u8bcd\u4f1a\u7528 \u300c\u62ec\u53f7\u300d \u6807\u6ce8\uff0c\u4f8b\u5982 \u300c\u6570\u7ec4 Array\u300d \u3002\u5efa\u8bae\u8bb0\u4f4f\u8fd9\u4e9b\u540d\u8bcd\uff0c\u5305\u62ec\u82f1\u6587\u7ffb\u8bd1\uff0c\u4ee5\u4fbf\u540e\u7eed\u9605\u8bfb\u6587\u732e\u65f6\u4f7f\u7528\u3002

\u91cd\u70b9\u5185\u5bb9\u3001\u603b\u8d77\u53e5\u3001\u603b\u7ed3\u53e5\u4f1a\u88ab \u52a0\u7c97 \uff0c\u6b64\u7c7b\u6587\u5b57\u503c\u5f97\u7279\u522b\u5173\u6ce8\u3002

\u4e13\u6709\u540d\u8bcd\u548c\u6709\u7279\u6307\u542b\u4e49\u7684\u8bcd\u53e5\u4f1a\u4f7f\u7528 \u201c\u53cc\u5f15\u53f7\u201d \u6807\u6ce8\uff0c\u4ee5\u907f\u514d\u6b67\u4e49\u3002

\u672c\u4e66\u90e8\u5206\u653e\u5f03\u4e86\u7f16\u7a0b\u8bed\u8a00\u7684\u6ce8\u91ca\u89c4\u8303\uff0c\u4ee5\u6362\u53d6\u66f4\u52a0\u7d27\u51d1\u7684\u5185\u5bb9\u6392\u7248\u3002\u6ce8\u91ca\u4e3b\u8981\u5206\u4e3a\u4e09\u79cd\u7c7b\u578b\uff1a\u6807\u9898\u6ce8\u91ca\u3001\u5185\u5bb9\u6ce8\u91ca\u3001\u591a\u884c\u6ce8\u91ca\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
\"\"\" \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 \"\"\"\n# \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n\"\"\"\n\u591a\u884c\n\u6ce8\u91ca\n\"\"\"\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
// \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n// \u591a\u884c\n// \u6ce8\u91ca\n
"},{"location":"chapter_preface/suggestions/#023","title":"0.2.3. \u00a0 \u5728\u52a8\u753b\u56fe\u89e3\u4e2d\u9ad8\u6548\u5b66\u4e60","text":"

\u89c6\u9891\u548c\u56fe\u7247\u76f8\u6bd4\u4e8e\u6587\u5b57\u7684\u4fe1\u606f\u5bc6\u5ea6\u548c\u7ed3\u6784\u5316\u7a0b\u5ea6\u66f4\u9ad8\uff0c\u66f4\u5bb9\u6613\u7406\u89e3\u3002\u5728\u672c\u4e66\u4e2d\uff0c\u77e5\u8bc6\u91cd\u96be\u70b9\u4f1a\u4e3b\u8981\u4ee5\u52a8\u753b\u3001\u56fe\u89e3\u7684\u5f62\u5f0f\u5448\u73b0\uff0c\u800c\u6587\u5b57\u7684\u4f5c\u7528\u5219\u662f\u4f5c\u4e3a\u52a8\u753b\u548c\u56fe\u7684\u89e3\u91ca\u4e0e\u8865\u5145\u3002

\u9605\u8bfb\u672c\u4e66\u65f6\uff0c\u82e5\u53d1\u73b0\u67d0\u6bb5\u5185\u5bb9\u63d0\u4f9b\u4e86\u52a8\u753b\u6216\u56fe\u89e3\uff0c\u5efa\u8bae\u4f60\u4ee5\u56fe\u4e3a\u4e3b\u7ebf\uff0c\u5c06\u6587\u5b57\u5185\u5bb9\uff08\u4e00\u822c\u5728\u56fe\u7684\u4e0a\u65b9\uff09\u5bf9\u9f50\u5230\u56fe\u4e2d\u5185\u5bb9\uff0c\u7efc\u5408\u6765\u7406\u89e3\u3002

Fig. \u52a8\u753b\u56fe\u89e3\u793a\u4f8b

"},{"location":"chapter_preface/suggestions/#024","title":"0.2.4. \u00a0 \u5728\u4ee3\u7801\u5b9e\u8df5\u4e2d\u52a0\u6df1\u7406\u89e3","text":"

\u672c\u4e66\u7684\u914d\u5957\u4ee3\u7801\u6258\u7ba1\u5728GitHub \u4ed3\u5e93\uff0c\u6e90\u4ee3\u7801\u5305\u542b\u8be6\u7ec6\u6ce8\u91ca\uff0c\u914d\u6709\u6d4b\u8bd5\u6837\u4f8b\uff0c\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u3002

  • \u82e5\u5b66\u4e60\u65f6\u95f4\u7d27\u5f20\uff0c\u5efa\u8bae\u81f3\u5c11\u5c06\u6240\u6709\u4ee3\u7801\u901a\u8bfb\u5e76\u8fd0\u884c\u4e00\u904d\u3002
  • \u82e5\u65f6\u95f4\u5141\u8bb8\uff0c\u5f3a\u70c8\u5efa\u8bae\u5bf9\u7167\u7740\u4ee3\u7801\u81ea\u5df1\u6572\u4e00\u904d\u3002\u76f8\u6bd4\u4e8e\u8bfb\u4ee3\u7801\uff0c\u5199\u4ee3\u7801\u7684\u8fc7\u7a0b\u5f80\u5f80\u80fd\u5e26\u6765\u65b0\u7684\u6536\u83b7\u3002

Fig. \u8fd0\u884c\u4ee3\u7801\u793a\u4f8b

\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5\u672c\u5730\u7f16\u7a0b\u73af\u5883\u3002\u53c2\u7167\u9644\u5f55\u6559\u7a0b\uff0c\u5982\u679c\u5df2\u6709\u53ef\u76f4\u63a5\u8df3\u8fc7\u3002

\u7b2c\u4e8c\u6b65\uff1a\u4e0b\u8f7d\u4ee3\u7801\u4ed3\u3002\u5982\u679c\u5df2\u7ecf\u5b89\u88c5 Git \uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u514b\u9686\u4ee3\u7801\u4ed3\u3002

git clone https://github.com/krahets/hello-algo.git\n

\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u70b9\u51fb\u201cDownload ZIP\u201d\u76f4\u63a5\u4e0b\u8f7d\u4ee3\u7801\u538b\u7f29\u5305\uff0c\u672c\u5730\u89e3\u538b\u5373\u53ef\u3002

Fig. \u514b\u9686\u4ed3\u5e93\u4e0e\u4e0b\u8f7d\u4ee3\u7801

\u7b2c\u4e09\u6b65\uff1a\u8fd0\u884c\u6e90\u4ee3\u7801\u3002\u82e5\u4ee3\u7801\u5757\u7684\u9876\u90e8\u6807\u6709\u6587\u4ef6\u540d\u79f0\uff0c\u5219\u53ef\u5728\u4ed3\u5e93 codes \u6587\u4ef6\u5939\u4e2d\u627e\u5230\u5bf9\u5e94\u7684 \u6e90\u4ee3\u7801\u6587\u4ef6\u3002\u6e90\u4ee3\u7801\u6587\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7701\u53bb\u4e0d\u5fc5\u8981\u7684\u8c03\u8bd5\u65f6\u95f4\uff0c\u5c06\u7cbe\u529b\u96c6\u4e2d\u5728\u5b66\u4e60\u5185\u5bb9\u4e0a\u3002

Fig. \u4ee3\u7801\u5757\u4e0e\u5bf9\u5e94\u7684\u6e90\u4ee3\u7801\u6587\u4ef6

"},{"location":"chapter_preface/suggestions/#025","title":"0.2.5. \u00a0 \u5728\u63d0\u95ee\u8ba8\u8bba\u4e2d\u5171\u540c\u6210\u957f","text":"

\u9605\u8bfb\u672c\u4e66\u65f6\uff0c\u8bf7\u4e0d\u8981\u201c\u60ef\u7740\u201d\u90a3\u4e9b\u5f04\u4e0d\u660e\u767d\u7684\u77e5\u8bc6\u70b9\u3002\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u4e0b\u4f60\u7684\u95ee\u9898\uff0c\u5c0f\u4f19\u4f34\u4eec\u548c\u6211\u90fd\u4f1a\u7ed9\u4e88\u89e3\u7b54\uff0c\u60a8\u4e00\u822c 2 \u65e5\u5185\u4f1a\u5f97\u5230\u56de\u590d\u3002

\u540c\u65f6\uff0c\u4e5f\u5e0c\u671b\u4f60\u53ef\u4ee5\u591a\u82b1\u65f6\u95f4\u901b\u901b\u8bc4\u8bba\u533a\u3002\u4e00\u65b9\u9762\uff0c\u53ef\u4ee5\u770b\u770b\u5927\u5bb6\u9047\u5230\u4e86\u4ec0\u4e48\u95ee\u9898\uff0c\u53cd\u8fc7\u6765\u67e5\u6f0f\u8865\u7f3a\uff0c\u8fd9\u5f80\u5f80\u53ef\u4ee5\u5f15\u8d77\u66f4\u52a0\u6df1\u5ea6\u7684\u601d\u8003\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4e5f\u5e0c\u671b\u4f60\u53ef\u4ee5\u6177\u6168\u5730\u89e3\u7b54\u5c0f\u4f19\u4f34\u4eec\u7684\u95ee\u9898\u3001\u5206\u4eab\u81ea\u5df1\u7684\u89c1\u89e3\uff0c\u5927\u5bb6\u4e92\u76f8\u5b66\u4e60\u4e0e\u8fdb\u6b65\uff01

Fig. \u8bc4\u8bba\u533a\u793a\u4f8b

"},{"location":"chapter_preface/summary/","title":"0.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u672c\u4e66\u4e3b\u8981\u9762\u5411\u7b97\u6cd5\u521d\u5b66\u8005\u3002\u5bf9\u4e8e\u5df2\u7ecf\u6709\u4e00\u5b9a\u79ef\u7d2f\u7684\u540c\u5b66\uff0c\u8fd9\u672c\u4e66\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7cfb\u7edf\u56de\u987e\u7b97\u6cd5\u77e5\u8bc6\uff0c\u6e90\u4ee3\u7801\u53ef\u88ab\u5f53\u4f5c\u201c\u5237\u9898\u5de5\u5177\u5e93\u201d\u6765\u4f7f\u7528\u3002
  • \u4e66\u4e2d\u5185\u5bb9\u4e3b\u8981\u5206\u4e3a\u590d\u6742\u5ea6\u5206\u6790\u3001\u6570\u636e\u7ed3\u6784\u3001\u7b97\u6cd5\u4e09\u90e8\u5206\uff0c\u8986\u76d6\u4e86\u8be5\u9886\u57df\u7684\u5927\u90e8\u5206\u4e3b\u9898\u3002
  • \u5bf9\u4e8e\u7b97\u6cd5\u5c0f\u767d\uff0c\u5728\u521d\u5b66\u9636\u6bb5\u9605\u8bfb\u4e00\u672c\u5165\u95e8\u4e66\u662f\u975e\u5e38\u6709\u5fc5\u8981\u7684\uff0c\u53ef\u4ee5\u5c11\u8d70\u8bb8\u591a\u5f2f\u8def\u3002
  • \u4e66\u5185\u7684\u52a8\u753b\u548c\u56fe\u89e3\u5f80\u5f80\u4ecb\u7ecd\u7684\u662f\u91cd\u70b9\u548c\u96be\u70b9\u77e5\u8bc6\uff0c\u5728\u9605\u8bfb\u65f6\u5e94\u8be5\u591a\u52a0\u5173\u6ce8\u3002
  • \u5b9e\u8df5\u662f\u5b66\u4e60\u7f16\u7a0b\u7684\u6700\u4f73\u65b9\u5f0f\uff0c\u5f3a\u70c8\u63a8\u8350\u8fd0\u884c\u6e90\u4ee3\u7801\uff0c\u52a8\u624b\u6572\u4ee3\u7801\u3002
  • \u672c\u4e66\u63d0\u4f9b\u4e86\u8ba8\u8bba\u533a\uff0c\u9047\u5230\u7591\u60d1\u53ef\u4ee5\u968f\u65f6\u63d0\u95ee\u3002
"},{"location":"chapter_reference/","title":"\u53c2\u8003\u6587\u732e","text":"

[1] Thomas H. Cormen, et al. Introduction to Algorithms (3rd Edition).

[2] Aditya Bhargava. Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People (1st Edition).

[3] \u4e25\u851a\u654f. \u6570\u636e\u7ed3\u6784\uff08 C \u8bed\u8a00\u7248\uff09.

[4] \u9093\u4fca\u8f89. \u6570\u636e\u7ed3\u6784\uff08 C++ \u8bed\u8a00\u7248\uff0c\u7b2c\u4e09\u7248\uff09.

[5] \u9a6c\u514b\u00b7\u827e\u4f26\u00b7\u7ef4\u65af\u8457\uff0c\u9648\u8d8a\u8bd1. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5206\u6790\uff1aJava\u8bed\u8a00\u63cf\u8ff0\uff08\u7b2c\u4e09\u7248\uff09.

[6] \u7a0b\u6770. \u5927\u8bdd\u6570\u636e\u7ed3\u6784.

[7] \u738b\u4e89. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e4b\u7f8e.

[8] Gayle Laakmann McDowell. Cracking the Coding Interview: 189 Programming Questions and Solutions (6th Edition).

[9] Aston Zhang, et al. Dive into Deep Learning.

"},{"location":"chapter_searching/binary_search/","title":"10.2. \u00a0 \u4e8c\u5206\u67e5\u627e","text":"

\u300c\u4e8c\u5206\u67e5\u627e Binary Search\u300d\u5229\u7528\u6570\u636e\u7684\u6709\u5e8f\u6027\uff0c\u901a\u8fc7\u6bcf\u8f6e\u7f29\u5c0f\u4e00\u534a\u641c\u7d22\u533a\u95f4\u6765\u67e5\u627e\u76ee\u6807\u5143\u7d20\u3002

\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\u6709\u4e24\u4e2a\u524d\u7f6e\u6761\u4ef6\uff1a

  • \u8981\u6c42\u8f93\u5165\u6570\u636e\u662f\u6709\u5e8f\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u901a\u8fc7\u5224\u65ad\u5927\u5c0f\u5173\u7cfb\u6765\u6392\u9664\u4e00\u534a\u7684\u641c\u7d22\u533a\u95f4\uff1b
  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\uff0c\u800c\u5728\u94fe\u8868\u4e2d\u4f7f\u7528\u6548\u7387\u5f88\u4f4e\uff0c\u56e0\u4e3a\u5176\u5728\u5faa\u73af\u4e2d\u9700\u8981\u8df3\u8dc3\u5f0f\uff08\u975e\u8fde\u7eed\u5730\uff09\u8bbf\u95ee\u5143\u7d20\u3002
"},{"location":"chapter_searching/binary_search/#1021","title":"10.2.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u7ed9\u5b9a\u4e00\u4e2a\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6392\u5e8f\u6570\u7ec4 nums \uff0c\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\u3002\u6570\u7ec4\u7684\u7d22\u5f15\u53d6\u503c\u8303\u56f4\u4e3a

\\[ 0, 1, 2, \\cdots, n-1 \\]

\u4f7f\u7528\u300c\u533a\u95f4\u300d\u6765\u8868\u793a\u8fd9\u4e2a\u53d6\u503c\u8303\u56f4\u7684\u65b9\u6cd5\u4e3b\u8981\u6709\u4e24\u79cd\uff1a

  1. \u53cc\u95ed\u533a\u95f4 \\([0, n-1]\\) \uff0c\u5373\u4e24\u4e2a\u8fb9\u754c\u90fd\u5305\u542b\u81ea\u8eab\uff1b\u6b64\u65b9\u6cd5\u4e0b\uff0c\u533a\u95f4 \\([0, 0]\\) \u4ecd\u5305\u542b\u4e00\u4e2a\u5143\u7d20\uff1b
  2. \u5de6\u95ed\u53f3\u5f00 \\([0, n)\\) \uff0c\u5373\u5de6\u8fb9\u754c\u5305\u542b\u81ea\u8eab\u3001\u53f3\u8fb9\u754c\u4e0d\u5305\u542b\u81ea\u8eab\uff1b\u6b64\u65b9\u6cd5\u4e0b\uff0c\u533a\u95f4 \\([0, 0)\\) \u4e3a\u7a7a\uff1b
"},{"location":"chapter_searching/binary_search/#_1","title":"\u201c\u53cc\u95ed\u533a\u95f4\u201d\u5b9e\u73b0","text":"

\u9996\u5148\uff0c\u6211\u4eec\u5148\u91c7\u7528\u201c\u53cc\u95ed\u533a\u95f4\u201d\u7684\u8868\u793a\uff0c\u5728\u6570\u7ec4 nums \u4e2d\u67e5\u627e\u76ee\u6807\u5143\u7d20 target \u7684\u5bf9\u5e94\u7d22\u5f15\u3002

<1><2><3><4><5><6><7>

\u4e8c\u5206\u67e5\u627e\u201c\u53cc\u95ed\u533a\u95f4\u201d\u8868\u793a\u4e0b\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search.java
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(int[] nums, int target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.cpp
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(vector<int>& nums, int target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.size() - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.py
def binary_search(nums: List[int], target: int) -> int:\n\"\"\" \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 \"\"\"\n# \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\ni, j = 0, len(nums) - 1\nwhile i <= j:\nm = (i + j) // 2        # \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target:    # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\nelif nums[m] > target:  # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\nelse:\nreturn m            # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn -1                   # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
binary_search.go
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunc binarySearch(nums []int, target int) int {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\ni, j := 0, len(nums)-1\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nfor i <= j {\nm := (i + j) / 2      // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.js
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunction binarySearch(nums, target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nlet i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nconst m = parseInt((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m \uff0c\u5728 JS \u4e2d\u9700\u4f7f\u7528 parseInt \u51fd\u6570\u53d6\u6574\nif (nums[m] < target)          // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target)     // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse\nreturn m;                  // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.ts
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunction binarySearch(nums: number[], target: number): number {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nlet i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nconst m = Math.floor((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target) {        // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\n} else if (nums[m] > target) { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\n} else {                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n}\nreturn -1; // \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n}\n
binary_search.c
[class]{}-[func]{binarySearch}\n
binary_search.cs
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(int[] nums, int target)\n{\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.Length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j)\n{\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.swift
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunc binarySearch(nums: [Int], target: Int) -> Int {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nvar i = 0\nvar j = nums.count - 1\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile i <= j {\nlet m = (i + j) / 2 // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.zig
// \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09\nfn binarySearch(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nvar i: usize = 0;\nvar j: usize = nums.items.len - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nvar m = (i + j) / 2;                    // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums.items[m] < target) {           // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\n} else if (nums.items[m] > target) {    // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\n} else {                                // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn @intCast(T, m);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
"},{"location":"chapter_searching/binary_search/#_2","title":"\u201c\u5de6\u95ed\u53f3\u5f00\u201d\u5b9e\u73b0","text":"

\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528\u201c\u5de6\u95ed\u53f3\u5f00\u201d\u7684\u8868\u793a\u65b9\u6cd5\uff0c\u5199\u51fa\u76f8\u540c\u529f\u80fd\u7684\u4e8c\u5206\u67e5\u627e\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search.java
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(int[] nums, int target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.cpp
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(vector<int>& nums, int target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.size();\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.py
def binary_search1(nums: List[int], target: int) -> int:\n\"\"\" \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 \"\"\"\n# \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\ni, j = 0, len(nums)\n# \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile i < j:\nm = (i + j) // 2        # \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target:    # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\nelif nums[m] > target:  # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\nelse:                   # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\nreturn -1                   # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
binary_search.go
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunc binarySearch1(nums []int, target int) int {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\ni, j := 0, len(nums)\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nfor i < j {\nm := (i + j) / 2      // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.js
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunction binarySearch1(nums, target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nlet i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nconst m = parseInt((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m \uff0c\u5728 JS \u4e2d\u9700\u4f7f\u7528 parseInt \u51fd\u6570\u53d6\u6574\nif (nums[m] < target)          // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target)     // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                           // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.ts
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunction binarySearch1(nums: number[], target: number): number {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nlet i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nconst m = Math.floor((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target) {        // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\n} else if (nums[m] > target) { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\n} else {                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n}\nreturn -1; // \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n}\n
binary_search.c
[class]{}-[func]{binarySearch1}\n
binary_search.cs
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(int[] nums, int target)\n{\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.Length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j)\n{\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.swift
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunc binarySearch1(nums: [Int], target: Int) -> Int {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nvar i = 0\nvar j = nums.count\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile i < j {\nlet m = (i + j) / 2 // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.zig
// \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09\nfn binarySearch1(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nvar i: usize = 0;\nvar j: usize = nums.items.len;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nvar m = (i + j) / 2;                    // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums.items[m] < target) {           // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\n} else if (nums.items[m] > target) {    // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\n} else {                                // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn @intCast(T, m);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
"},{"location":"chapter_searching/binary_search/#_3","title":"\u4e24\u79cd\u8868\u793a\u5bf9\u6bd4","text":"

\u5bf9\u6bd4\u4e0b\u6765\uff0c\u4e24\u79cd\u8868\u793a\u7684\u4ee3\u7801\u5199\u6cd5\u6709\u4ee5\u4e0b\u4e0d\u540c\u70b9\uff1a

\u8868\u793a\u65b9\u6cd5 \u521d\u59cb\u5316\u6307\u9488 \u7f29\u5c0f\u533a\u95f4 \u5faa\u73af\u7ec8\u6b62\u6761\u4ef6 \u53cc\u95ed\u533a\u95f4 \\([0, n-1]\\) \\(i = 0\\) , \\(j = n-1\\) \\(i = m + 1\\) , \\(j = m - 1\\) \\(i > j\\) \u5de6\u95ed\u53f3\u5f00 \\([0, n)\\) \\(i = 0\\) , \\(j = n\\) \\(i = m + 1\\) , \\(j = m\\) \\(i = j\\)

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5728\u201c\u53cc\u95ed\u533a\u95f4\u201d\u8868\u793a\u4e2d\uff0c\u7531\u4e8e\u5bf9\u5de6\u53f3\u4e24\u8fb9\u754c\u7684\u5b9a\u4e49\u662f\u76f8\u540c\u7684\uff0c\u56e0\u6b64\u7f29\u5c0f\u533a\u95f4\u7684 \\(i\\) , \\(j\\) \u5904\u7406\u65b9\u6cd5\u4e5f\u662f\u5bf9\u79f0\u7684\uff0c\u8fd9\u6837\u66f4\u4e0d\u5bb9\u6613\u51fa\u9519\u3002\u7efc\u4e0a\u6240\u8ff0\uff0c\u5efa\u8bae\u4f60\u91c7\u7528\u201c\u53cc\u95ed\u533a\u95f4\u201d\u7684\u5199\u6cd5\u3002

"},{"location":"chapter_searching/binary_search/#_4","title":"\u5927\u6570\u8d8a\u754c\u5904\u7406","text":"

\u5f53\u6570\u7ec4\u957f\u5ea6\u5f88\u5927\u65f6\uff0c\u52a0\u6cd5 \\(i + j\\) \u7684\u7ed3\u679c\u6709\u53ef\u80fd\u4f1a\u8d85\u51fa int \u7c7b\u578b\u7684\u53d6\u503c\u8303\u56f4\u3002\u5728\u6b64\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u6362\u4e00\u79cd\u8ba1\u7b97\u4e2d\u70b9\u7684\u5199\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
# Python \u4e2d\u7684\u6570\u5b57\u7406\u8bba\u4e0a\u53ef\u4ee5\u65e0\u9650\u5927\uff08\u53d6\u51b3\u4e8e\u5185\u5b58\u5927\u5c0f\uff09\n# \u56e0\u6b64\u65e0\u9700\u8003\u8651\u5927\u6570\u8d8a\u754c\u95ee\u9898\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nm := (i + j) / 2\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nm := i + (j - i) / 2\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nlet m = parseInt((i + j) / 2);\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = parseInt(i + (j - i) / 2);\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa Number \u7684\u53d6\u503c\u8303\u56f4\nlet m = Math.floor((i + j) / 2);\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = Math.floor(i + (j - i) / 2);\n
\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nlet m = (i + j) / 2\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = i + (j - 1) / 2\n
\n
"},{"location":"chapter_searching/binary_search/#1022","title":"10.2.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(\\log n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\uff1b\u6bcf\u8f6e\u6392\u9664\u4e00\u534a\u7684\u533a\u95f4\uff0c\u56e0\u6b64\u5faa\u73af\u8f6e\u6570\u4e3a \\(\\log_2 n\\) \uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 i , j \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7a7a\u95f4\u3002

"},{"location":"chapter_searching/binary_search/#1023","title":"10.2.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u4e8c\u5206\u67e5\u627e\u6548\u7387\u5f88\u9ad8\uff0c\u4f53\u73b0\u5728\uff1a

  • \u4e8c\u5206\u67e5\u627e\u65f6\u95f4\u590d\u6742\u5ea6\u4f4e\u3002\u5bf9\u6570\u9636\u5728\u6570\u636e\u91cf\u5f88\u5927\u65f6\u5177\u6709\u5de8\u5927\u4f18\u52bf\uff0c\u4f8b\u5982\uff0c\u5f53\u6570\u636e\u5927\u5c0f \\(n = 2^{20}\\) \u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u9700\u8981 \\(2^{20} = 1048576\\) \u8f6e\u5faa\u73af\uff0c\u800c\u4e8c\u5206\u67e5\u627e\u4ec5\u9700\u8981 \\(\\log_2 2^{20} = 20\\) \u8f6e\u5faa\u73af\u3002
  • \u4e8c\u5206\u67e5\u627e\u4e0d\u9700\u8981\u989d\u5916\u7a7a\u95f4\u3002\u76f8\u5bf9\u4e8e\u501f\u52a9\u989d\u5916\u6570\u636e\u7ed3\u6784\u6765\u5b9e\u73b0\u67e5\u627e\u7684\u7b97\u6cd5\u6765\u8bf4\uff0c\u5176\u66f4\u52a0\u8282\u7ea6\u7a7a\u95f4\u4f7f\u7528\u3002

\u4f46\u5e76\u4e0d\u610f\u5473\u7740\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u5e94\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6709\u5e8f\u6570\u636e\u3002\u5982\u679c\u8f93\u5165\u6570\u636e\u662f\u65e0\u5e8f\u7684\uff0c\u4e3a\u4e86\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\u800c\u4e13\u95e8\u6267\u884c\u6570\u636e\u6392\u5e8f\uff0c\u90a3\u4e48\u662f\u5f97\u4e0d\u507f\u5931\u7684\uff0c\u56e0\u4e3a\u6392\u5e8f\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e00\u822c\u4e3a \\(O(n \\log n)\\) \uff0c\u6bd4\u7ebf\u6027\u67e5\u627e\u548c\u4e8c\u5206\u67e5\u627e\u90fd\u66f4\u5dee\u3002\u518d\u4f8b\u5982\uff0c\u5bf9\u4e8e\u9891\u7e41\u63d2\u5165\u5143\u7d20\u7684\u573a\u666f\uff0c\u4e3a\u4e86\u4fdd\u6301\u6570\u7ec4\u7684\u6709\u5e8f\u6027\uff0c\u9700\u8981\u5c06\u5143\u7d20\u63d2\u5165\u5230\u7279\u5b9a\u4f4d\u7f6e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u4e5f\u662f\u975e\u5e38\u6602\u8d35\u7684\u3002
  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\u3002\u7531\u4e8e\u5728\u4e8c\u5206\u67e5\u627e\u4e2d\uff0c\u8bbf\u95ee\u7d22\u5f15\u662f \u201c\u975e\u8fde\u7eed\u201d \u7684\uff0c\u56e0\u6b64\u94fe\u8868\u6216\u8005\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u90fd\u65e0\u6cd5\u4f7f\u7528\u3002
  • \u5728\u5c0f\u6570\u636e\u91cf\u4e0b\uff0c\u7ebf\u6027\u67e5\u627e\u7684\u6027\u80fd\u66f4\u597d\u3002\u5728\u7ebf\u6027\u67e5\u627e\u4e2d\uff0c\u6bcf\u8f6e\u53ea\u9700\u8981 1 \u6b21\u5224\u65ad\u64cd\u4f5c\uff1b\u800c\u5728\u4e8c\u5206\u67e5\u627e\u4e2d\uff0c\u9700\u8981 1 \u6b21\u52a0\u6cd5\u30011 \u6b21\u9664\u6cd5\u30011 ~ 3 \u6b21\u5224\u65ad\u64cd\u4f5c\u30011 \u6b21\u52a0\u6cd5\uff08\u51cf\u6cd5\uff09\uff0c\u5171 4 ~ 6 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u56e0\u6b64\uff0c\u5728\u6570\u636e\u91cf \\(n\\) \u8f83\u5c0f\u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u53cd\u800c\u6bd4\u4e8c\u5206\u67e5\u627e\u66f4\u5feb\u3002
"},{"location":"chapter_searching/hashing_search/","title":"10.3. \u00a0 \u54c8\u5e0c\u67e5\u627e","text":"

Question

\u5728\u6570\u636e\u91cf\u5f88\u5927\u65f6\uff0c\u300c\u7ebf\u6027\u67e5\u627e\u300d\u592a\u6162\uff1b\u800c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u8981\u6c42\u6570\u636e\u5fc5\u987b\u662f\u6709\u5e8f\u7684\uff0c\u5e76\u4e14\u53ea\u80fd\u5728\u6570\u7ec4\u4e2d\u5e94\u7528\u3002\u90a3\u4e48\u662f\u5426\u6709\u65b9\u6cd5\u53ef\u4ee5\u540c\u65f6\u907f\u514d\u4e0a\u8ff0\u7f3a\u70b9\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\uff0c\u6b64\u65b9\u6cd5\u88ab\u79f0\u4e3a\u300c\u54c8\u5e0c\u67e5\u627e\u300d\u3002

\u300c\u54c8\u5e0c\u67e5\u627e Hash Searching\u300d\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\u6765\u5b58\u50a8\u9700\u8981\u7684\u300c\u952e\u503c\u5bf9 Key Value Pair\u300d\uff0c\u6211\u4eec\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u4e0b\u5b9e\u73b0\u201c\u952e \\(\\rightarrow\\) \u503c\u201d\u6620\u5c04\u67e5\u627e\uff0c\u4f53\u73b0\u7740\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\u7684\u7b97\u6cd5\u601d\u60f3\u3002

"},{"location":"chapter_searching/hashing_search/#1031","title":"10.3.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u5982\u679c\u6211\u4eec\u60f3\u8981\u7ed9\u5b9a\u6570\u7ec4\u4e2d\u7684\u4e00\u4e2a\u76ee\u6807\u5143\u7d20 target \uff0c\u83b7\u53d6\u8be5\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u90a3\u4e48\u53ef\u4ee5\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\u5b9e\u73b0\u67e5\u627e\u3002

Fig. \u54c8\u5e0c\u67e5\u627e\u6570\u7ec4\u7d22\u5f15

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hashing_search.java
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(Map<Integer, Integer> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.getOrDefault(target, -1);\n}\n
hashing_search.cpp
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(unordered_map<int, int> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nif (map.find(target) == map.end())\nreturn -1;\nreturn map[target];\n}\n
hashing_search.py
def hashing_search_array(mapp: Dict[int, int], target: int) -> int:\n\"\"\" \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 \"\"\"\n# \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n# \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn mapp.get(target, -1)\n
hashing_search.go
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc hashingSearchArray(m map[int]int, target int) int {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nif index, ok := m[target]; ok {\nreturn index\n} else {\nreturn -1\n}\n}\n
hashing_search.js
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction hashingSearchArray(map, target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.has(target) ? map.get(target) : -1;\n}\n
hashing_search.ts
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction hashingSearchArray(map: Map<number, number>, target: number): number {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.has(target) ? (map.get(target) as number) : -1;\n}\n
hashing_search.c
[class]{}-[func]{hashingSearchArray}\n
hashing_search.cs
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(Dictionary<int, int> map, int target)\n{\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.GetValueOrDefault(target, -1);\n}\n
hashing_search.swift
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc hashingSearchArray(map: [Int: Int], target: Int) -> Int {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map[target, default: -1]\n}\n
hashing_search.zig
// \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09\nfn hashingSearchArray(comptime T: type, map: std.AutoHashMap(T, T), target: T) T {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1   \nif (map.getKey(target) == null) return -1;\nreturn map.get(target).?;\n}\n

\u518d\u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u7ed9\u5b9a\u4e00\u4e2a\u76ee\u6807\u7ed3\u70b9\u503c target \uff0c\u83b7\u53d6\u5bf9\u5e94\u7684\u94fe\u8868\u7ed3\u70b9\u5bf9\u8c61\uff0c\u90a3\u4e48\u4e5f\u53ef\u4ee5\u4f7f\u7528\u54c8\u5e0c\u67e5\u627e\u5b9e\u73b0\u3002

Fig. \u54c8\u5e0c\u67e5\u627e\u94fe\u8868\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hashing_search.java
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode hashingSearchLinkedList(Map<Integer, ListNode> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.getOrDefault(target, null);\n}\n
hashing_search.cpp
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode* hashingSearchLinkedList(unordered_map<int, ListNode*> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de nullptr\nif (map.find(target) == map.end())\nreturn nullptr;\nreturn map[target];\n}\n
hashing_search.py
def hashing_search_linkedlist(mapp: Dict[int, ListNode], target: int) -> Optional[ListNode]:\n\"\"\" \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 \"\"\"\n# \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n# \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de None\nreturn mapp.get(target, None)\n
hashing_search.go
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc hashingSearchLinkedList(m map[int]*ListNode, target int) *ListNode {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de nil\nif node, ok := m[target]; ok {\nreturn node\n} else {\nreturn nil\n}\n}\n
hashing_search.js
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunction hashingSearchLinkedList(map, target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.has(target) ? map.get(target) : null;\n}\n
hashing_search.ts
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunction hashingSearchLinkedList(map: Map<number, ListNode>, target: number): ListNode | null {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.has(target) ? (map.get(target) as ListNode) : null;\n}\n
hashing_search.c
[class]{}-[func]{hashingSearchLinkedList}\n
hashing_search.cs
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode? hashingSearchLinkedList(Dictionary<int, ListNode> map, int target)\n{\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.GetValueOrDefault(target);\n}\n
hashing_search.swift
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc hashingSearchLinkedList(map: [Int: ListNode], target: Int) -> ListNode? {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map[target]\n}\n
hashing_search.zig
// \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09\nfn hashingSearchLinkedList(comptime T: type, map: std.AutoHashMap(T, *inc.ListNode(T)), target: T) ?*inc.ListNode(T) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null \nif (map.getKey(target) == null) return null;\nreturn map.get(target);\n}\n
"},{"location":"chapter_searching/hashing_search/#1032","title":"10.3.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u54c8\u5e0c\u8868\u7684\u67e5\u627e\u64cd\u4f5c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\u3002

"},{"location":"chapter_searching/hashing_search/#1033","title":"10.3.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u5728\u54c8\u5e0c\u8868\u4e2d\uff0c\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(1)\\) \uff0c\u8fd9\u610f\u5473\u7740\u65e0\u8bba\u662f\u9ad8\u9891\u589e\u5220\u8fd8\u662f\u9ad8\u9891\u67e5\u627e\u573a\u666f\uff0c\u54c8\u5e0c\u67e5\u627e\u7684\u6027\u80fd\u8868\u73b0\u90fd\u975e\u5e38\u597d\u3002\u5f53\u7136\uff0c\u4e00\u5207\u7684\u524d\u63d0\u662f\u4fdd\u8bc1\u54c8\u5e0c\u8868\u672a\u9000\u5316\u3002

\u5373\u4f7f\u5982\u6b64\uff0c\u54c8\u5e0c\u67e5\u627e\u4ecd\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9700\u8981\u6839\u636e\u60c5\u51b5\u7075\u6d3b\u9009\u62e9\u65b9\u6cd5\u3002

  • \u8f85\u52a9\u54c8\u5e0c\u8868 \u9700\u8981\u4f7f\u7528 \\(O(n)\\) \u7684\u989d\u5916\u7a7a\u95f4\uff0c\u610f\u5473\u7740\u9700\u8981\u9884\u7559\u66f4\u591a\u7684\u8ba1\u7b97\u673a\u5185\u5b58\uff1b
  • \u5efa\u7acb\u548c\u7ef4\u62a4\u54c8\u5e0c\u8868\u9700\u8981\u65f6\u95f4\uff0c\u56e0\u6b64\u54c8\u5e0c\u67e5\u627e \u4e0d\u9002\u5408\u9ad8\u9891\u589e\u5220\u3001\u4f4e\u9891\u67e5\u627e\u7684\u4f7f\u7528\u573a\u666f\uff1b
  • \u5f53\u54c8\u5e0c\u51b2\u7a81\u4e25\u91cd\u65f6\uff0c\u54c8\u5e0c\u8868\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \uff1b
  • \u5f53\u6570\u636e\u91cf\u5f88\u5c0f\u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u6bd4\u54c8\u5e0c\u67e5\u627e\u66f4\u5feb\u3002\u8fd9\u662f\u56e0\u4e3a\u8ba1\u7b97\u54c8\u5e0c\u6620\u5c04\u51fd\u6570\u53ef\u80fd\u6bd4\u904d\u5386\u4e00\u4e2a\u5c0f\u578b\u6570\u7ec4\u66f4\u6162\uff1b
"},{"location":"chapter_searching/linear_search/","title":"10.1. \u00a0 \u7ebf\u6027\u67e5\u627e","text":"

\u300c\u7ebf\u6027\u67e5\u627e Linear Search\u300d\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u67e5\u627e\u65b9\u6cd5\uff0c\u5176\u4ece\u6570\u636e\u7ed3\u6784\u7684\u4e00\u7aef\u5f00\u59cb\uff0c\u4f9d\u6b21\u8bbf\u95ee\u6bcf\u4e2a\u5143\u7d20\uff0c\u76f4\u5230\u53e6\u4e00\u7aef\u540e\u505c\u6b62\u3002

"},{"location":"chapter_searching/linear_search/#1011","title":"10.1.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u7ebf\u6027\u67e5\u627e\u5b9e\u8d28\u4e0a\u5c31\u662f\u904d\u5386\u6570\u636e\u7ed3\u6784 + \u5224\u65ad\u6761\u4ef6\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u60f3\u8981\u5728\u6570\u7ec4 nums \u4e2d\u67e5\u627e\u76ee\u6807\u5143\u7d20 target \u7684\u5bf9\u5e94\u7d22\u5f15\uff0c\u90a3\u4e48\u53ef\u4ee5\u5728\u6570\u7ec4\u4e2d\u8fdb\u884c\u7ebf\u6027\u67e5\u627e\u3002

Fig. \u5728\u6570\u7ec4\u4e2d\u7ebf\u6027\u67e5\u627e\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linear_search.java
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(int[] nums, int target) {\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.cpp
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(vector<int>& nums, int target) {\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.size(); i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.py
def linear_search_array(nums: List[int], target: int) -> int:\n\"\"\" \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 \"\"\"\n# \u904d\u5386\u6570\u7ec4\nfor i in range(len(nums)):\nif nums[i] == target:  # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn i\nreturn -1                  # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
linear_search.go
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc linearSearchArray(nums []int, target int) int {\n// \u904d\u5386\u6570\u7ec4\nfor i := 0; i < len(nums); i++ {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif nums[i] == target {\nreturn i\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
linear_search.js
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction linearSearchArray(nums, target) {\n// \u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] === target) {\nreturn i;\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1; }\n
linear_search.ts
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09*/\nfunction linearSearchArray(nums: number[], target: number): number {\n// \u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] === target) {\nreturn i;\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.c
[class]{}-[func]{linearSearchArray}\n
linear_search.cs
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(int[] nums, int target)\n{\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.swift
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc linearSearchArray(nums: [Int], target: Int) -> Int {\n// \u904d\u5386\u6570\u7ec4\nfor i in nums.indices {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif nums[i] == target {\nreturn i\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
linear_search.zig
// \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09\nfn linearSearchArray(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u904d\u5386\u6570\u7ec4\nfor (nums.items) |num, i| {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c \u8fd4\u56de\u5176\u7d22\u5f15\nif (num == target) {\nreturn @intCast(T, i);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n

\u518d\u6bd4\u5982\uff0c\u6211\u4eec\u60f3\u8981\u5728\u7ed9\u5b9a\u4e00\u4e2a\u76ee\u6807\u7ed3\u70b9\u503c target \uff0c\u8fd4\u56de\u6b64\u7ed3\u70b9\u5bf9\u8c61\uff0c\u4e5f\u53ef\u4ee5\u5728\u94fe\u8868\u4e2d\u8fdb\u884c\u7ebf\u6027\u67e5\u627e\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linear_search.java
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode linearSearchLinkedList(ListNode head, int target) {\n// \u904d\u5386\u94fe\u8868\nwhile (head != null) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val == target)\nreturn head;\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.cpp
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode* linearSearchLinkedList(ListNode* head, int target) {\n// \u904d\u5386\u94fe\u8868\nwhile (head != nullptr) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head->val == target)\nreturn head;\nhead = head->next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de nullptr\nreturn nullptr;\n}\n
linear_search.py
def linear_search_linkedlist(head: ListNode, target: int) -> Optional[ListNode]:\n\"\"\" \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 \"\"\"\n# \u904d\u5386\u94fe\u8868\nwhile head:\nif head.val == target: # \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nreturn head\nhead = head.next\nreturn None                # \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de None\n
linear_search.go
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc linearSearchLinkedList(node *ListNode, target int) *ListNode {\n// \u904d\u5386\u94fe\u8868\nfor node != nil {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif node.Val == target {\nreturn node\n}\nnode = node.Next\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de nil\nreturn nil\n}\n
linear_search.js
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09*/\nfunction linearSearchLinkedList(head, target) {\n// \u904d\u5386\u94fe\u8868\nwhile(head) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif(head.val === target) {\nreturn head;\n}\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.ts
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09*/\nfunction linearSearchLinkedList(head: ListNode | null, target: number): ListNode | null {\n// \u904d\u5386\u94fe\u8868\nwhile (head) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val === target) {\nreturn head;\n}\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.c
[class]{}-[func]{linearSearchLinkedList}\n
linear_search.cs
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode? linearSearchLinkedList(ListNode head, int target)\n{\n// \u904d\u5386\u94fe\u8868\nwhile (head != null)\n{\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val == target)\nreturn head;\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.swift
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc linearSearchLinkedList(head: ListNode?, target: Int) -> ListNode? {\nvar head = head\n// \u904d\u5386\u94fe\u8868\nwhile head != nil {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif head?.val == target {\nreturn head\n}\nhead = head?.next\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn nil\n}\n
linear_search.zig
// \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09\nfn linearSearchLinkedList(comptime T: type, node: ?*inc.ListNode(T), target: T) ?*inc.ListNode(T) {\nvar head = node;\n// \u904d\u5386\u94fe\u8868\nwhile (head != null) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.?.val == target) return head;\nhead = head.?.next;\n}\nreturn null;\n}\n
"},{"location":"chapter_searching/linear_search/#1012","title":"10.1.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u65e0\u9700\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\u3002

"},{"location":"chapter_searching/linear_search/#1013","title":"10.1.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u7ebf\u6027\u67e5\u627e\u7684\u901a\u7528\u6027\u6781\u4f73\u3002\u7531\u4e8e\u7ebf\u6027\u67e5\u627e\u662f\u4f9d\u6b21\u8bbf\u95ee\u5143\u7d20\u7684\uff0c\u5373\u6ca1\u6709\u8df3\u8dc3\u8bbf\u95ee\u5143\u7d20\uff0c\u56e0\u6b64\u6570\u7ec4\u6216\u94fe\u8868\u7686\u9002\u7528\u3002

\u7ebf\u6027\u67e5\u627e\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u592a\u9ad8\u3002\u5728\u6570\u636e\u91cf \\(n\\) \u5f88\u5927\u65f6\uff0c\u67e5\u627e\u6548\u7387\u5f88\u4f4e\u3002

"},{"location":"chapter_searching/summary/","title":"10.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u7ebf\u6027\u67e5\u627e\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u67e5\u627e\u65b9\u6cd5\uff0c\u901a\u8fc7\u904d\u5386\u6570\u636e\u7ed3\u6784 + \u5224\u65ad\u6761\u4ef6\u5b9e\u73b0\u67e5\u627e\u3002
  • \u4e8c\u5206\u67e5\u627e\u5229\u7528\u6570\u636e\u7684\u6709\u5e8f\u6027\uff0c\u901a\u8fc7\u5faa\u73af\u4e0d\u65ad\u7f29\u5c0f\u4e00\u534a\u641c\u7d22\u533a\u95f4\u6765\u5b9e\u73b0\u67e5\u627e\uff0c\u5176\u8981\u6c42\u8f93\u5165\u6570\u636e\u662f\u6709\u5e8f\u7684\uff0c\u5e76\u4e14\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\u6216\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u3002
  • \u54c8\u5e0c\u67e5\u627e\u501f\u52a9\u54c8\u5e0c\u8868\u6765\u5b9e\u73b0\u5e38\u6570\u9636\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u67e5\u627e\u64cd\u4f5c\uff0c\u4f53\u73b0\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u7b97\u6cd5\u601d\u60f3\u3002
  • \u4e0b\u8868\u603b\u7ed3\u5bf9\u6bd4\u4e86\u67e5\u627e\u7b97\u6cd5\u7684\u5404\u79cd\u7279\u6027\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u3002
\u7ebf\u6027\u67e5\u627e \u4e8c\u5206\u67e5\u627e \u54c8\u5e0c\u67e5\u627e \u9002\u7528\u6570\u636e\u7ed3\u6784 \u6570\u7ec4\u3001\u94fe\u8868 \u6570\u7ec4 \u6570\u7ec4\u3001\u94fe\u8868 \u8f93\u5165\u6570\u636e\u8981\u6c42 \u65e0 \u6709\u5e8f \u65e0 \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u67e5\u627e / \u63d2\u5165 / \u5220\u9664 \\(O(n)\\) / \\(O(1)\\) / \\(O(n)\\) \\(O(\\log n)\\) / \\(O(n)\\) / \\(O(n)\\) \\(O(1)\\) / \\(O(1)\\) / \\(O(1)\\) \u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u67e5\u627e / \u63d2\u5165 / \u5220\u9664 \\(O(n)\\) / \\(O(1)\\) / \\(O(n)\\) \\(O(\\log n)\\) / \\(O(n)\\) / \\(O(n)\\) \\(O(n)\\) / \\(O(n)\\) / \\(O(n)\\) \u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \\(O(1)\\) \\(O(n)\\)"},{"location":"chapter_sorting/bubble_sort/","title":"11.2. \u00a0 \u5192\u6ce1\u6392\u5e8f","text":"

\u300c\u5192\u6ce1\u6392\u5e8f Bubble Sort\u300d\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u975e\u5e38\u9002\u5408\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u5b66\u4e60\u7684\u6392\u5e8f\u7b97\u6cd5\u3002\u987e\u540d\u601d\u4e49\uff0c\u300c\u5192\u6ce1\u300d\u662f\u8be5\u7b97\u6cd5\u7684\u6838\u5fc3\u64cd\u4f5c\u3002

\u4e3a\u4ec0\u4e48\u53eb\u201c\u5192\u6ce1\u201d

\u5728\u6c34\u4e2d\uff0c\u8d8a\u5927\u7684\u6ce1\u6ce1\u6d6e\u529b\u8d8a\u5927\uff0c\u6240\u4ee5\u6700\u5927\u7684\u6ce1\u6ce1\u4f1a\u6700\u5148\u6d6e\u5230\u6c34\u9762\u3002

\u300c\u5192\u6ce1\u300d\u64cd\u4f5c\u5219\u662f\u5728\u6a21\u62df\u4e0a\u8ff0\u8fc7\u7a0b\uff0c\u5177\u4f53\u505a\u6cd5\u4e3a\uff1a\u4ece\u6570\u7ec4\u6700\u5de6\u7aef\u5f00\u59cb\u5411\u53f3\u904d\u5386\uff0c\u4f9d\u6b21\u5bf9\u6bd4\u76f8\u90bb\u5143\u7d20\u5927\u5c0f\uff0c\u82e5 \u5de6\u5143\u7d20 > \u53f3\u5143\u7d20 \u5219\u5c06\u5b83\u4fe9\u4ea4\u6362\uff0c\u6700\u7ec8\u53ef\u5c06\u6700\u5927\u5143\u7d20\u79fb\u52a8\u81f3\u6570\u7ec4\u6700\u53f3\u7aef\u3002

\u5b8c\u6210\u6b64\u6b21\u5192\u6ce1\u64cd\u4f5c\u540e\uff0c\u6570\u7ec4\u6700\u5927\u5143\u7d20\u5df2\u5728\u6b63\u786e\u4f4d\u7f6e\uff0c\u63a5\u4e0b\u6765\u53ea\u9700\u6392\u5e8f\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u3002

<1><2><3><4><5><6><7>

"},{"location":"chapter_sorting/bubble_sort/#1121","title":"11.2.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u8bbe\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n\\) \uff0c\u5b8c\u6210\u7b2c\u4e00\u8f6e\u300c\u5192\u6ce1\u300d\u540e\uff0c\u6570\u7ec4\u6700\u5927\u5143\u7d20\u5df2\u5728\u6b63\u786e\u4f4d\u7f6e\uff0c\u63a5\u4e0b\u6765\u53ea\u9700\u6392\u5e8f\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u3002
  2. \u540c\u7406\uff0c\u5bf9\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u6267\u884c\u300c\u5192\u6ce1\u300d\uff0c\u53ef\u5c06\u7b2c\u4e8c\u5927\u5143\u7d20\u4ea4\u6362\u81f3\u6b63\u786e\u4f4d\u7f6e\uff0c\u56e0\u800c\u5f85\u6392\u5e8f\u5143\u7d20\u53ea\u5269 \\(n - 2\\) \u4e2a\u3002
  3. \u4ee5\u6b64\u7c7b\u63a8\u2026\u2026 \u5faa\u73af \\(n - 1\\) \u8f6e\u300c\u5192\u6ce1\u300d\uff0c\u5373\u53ef\u5b8c\u6210\u6574\u4e2a\u6570\u7ec4\u7684\u6392\u5e8f\u3002

Fig. \u5192\u6ce1\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig bubble_sort.java
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(int[] nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.cpp
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\n// \u8fd9\u91cc\u4f7f\u7528\u4e86 std::swap() \u51fd\u6570\nswap(nums[j], nums[j + 1]);\n}\n}\n}\n}\n
bubble_sort.py
def bubble_sort(nums: List[int]) -> None:\n\"\"\" \u5192\u6ce1\u6392\u5e8f \"\"\"\nn: int = len(nums)\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(n - 1, 0, -1):\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j + 1] = nums[j + 1], nums[j]\n
bubble_sort.go
/* \u5192\u6ce1\u6392\u5e8f */\nfunc bubbleSort(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j+1] = nums[j+1], nums[j]\n}\n}\n}\n}\n
bubble_sort.js
/* \u5192\u6ce1\u6392\u5e8f */\nfunction bubbleSort(nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.ts
/* \u5192\u6ce1\u6392\u5e8f */\nfunction bubbleSort(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.c
[class]{}-[func]{bubbleSort}\n
bubble_sort.cs
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.swift
/* \u5192\u6ce1\u6392\u5e8f */\nfunc bubbleSort(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in stride(from: nums.count - 1, to: 0, by: -1) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in stride(from: 0, to: i, by: 1) {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\n}\n}\n}\n}\n
bubble_sort.zig
// \u5192\u6ce1\u6392\u5e8f\nfn bubbleSort(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: usize = nums.len - 1;\nwhile (i > 0) : (i -= 1) {\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
"},{"location":"chapter_sorting/bubble_sort/#1122","title":"11.2.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u5404\u8f6e\u300c\u5192\u6ce1\u300d\u904d\u5386\u7684\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n - 1\\) , \\(n - 2\\) , \\(\\cdots\\) , \\(2\\) , \\(1\\) \u6b21\uff0c\u6c42\u548c\u4e3a \\(\\frac{(n - 1) n}{2}\\) \uff0c\u56e0\u6b64\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 \\(i\\) , \\(j\\) \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\u3002

\u539f\u5730\u6392\u5e8f\uff1a\u6307\u9488\u53d8\u91cf\u4ec5\u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u989d\u5916\u7a7a\u95f4\u3002

\u7a33\u5b9a\u6392\u5e8f\uff1a\u4e0d\u4ea4\u6362\u76f8\u7b49\u5143\u7d20\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u5f15\u5165 flag \u4f18\u5316\u540e\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \u3002

"},{"location":"chapter_sorting/bubble_sort/#1123","title":"11.2.3. \u00a0 \u6548\u7387\u4f18\u5316","text":"

\u6211\u4eec\u53d1\u73b0\uff0c\u82e5\u5728\u67d0\u8f6e\u300c\u5192\u6ce1\u300d\u4e2d\u672a\u6267\u884c\u4efb\u4f55\u4ea4\u6362\u64cd\u4f5c\uff0c\u5219\u8bf4\u660e\u6570\u7ec4\u5df2\u7ecf\u5b8c\u6210\u6392\u5e8f\uff0c\u53ef\u76f4\u63a5\u8fd4\u56de\u7ed3\u679c\u3002\u8003\u8651\u53ef\u4ee5\u589e\u52a0\u4e00\u4e2a\u6807\u5fd7\u4f4d flag \u6765\u76d1\u542c\u8be5\u60c5\u51b5\uff0c\u82e5\u51fa\u73b0\u5219\u76f4\u63a5\u8fd4\u56de\u3002

\u4f18\u5316\u540e\uff0c\u5192\u6ce1\u6392\u5e8f\u7684\u6700\u5dee\u548c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(n^2)\\) \uff1b\u800c\u5728\u8f93\u5165\u6570\u7ec4 \u5df2\u6392\u5e8f \u65f6\uff0c\u8fbe\u5230 \u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig bubble_sort.java
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(int[] nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\nboolean flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.cpp
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\nbool flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\n// \u8fd9\u91cc\u4f7f\u7528\u4e86 std::swap() \u51fd\u6570\nswap(nums[j], nums[j + 1]);\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.py
def bubble_sort_with_flag(nums: List[int]) -> None:\n\"\"\" \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09 \"\"\"\nn: int = len(nums)\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(n - 1, 0, -1):\nflag: bool = False  # \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j + 1] = nums[j + 1], nums[j]\nflag = True  # \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\nif not flag:\nbreak            # \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n
bubble_sort.go
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunc bubbleSortWithFlag(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\nflag := false // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j+1] = nums[j+1], nums[j]\nflag = true // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif flag == false { // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\nbreak\n}\n}\n}\n
bubble_sort.js
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunction bubbleSortWithFlag(nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\nlet flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.ts
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunction bubbleSortWithFlag(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\nlet flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true; // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break; // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.c
[class]{}-[func]{bubbleSortWithFlag}\n
bubble_sort.cs
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\nbool flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.swift
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunc bubbleSortWithFlag(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in stride(from: nums.count - 1, to: 0, by: -1) {\nvar flag = false // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\nfor j in stride(from: 0, to: i, by: 1) {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\nflag = true // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif !flag { // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\nbreak\n}\n}\n}\n
bubble_sort.zig
// \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09\nfn bubbleSortWithFlag(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: usize = nums.len - 1;\nwhile (i > 0) : (i -= 1) {\nvar flag = false;   // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;\n}\n}\nif (!flag) break;   // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
"},{"location":"chapter_sorting/insertion_sort/","title":"11.3. \u00a0 \u63d2\u5165\u6392\u5e8f","text":"

\u300c\u63d2\u5165\u6392\u5e8f Insertion Sort\u300d\u662f\u4e00\u79cd\u57fa\u4e8e \u6570\u7ec4\u63d2\u5165\u64cd\u4f5c \u7684\u6392\u5e8f\u7b97\u6cd5\u3002

\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u539f\u7406\uff1a\u9009\u5b9a\u67d0\u4e2a\u5f85\u6392\u5e8f\u5143\u7d20\u4e3a\u57fa\u51c6\u6570 base\uff0c\u5c06 base \u4e0e\u5176\u5de6\u4fa7\u5df2\u6392\u5e8f\u533a\u95f4\u5143\u7d20\u4f9d\u6b21\u5bf9\u6bd4\u5927\u5c0f\uff0c\u5e76\u63d2\u5165\u5230\u6b63\u786e\u4f4d\u7f6e\u3002

\u56de\u5fc6\u6570\u7ec4\u63d2\u5165\u64cd\u4f5c\uff0c\u6211\u4eec\u9700\u8981\u5c06\u4ece\u76ee\u6807\u7d22\u5f15\u5230 base \u4e4b\u95f4\u7684\u6240\u6709\u5143\u7d20\u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\uff0c\u7136\u540e\u518d\u5c06 base \u8d4b\u503c\u7ed9\u76ee\u6807\u7d22\u5f15\u3002

Fig. \u5355\u6b21\u63d2\u5165\u64cd\u4f5c

"},{"location":"chapter_sorting/insertion_sort/#1131","title":"11.3.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u7b2c 1 \u8f6e\u5148\u9009\u53d6\u6570\u7ec4\u7684 \u7b2c 2 \u4e2a\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6570\u7ec4\u524d 2 \u4e2a\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002
  2. \u7b2c 2 \u8f6e\u9009\u53d6 \u7b2c 3 \u4e2a\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6570\u7ec4\u524d 3 \u4e2a\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002
  3. \u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u6700\u540e\u4e00\u8f6e\u9009\u53d6 \u6570\u7ec4\u5c3e\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6240\u6709\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002

Fig. \u63d2\u5165\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig insertion_sort.java
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(int[] nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.length; i++) {\nint base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.cpp
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.size(); i++) {\nint base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.py
def insertion_sort(nums: List[int]) -> None:\n\"\"\" \u63d2\u5165\u6392\u5e8f \"\"\"\n# \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]   \nfor i in range(1, len(nums)):\nbase: int = nums[i]\nj: int = i - 1\n# \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile j >= 0 and nums[j] > base:\nnums[j + 1] = nums[j]  # 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj -= 1\nnums[j + 1] = base         # 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n
insertion_sort.go
/* \u63d2\u5165\u6392\u5e8f */\nfunc insertionSort(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := 1; i < len(nums); i++ {\nbase := nums[i]\nj := i - 1\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nfor j >= 0 && nums[j] > base {\nnums[j+1] = nums[j] // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--\n}\nnums[j+1] = base // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.js
/* \u63d2\u5165\u6392\u5e8f */\nfunction insertionSort(nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (let i = 1; i < nums.length; i++) {\nlet base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.ts
/* \u63d2\u5165\u6392\u5e8f */\nfunction insertionSort(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (let i = 1; i < nums.length; i++) {\nconst base = nums[i];\nlet j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j]; // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base; // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.c
[class]{}-[func]{insertionSort}\n
insertion_sort.cs
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.Length; i++)\n{\nint bas = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > bas)\n{\nnums[j + 1] = nums[j]; // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = bas;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.swift
/* \u63d2\u5165\u6392\u5e8f */\nfunc insertionSort(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor i in stride(from: 1, to: nums.count, by: 1) {\nlet base = nums[i]\nvar j = i - 1\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile j >= 0, nums[j] > base {\nnums[j + 1] = nums[j] // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj -= 1\n}\nnums[j + 1] = base // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.zig
// \u63d2\u5165\u6392\u5e8f\nfn insertionSort(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nvar i: usize = 1;\nwhile (i < nums.len) : (i += 1) {\nvar base = nums[i];\nvar j: usize = i;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 1 and nums[j - 1] > base) : (j -= 1) {\nnums[j] = nums[j - 1];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\n}\nnums[j] = base;             // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
"},{"location":"chapter_sorting/insertion_sort/#1132","title":"11.3.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u5404\u8f6e\u63d2\u5165\u64cd\u4f5c\u5faa\u73af \\(n - 1\\) , \\(n-2\\) , \\(\\cdots\\) , \\(2\\) , \\(1\\) \u6b21\uff0c\u6c42\u548c\u4e3a \\(\\frac{(n - 1) n}{2}\\) \uff0c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 \\(i\\) , \\(j\\) \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\u3002

\u539f\u5730\u6392\u5e8f\uff1a\u6307\u9488\u53d8\u91cf\u4ec5\u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u989d\u5916\u7a7a\u95f4\u3002

\u7a33\u5b9a\u6392\u5e8f\uff1a\u4e0d\u4ea4\u6362\u76f8\u7b49\u5143\u7d20\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u6700\u4f73\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \u3002

"},{"location":"chapter_sorting/insertion_sort/#1133-vs","title":"11.3.3. \u00a0 \u63d2\u5165\u6392\u5e8f vs \u5192\u6ce1\u6392\u5e8f","text":"

Question

\u867d\u7136\u300c\u63d2\u5165\u6392\u5e8f\u300d\u548c\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(n^2)\\) \uff0c\u4f46\u5b9e\u9645\u8fd0\u884c\u901f\u5ea6\u5374\u6709\u5f88\u5927\u5dee\u522b\uff0c\u8fd9\u662f\u4e3a\u4ec0\u4e48\u5462\uff1f

\u56de\u987e\u590d\u6742\u5ea6\u5206\u6790\uff0c\u4e24\u4e2a\u65b9\u6cd5\u7684\u5faa\u73af\u6b21\u6570\u90fd\u662f \\(\\frac{(n - 1) n}{2}\\) \u3002\u4f46\u4e0d\u540c\u7684\u662f\uff0c\u300c\u5192\u6ce1\u64cd\u4f5c\u300d\u662f\u5728\u505a \u5143\u7d20\u4ea4\u6362\uff0c\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u4e34\u65f6\u53d8\u91cf\u5b9e\u73b0\uff0c\u5171 3 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u800c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u662f\u5728\u505a \u8d4b\u503c\uff0c\u53ea\u9700 1 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u56e0\u6b64\uff0c\u53ef\u4ee5\u7c97\u7565\u4f30\u8ba1\u51fa\u5192\u6ce1\u6392\u5e8f\u7684\u8ba1\u7b97\u5f00\u9500\u7ea6\u4e3a\u63d2\u5165\u6392\u5e8f\u7684 3 \u500d\u3002

\u63d2\u5165\u6392\u5e8f\u8fd0\u884c\u901f\u5ea6\u5feb\uff0c\u5e76\u4e14\u5177\u6709\u539f\u5730\u3001\u7a33\u5b9a\u3001\u81ea\u9002\u5e94\u7684\u4f18\u70b9\uff0c\u56e0\u6b64\u5f88\u53d7\u6b22\u8fce\u3002\u5b9e\u9645\u4e0a\uff0c\u5305\u62ec Java \u5728\u5185\u7684\u8bb8\u591a\u7f16\u7a0b\u8bed\u8a00\u7684\u6392\u5e8f\u5e93\u51fd\u6570\u7684\u5b9e\u73b0\u90fd\u7528\u5230\u4e86\u63d2\u5165\u6392\u5e8f\u3002\u5e93\u51fd\u6570\u7684\u5927\u81f4\u601d\u8def\uff1a

  • \u5bf9\u4e8e \u957f\u6570\u7ec4\uff0c\u91c7\u7528\u57fa\u4e8e\u5206\u6cbb\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u4f8b\u5982\u300c\u5feb\u901f\u6392\u5e8f\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \uff1b
  • \u5bf9\u4e8e \u77ed\u6570\u7ec4\uff0c\u76f4\u63a5\u4f7f\u7528\u300c\u63d2\u5165\u6392\u5e8f\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff1b

\u5728\u6570\u7ec4\u8f83\u77ed\u65f6\uff0c\u590d\u6742\u5ea6\u4e2d\u7684\u5e38\u6570\u9879\uff08\u5373\u6bcf\u8f6e\u4e2d\u7684\u5355\u5143\u64cd\u4f5c\u6570\u91cf\uff09\u5360\u4e3b\u5bfc\u4f5c\u7528\uff0c\u6b64\u65f6\u63d2\u5165\u6392\u5e8f\u8fd0\u884c\u5730\u66f4\u5feb\u3002\u8fd9\u4e2a\u73b0\u8c61\u4e0e\u300c\u7ebf\u6027\u67e5\u627e\u300d\u548c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7684\u60c5\u51b5\u7c7b\u4f3c\u3002

"},{"location":"chapter_sorting/intro_to_sort/","title":"11.1. \u00a0 \u6392\u5e8f\u7b80\u4ecb","text":"

\u300c\u6392\u5e8f\u7b97\u6cd5 Sorting Algorithm\u300d\u4f7f\u5f97\u5217\u8868\u4e2d\u7684\u6240\u6709\u5143\u7d20\u6309\u7167\u4ece\u5c0f\u5230\u5927\u7684\u987a\u5e8f\u6392\u5217\u3002

  • \u5f85\u6392\u5e8f\u7684\u5217\u8868\u7684 \u5143\u7d20\u7c7b\u578b \u53ef\u4ee5\u662f\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u3001\u6216\u5b57\u7b26\u4e32\uff1b
  • \u6392\u5e8f\u7b97\u6cd5\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8bbe\u5b9a \u5224\u65ad\u89c4\u5219\uff0c\u4f8b\u5982\u6570\u5b57\u5927\u5c0f\u3001\u5b57\u7b26 ASCII \u7801\u987a\u5e8f\u3001\u81ea\u5b9a\u4e49\u89c4\u5219\uff1b

Fig. \u6392\u5e8f\u4e2d\u4e0d\u540c\u7684\u5143\u7d20\u7c7b\u578b\u548c\u5224\u65ad\u89c4\u5219

"},{"location":"chapter_sorting/intro_to_sort/#1111","title":"11.1.1. \u00a0 \u8bc4\u4ef7\u7ef4\u5ea6","text":"

\u6392\u5e8f\u7b97\u6cd5\u4e3b\u8981\u53ef\u6839\u636e \u7a33\u5b9a\u6027 \u3001\u5c31\u5730\u6027 \u3001\u81ea\u9002\u5e94\u6027 \u3001\u6bd4\u8f83\u7c7b \u6765\u5206\u7c7b\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_1","title":"\u7a33\u5b9a\u6027","text":"
  • \u300c\u7a33\u5b9a\u6392\u5e8f\u300d\u5728\u5b8c\u6210\u6392\u5e8f\u540e\uff0c\u4e0d\u6539\u53d8 \u76f8\u7b49\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u76f8\u5bf9\u987a\u5e8f\u3002
  • \u300c\u975e\u7a33\u5b9a\u6392\u5e8f\u300d\u5728\u5b8c\u6210\u6392\u5e8f\u540e\uff0c\u76f8\u7b49\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u76f8\u5bf9\u4f4d\u7f6e \u53ef\u80fd\u88ab\u6539\u53d8\u3002

\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5b58\u50a8\u5b66\u751f\u4fe1\u606f\u7684\u8868\u683c\uff0c\u7b2c 1, 2 \u5217\u5206\u522b\u662f\u59d3\u540d\u548c\u5e74\u9f84\u3002\u90a3\u4e48\u5728\u4ee5\u4e0b\u793a\u4f8b\u4e2d\uff0c\u300c\u975e\u7a33\u5b9a\u6392\u5e8f\u300d\u4f1a\u5bfc\u81f4\u8f93\u5165\u6570\u636e\u7684\u6709\u5e8f\u6027\u4e22\u5931\u3002\u56e0\u6b64\u300c\u7a33\u5b9a\u6392\u5e8f\u300d\u662f\u5f88\u597d\u7684\u7279\u6027\uff0c\u5728\u591a\u7ea7\u6392\u5e8f\u4e2d\u662f\u5fc5\u987b\u7684\u3002

# \u8f93\u5165\u6570\u636e\u662f\u6309\u7167\u59d3\u540d\u6392\u5e8f\u597d\u7684\n# (name, age)\n('A', 19)\n('B', 18)\n('C', 21)\n('D', 19)\n('E', 23)\n# \u5047\u8bbe\u4f7f\u7528\u975e\u7a33\u5b9a\u6392\u5e8f\u7b97\u6cd5\u6309\u5e74\u9f84\u6392\u5e8f\u5217\u8868\uff0c\n# \u7ed3\u679c\u4e2d ('D', 19) \u548c ('A', 19) \u7684\u76f8\u5bf9\u4f4d\u7f6e\u6539\u53d8\uff0c\n# \u8f93\u5165\u6570\u636e\u6309\u59d3\u540d\u6392\u5e8f\u7684\u6027\u8d28\u4e22\u5931\n('B', 18)\n('D', 19)\n('A', 19)\n('C', 21)\n('E', 23)\n
"},{"location":"chapter_sorting/intro_to_sort/#_2","title":"\u5c31\u5730\u6027","text":"
  • \u300c\u539f\u5730\u6392\u5e8f\u300d\u65e0\u9700\u8f85\u52a9\u6570\u636e\uff0c\u4e0d\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff1b
  • \u300c\u975e\u539f\u5730\u6392\u5e8f\u300d\u9700\u8981\u501f\u52a9\u8f85\u52a9\u6570\u636e\uff0c\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff1b

\u300c\u539f\u5730\u6392\u5e8f\u300d\u4e0d\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff0c\u53ef\u4ee5\u8282\u7ea6\u5185\u5b58\uff1b\u5e76\u4e14\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u7531\u4e8e\u6570\u636e\u64cd\u4f5c\u51cf\u5c11\uff0c\u539f\u5730\u6392\u5e8f\u7684\u8fd0\u884c\u6548\u7387\u4e5f\u66f4\u9ad8\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_3","title":"\u81ea\u9002\u5e94\u6027","text":"
  • \u300c\u81ea\u9002\u5e94\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u53d7\u8f93\u5165\u6570\u636e\u5f71\u54cd\uff0c\u5373\u6700\u4f73 / \u6700\u5dee / \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u76f8\u7b49\u3002
  • \u300c\u975e\u81ea\u9002\u5e94\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6052\u5b9a\uff0c\u4e0e\u8f93\u5165\u6570\u636e\u65e0\u5173\u3002

\u6211\u4eec\u5e0c\u671b \u6700\u5dee = \u5e73\u5747\uff0c\u5373\u4e0d\u5e0c\u671b\u6392\u5e8f\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u5728\u67d0\u4e9b\u8f93\u5165\u6570\u636e\u4e0b\u53d1\u751f\u52a3\u5316\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_4","title":"\u6bd4\u8f83\u7c7b","text":"
  • \u300c\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u57fa\u4e8e\u5143\u7d20\u4e4b\u95f4\u7684\u6bd4\u8f83\u7b97\u5b50\uff08\u5c0f\u4e8e\u3001\u76f8\u7b49\u3001\u5927\u4e8e\uff09\u6765\u51b3\u5b9a\u5143\u7d20\u7684\u76f8\u5bf9\u987a\u5e8f\u3002
  • \u300c\u975e\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u4e0d\u57fa\u4e8e\u5143\u7d20\u4e4b\u95f4\u7684\u6bd4\u8f83\u7b97\u5b50\u6765\u51b3\u5b9a\u5143\u7d20\u7684\u76f8\u5bf9\u987a\u5e8f\u3002

\u300c\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6700\u4f18\u4e3a \\(O(n \\log n)\\) \uff1b\u800c\u300c\u975e\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u53ef\u4ee5\u8fbe\u5230 \\(O(n)\\) \u7684\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u4f46\u901a\u7528\u6027\u8f83\u5dee\u3002

"},{"location":"chapter_sorting/intro_to_sort/#1112","title":"11.1.2. \u00a0 \u7406\u60f3\u6392\u5e8f\u7b97\u6cd5","text":"
  • \u8fd0\u884c\u5feb\uff0c\u5373\u65f6\u95f4\u590d\u6742\u5ea6\u4f4e\uff1b
  • \u7a33\u5b9a\u6392\u5e8f\uff0c\u5373\u6392\u5e8f\u540e\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u4e0d\u53d8\u5316\uff1b
  • \u539f\u5730\u6392\u5e8f\uff0c\u5373\u8fd0\u884c\u4e2d\u4e0d\u4f7f\u7528\u989d\u5916\u7684\u8f85\u52a9\u7a7a\u95f4\uff1b
  • \u6b63\u5411\u81ea\u9002\u5e94\u6027\uff0c\u5373\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u4e0d\u4f1a\u5728\u67d0\u4e9b\u8f93\u5165\u6570\u636e\u4e0b\u53d1\u751f\u52a3\u5316\uff1b

\u7136\u800c\uff0c\u6ca1\u6709\u6392\u5e8f\u7b97\u6cd5\u540c\u65f6\u5177\u5907\u4ee5\u4e0a\u6240\u6709\u7279\u6027\u3002\u6392\u5e8f\u7b97\u6cd5\u7684\u9009\u578b\u4f7f\u7528\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5217\u8868\u7c7b\u578b\u3001\u5217\u8868\u957f\u5ea6\u3001\u5143\u7d20\u5206\u5e03\u7b49\u56e0\u7d20\u3002

"},{"location":"chapter_sorting/merge_sort/","title":"11.5. \u00a0 \u5f52\u5e76\u6392\u5e8f","text":"

\u300c\u5f52\u5e76\u6392\u5e8f Merge Sort\u300d\u662f\u7b97\u6cd5\u4e2d\u201c\u5206\u6cbb\u601d\u60f3\u201d\u7684\u5178\u578b\u4f53\u73b0\uff0c\u5176\u6709\u300c\u5212\u5206\u300d\u548c\u300c\u5408\u5e76\u300d\u4e24\u4e2a\u9636\u6bb5\uff1a

  1. \u5212\u5206\u9636\u6bb5\uff1a\u901a\u8fc7\u9012\u5f52\u4e0d\u65ad \u5c06\u6570\u7ec4\u4ece\u4e2d\u70b9\u4f4d\u7f6e\u5212\u5206\u5f00\uff0c\u5c06\u957f\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\u8f6c\u5316\u4e3a\u77ed\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\uff1b
  2. \u5408\u5e76\u9636\u6bb5\uff1a\u5212\u5206\u5230\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\uff0c\u5f00\u59cb\u5411\u4e0a\u5408\u5e76\uff0c\u4e0d\u65ad\u5c06 \u5de6\u3001\u53f3\u4e24\u4e2a\u77ed\u6392\u5e8f\u6570\u7ec4 \u5408\u5e76\u4e3a \u4e00\u4e2a\u957f\u6392\u5e8f\u6570\u7ec4\uff0c\u76f4\u81f3\u5408\u5e76\u81f3\u539f\u6570\u7ec4\u65f6\u5b8c\u6210\u6392\u5e8f\uff1b

Fig. \u5f52\u5e76\u6392\u5e8f\u7684\u5212\u5206\u4e0e\u5408\u5e76\u9636\u6bb5

"},{"location":"chapter_sorting/merge_sort/#1151","title":"11.5.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"

\u300c\u9012\u5f52\u5212\u5206\u300d \u4ece\u9876\u81f3\u5e95\u9012\u5f52\u5730 \u5c06\u6570\u7ec4\u4ece\u4e2d\u70b9\u5207\u4e3a\u4e24\u4e2a\u5b50\u6570\u7ec4\uff0c\u76f4\u81f3\u957f\u5ea6\u4e3a 1 \uff1b

  1. \u8ba1\u7b97\u6570\u7ec4\u4e2d\u70b9 mid \uff0c\u9012\u5f52\u5212\u5206\u5de6\u5b50\u6570\u7ec4\uff08\u533a\u95f4 [left, mid] \uff09\u548c\u53f3\u5b50\u6570\u7ec4\uff08\u533a\u95f4 [mid + 1, right] \uff09\uff1b
  2. \u9012\u5f52\u6267\u884c 1. \u6b65\u9aa4\uff0c\u76f4\u81f3\u5b50\u6570\u7ec4\u533a\u95f4\u957f\u5ea6\u4e3a 1 \u65f6\uff0c\u7ec8\u6b62\u9012\u5f52\u5212\u5206\uff1b

\u300c\u56de\u6eaf\u5408\u5e76\u300d \u4ece\u5e95\u81f3\u9876\u5730\u5c06\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\u5408\u5e76\u4e3a\u4e00\u4e2a \u6709\u5e8f\u6570\u7ec4 \uff1b

\u9700\u8981\u6ce8\u610f\uff0c\u7531\u4e8e\u4ece\u957f\u5ea6\u4e3a 1 \u7684\u5b50\u6570\u7ec4\u5f00\u59cb\u5408\u5e76\uff0c\u6240\u4ee5 \u6bcf\u4e2a\u5b50\u6570\u7ec4\u90fd\u662f\u6709\u5e8f\u7684\u3002\u56e0\u6b64\uff0c\u5408\u5e76\u4efb\u52a1\u672c\u8d28\u662f\u8981 \u5c06\u4e24\u4e2a\u6709\u5e8f\u5b50\u6570\u7ec4\u5408\u5e76\u4e3a\u4e00\u4e2a\u6709\u5e8f\u6570\u7ec4\u3002

<1><2><3><4><5><6><7><8><9><10>

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5f52\u5e76\u6392\u5e8f\u7684\u9012\u5f52\u987a\u5e8f\u5c31\u662f\u4e8c\u53c9\u6811\u7684\u300c\u540e\u5e8f\u904d\u5386\u300d\u3002

  • \u540e\u5e8f\u904d\u5386\uff1a\u5148\u9012\u5f52\u5de6\u5b50\u6811\u3001\u518d\u9012\u5f52\u53f3\u5b50\u6811\u3001\u6700\u540e\u5904\u7406\u6839\u7ed3\u70b9\u3002
  • \u5f52\u5e76\u6392\u5e8f\uff1a\u5148\u9012\u5f52\u5de6\u5b50\u6811\u3001\u518d\u9012\u5f52\u53f3\u5b50\u6811\u3001\u6700\u540e\u5904\u7406\u5408\u5e76\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig merge_sort.java
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(int[] nums, int left, int mid, int right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nint[] tmp = Arrays.copyOfRange(nums, left, right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(int[] nums, int left, int right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.cpp
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(vector<int>& nums, int left, int mid, int right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nvector<int> tmp(nums.begin() + left, nums.begin() + right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(vector<int>& nums, int left, int right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.py
def merge(nums: List[int], left: int, mid: int, right: int) -> None:\n\"\"\" \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 \"\"\"\n# \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n# \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\n# \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4 \u501f\u52a9 copy\u6a21\u5757\ntmp: List[int] = nums[left:right + 1].copy()\n# \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nleft_start: int = 0\nleft_end: int = mid - left\n# \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nright_start: int = mid + 1 - left\nright_end: int = right - left\n# i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\ni: int = left_start\nj: int = right_start\n# \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k in range(left, right + 1):\n# \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > left_end:\nnums[k] = tmp[j]\nj += 1\n# \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelif j > right_end or tmp[i] <= tmp[j]:\nnums[k] = tmp[i]\ni += 1\n# \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse:\nnums[k] = tmp[j]\nj += 1\ndef merge_sort(nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5f52\u5e76\u6392\u5e8f \"\"\"\n# \u7ec8\u6b62\u6761\u4ef6\nif left >= right:\nreturn                        # \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n# \u5212\u5206\u9636\u6bb5\nmid: int = (left + right) // 2    # \u8ba1\u7b97\u4e2d\u70b9\nmerge_sort(nums, left, mid)       # \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmerge_sort(nums, mid + 1, right)  # \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n# \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right)\n
merge_sort.go
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunc merge(nums []int, left, mid, right int) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4 \u501f\u52a9 copy \u6a21\u5757\ntmp := make([]int, right-left+1)\nfor i := left; i <= right; i++ {\ntmp[i-left] = nums[i]\n}\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nleftStart, leftEnd := left-left, mid-left\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nrightStart, rightEnd := mid+1-left, right-left\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\ni, j := leftStart, rightStart\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k := left; k <= right; k++ {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > leftEnd {\nnums[k] = tmp[j]\nj++\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if j > rightEnd || tmp[i] <= tmp[j] {\nnums[k] = tmp[i]\ni++\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j]\nj++\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunc mergeSort(nums []int, left, right int) {\n// \u7ec8\u6b62\u6761\u4ef6\nif left >= right {\nreturn\n}\n// \u5212\u5206\u9636\u6bb5\nmid := (left + right) / 2\nmergeSort(nums, left, mid)\nmergeSort(nums, mid+1, right)\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right)\n}\n
merge_sort.js
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunction merge(nums, left, mid, right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = nums.slice(left, right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nlet leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nlet rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nlet i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (let k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if (j > rightEnd || tmp[i] <= tmp[j]) {\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j++];\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunction mergeSort(nums, left, right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nlet mid = Math.floor((left + right) / 2);    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.ts
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunction merge(nums: number[], left: number, mid: number, right: number): void {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = nums.slice(left, right + 1);\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nlet i = leftStart, j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (let k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if (j > rightEnd || tmp[i] <= tmp[j]) {\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j++];\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunction mergeSort(nums: number[], left: number, right: number): void {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return; // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nlet mid = Math.floor((left + right) / 2); // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid); // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.c
\n
merge_sort.cs
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(int[] nums, int left, int mid, int right)\n{\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nint[] tmp = nums[left..(right + 1)];\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++)\n{\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(int[] nums, int left, int right)\n{\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.swift
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunc merge(nums: inout [Int], left: Int, mid: Int, right: Int) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = Array(nums[left ..< (right + 1)])\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet leftStart = left - left\nlet leftEnd = mid - left\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet rightStart = mid + 1 - left\nlet rightEnd = right - left\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nvar i = leftStart\nvar j = rightStart\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k in left ... right {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > leftEnd {\nnums[k] = tmp[j]\nj += 1\n}\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if j > rightEnd || tmp[i] <= tmp[j] {\nnums[k] = tmp[i]\ni += 1\n}\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse {\nnums[k] = tmp[j]\nj += 1\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunc mergeSort(nums: inout [Int], left: Int, right: Int) {\n// \u7ec8\u6b62\u6761\u4ef6\nif left >= right { // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nreturn\n}\n// \u5212\u5206\u9636\u6bb5\nlet mid = (left + right) / 2 // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums: &nums, left: left, right: mid) // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums: &nums, left: mid + 1, right: right) // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums: &nums, left: left, mid: mid, right: right)\n}\n
merge_sort.zig
// \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfn merge(nums: []i32, left: usize, mid: usize, right: usize) !void {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nvar mem_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);\ndefer mem_arena.deinit();\nconst mem_allocator = mem_arena.allocator();\nvar tmp = try mem_allocator.alloc(i32, right + 1 - left);\nstd.mem.copy(i32, tmp, nums[left..right+1]);\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nvar leftStart = left - left;\nvar leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nvar rightStart = mid + 1 - left;\nvar rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nvar i = leftStart;\nvar j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nvar k = left;\nwhile (k <= right) : (k += 1) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j];\nj += 1;\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if  (j > rightEnd or tmp[i] <= tmp[j]) {\nnums[k] = tmp[i];\ni += 1;\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j];\nj += 1;\n}\n}\n}\n// \u5f52\u5e76\u6392\u5e8f\nfn mergeSort(nums: []i32, left: usize, right: usize) !void {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;              // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nvar mid = (left + right) / 2;           // \u8ba1\u7b97\u4e2d\u70b9\ntry mergeSort(nums, left, mid);         // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\ntry mergeSort(nums, mid + 1, right);    // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\ntry merge(nums, left, mid, right);\n}\n

\u4e0b\u9762\u91cd\u70b9\u89e3\u91ca\u4e00\u4e0b\u5408\u5e76\u65b9\u6cd5 merge() \u7684\u6d41\u7a0b\uff1a

  1. \u521d\u59cb\u5316\u4e00\u4e2a\u8f85\u52a9\u6570\u7ec4 tmp \u6682\u5b58\u5f85\u5408\u5e76\u533a\u95f4 [left, right] \u5185\u7684\u5143\u7d20\uff0c\u540e\u7eed\u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u7684\u5143\u7d20\u6765\u5b9e\u73b0\u5408\u5e76\uff1b
  2. \u521d\u59cb\u5316\u6307\u9488 i , j , k \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u3001\u539f\u6570\u7ec4\u7684\u9996\u5143\u7d20\uff1b
  3. \u5faa\u73af\u5224\u65ad tmp[i] \u548c tmp[j] \u7684\u5927\u5c0f\uff0c\u5c06\u8f83\u5c0f\u7684\u5148\u8986\u76d6\u81f3 nums[k] \uff0c\u6307\u9488 i , j \u6839\u636e\u5224\u65ad\u7ed3\u679c\u4ea4\u66ff\u524d\u8fdb\uff08\u6307\u9488 k \u4e5f\u524d\u8fdb\uff09\uff0c\u76f4\u81f3\u4e24\u4e2a\u5b50\u6570\u7ec4\u90fd\u904d\u5386\u5b8c\uff0c\u5373\u53ef\u5b8c\u6210\u5408\u5e76\u3002

\u5408\u5e76\u65b9\u6cd5 merge() \u4ee3\u7801\u4e2d\u7684\u4e3b\u8981\u96be\u70b9\uff1a

  • nums \u7684\u5f85\u5408\u5e76\u533a\u95f4\u4e3a [left, right] \uff0c\u800c\u56e0\u4e3a tmp \u53ea\u590d\u5236\u4e86 nums \u8be5\u533a\u95f4\u5143\u7d20\uff0c\u6240\u4ee5 tmp \u5bf9\u5e94\u533a\u95f4\u4e3a [0, right - left] \uff0c\u9700\u8981\u7279\u522b\u6ce8\u610f\u4ee3\u7801\u4e2d\u5404\u4e2a\u53d8\u91cf\u7684\u542b\u4e49\u3002
  • \u5224\u65ad tmp[i] \u548c tmp[j] \u7684\u5927\u5c0f\u7684\u64cd\u4f5c\u4e2d\uff0c\u8fd8 \u9700\u8003\u8651\u5f53\u5b50\u6570\u7ec4\u904d\u5386\u5b8c\u6210\u540e\u7684\u7d22\u5f15\u8d8a\u754c\u95ee\u9898\uff0c\u5373 i > leftEnd \u548c j > rightEnd \u7684\u60c5\u51b5\uff0c\u7d22\u5f15\u8d8a\u754c\u7684\u4f18\u5148\u7ea7\u662f\u6700\u9ad8\u7684\uff0c\u4f8b\u5982\u5982\u679c\u5de6\u5b50\u6570\u7ec4\u5df2\u7ecf\u88ab\u5408\u5e76\u5b8c\u4e86\uff0c\u90a3\u4e48\u4e0d\u7528\u7ee7\u7eed\u5224\u65ad\uff0c\u76f4\u63a5\u5408\u5e76\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u5373\u53ef\u3002
"},{"location":"chapter_sorting/merge_sort/#1152","title":"11.5.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"
  • \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n \\log n)\\) \uff1a\u5212\u5206\u5f62\u6210\u9ad8\u5ea6\u4e3a \\(\\log n\\) \u7684\u9012\u5f52\u6811\uff0c\u6bcf\u5c42\u5408\u5e76\u7684\u603b\u64cd\u4f5c\u6570\u91cf\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n \\log n)\\) \u65f6\u95f4\u3002
  • \u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u9700\u501f\u52a9\u8f85\u52a9\u6570\u7ec4\u5b9e\u73b0\u5408\u5e76\uff0c\u4f7f\u7528 \\(O(n)\\) \u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\uff1b\u9012\u5f52\u6df1\u5ea6\u4e3a \\(\\log n\\) \uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002
  • \u975e\u539f\u5730\u6392\u5e8f\uff1a\u8f85\u52a9\u6570\u7ec4\u9700\u8981\u4f7f\u7528 \\(O(n)\\) \u989d\u5916\u7a7a\u95f4\u3002
  • \u7a33\u5b9a\u6392\u5e8f\uff1a\u5728\u5408\u5e76\u65f6\u53ef\u4fdd\u8bc1\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u4e0d\u53d8\u3002
  • \u975e\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u5bf9\u4e8e\u4efb\u610f\u8f93\u5165\u6570\u636e\uff0c\u5f52\u5e76\u6392\u5e8f\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u76f8\u540c\u3002
"},{"location":"chapter_sorting/merge_sort/#1153","title":"11.5.3. \u00a0 \u94fe\u8868\u6392\u5e8f *","text":"

\u5f52\u5e76\u6392\u5e8f\u6709\u4e00\u4e2a\u5f88\u7279\u522b\u7684\u4f18\u52bf\uff0c\u7528\u4e8e\u6392\u5e8f\u94fe\u8868\u65f6\u6709\u5f88\u597d\u7684\u6027\u80fd\u8868\u73b0\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u53ef\u88ab\u4f18\u5316\u81f3 \\(O(1)\\) \uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u7531\u4e8e\u94fe\u8868\u53ef\u4ec5\u901a\u8fc7\u6539\u53d8\u6307\u9488\u6765\u5b9e\u73b0\u7ed3\u70b9\u589e\u5220\uff0c\u56e0\u6b64\u201c\u5c06\u4e24\u4e2a\u77ed\u6709\u5e8f\u94fe\u8868\u5408\u5e76\u4e3a\u4e00\u4e2a\u957f\u6709\u5e8f\u94fe\u8868\u201d\u65e0\u9700\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff0c\u5373\u56de\u6eaf\u5408\u5e76\u9636\u6bb5\u4e0d\u7528\u50cf\u6392\u5e8f\u6570\u7ec4\u4e00\u6837\u5efa\u7acb\u8f85\u52a9\u6570\u7ec4 tmp \uff1b
  • \u901a\u8fc7\u4f7f\u7528\u300c\u8fed\u4ee3\u300d\u4ee3\u66ff\u300c\u9012\u5f52\u5212\u5206\u300d\uff0c\u53ef\u7701\u53bb\u9012\u5f52\u4f7f\u7528\u7684\u6808\u5e27\u7a7a\u95f4\uff1b

\u8be6\u60c5\u53c2\u8003\uff1a148. \u6392\u5e8f\u94fe\u8868

"},{"location":"chapter_sorting/quick_sort/","title":"11.4. \u00a0 \u5feb\u901f\u6392\u5e8f","text":"

\u300c\u5feb\u901f\u6392\u5e8f Quick Sort\u300d\u662f\u4e00\u79cd\u57fa\u4e8e\u201c\u5206\u6cbb\u601d\u60f3\u201d\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u901f\u5ea6\u5f88\u5feb\u3001\u5e94\u7528\u5f88\u5e7f\u3002

\u5feb\u901f\u6392\u5e8f\u7684\u6838\u5fc3\u64cd\u4f5c\u4e3a\u300c\u54e8\u5175\u5212\u5206\u300d\uff0c\u5176\u76ee\u6807\u4e3a\uff1a\u9009\u53d6\u6570\u7ec4\u67d0\u4e2a\u5143\u7d20\u4e3a \u57fa\u51c6\u6570\uff0c\u5c06\u6240\u6709\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\u79fb\u52a8\u81f3\u5176\u5de6\u8fb9\uff0c\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\u79fb\u52a8\u81f3\u5176\u53f3\u8fb9\u3002\u300c\u54e8\u5175\u5212\u5206\u300d\u7684\u5b9e\u73b0\u6d41\u7a0b\u4e3a\uff1a

  1. \u4ee5\u6570\u7ec4\u6700\u5de6\u7aef\u5143\u7d20\u4f5c\u4e3a\u57fa\u51c6\u6570\uff0c\u521d\u59cb\u5316\u4e24\u4e2a\u6307\u9488 i , j \u6307\u5411\u6570\u7ec4\u4e24\u7aef\uff1b
  2. \u8bbe\u7f6e\u4e00\u4e2a\u5faa\u73af\uff0c\u6bcf\u8f6e\u4e2d\u4f7f\u7528 i / j \u5206\u522b\u5bfb\u627e\u9996\u4e2a\u6bd4\u57fa\u51c6\u6570\u5927 / \u5c0f\u7684\u5143\u7d20\uff0c\u5e76\u4ea4\u6362\u6b64\u4e24\u5143\u7d20\uff1b
  3. \u4e0d\u65ad\u5faa\u73af\u6b65\u9aa4 2. \uff0c\u76f4\u81f3 i , j \u76f8\u9047\u65f6\u8df3\u51fa\uff0c\u6700\u7ec8\u628a\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u4e2a\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\uff1b

\u300c\u54e8\u5175\u5212\u5206\u300d\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u539f\u6570\u7ec4\u88ab\u5212\u5206\u6210\u4e24\u4e2a\u90e8\u5206\uff0c\u5373 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4\uff0c\u4e14\u6ee1\u8db3 \u5de6\u5b50\u6570\u7ec4\u4efb\u610f\u5143\u7d20 < \u57fa\u51c6\u6570 < \u53f3\u5b50\u6570\u7ec4\u4efb\u610f\u5143\u7d20\u3002\u56e0\u6b64\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u53ea\u9700\u8981\u6392\u5e8f\u4e24\u4e2a\u5b50\u6570\u7ec4\u5373\u53ef\u3002

<1><2><3><4><5><6><7><8><9>

\u5feb\u901f\u6392\u5e8f\u7684\u5206\u6cbb\u601d\u60f3

\u54e8\u5175\u5212\u5206\u7684\u5b9e\u8d28\u662f\u5c06 \u4e00\u4e2a\u957f\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898 \u7b80\u5316\u4e3a \u4e24\u4e2a\u77ed\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(int[] nums, int i, int j) {\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(int[] nums, int left, int right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.cpp
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(vector<int>& nums, int i, int j) {\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(vector<int>& nums, int left, int right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.py
def partition(self, nums: List[int], left: int, right: int) -> int:\n\"\"\" \u54e8\u5175\u5212\u5206 \"\"\"\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j = left, right\nwhile i < j:\nwhile i < j and nums[j] >= nums[left]:\nj -= 1  # \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile i < j and nums[i] <= nums[left]:\ni += 1  # \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n# \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n# \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i  # \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n
quick_sort.go
/* \u54e8\u5175\u5212\u5206 */\nfunc (q *quickSort) partition(nums []int, left, right int) int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j := left, right\nfor i < j {\nfor i < j && nums[j] >= nums[left] {\nj-- // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nfor i < j && nums[i] <= nums[left] {\ni++ // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n}\n// \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.js
/* \u5143\u7d20\u4ea4\u6362 */\nswap(nums, i, j) {\nlet tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\npartition(nums, left, right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.ts
/* \u5143\u7d20\u4ea4\u6362 */\nswap(nums: number[], i: number, j: number): void {\nlet tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\npartition(nums: number[], left: number, right: number): number {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.c
[class]{quickSort}-[func]{partition}\n
quick_sort.cs
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(int[] nums, int i, int j)\n{\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(int[] nums, int left, int right)\n{\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j)\n{\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.swift
/* \u5143\u7d20\u4ea4\u6362 */\nfunc swap(nums: inout [Int], i: Int, j: Int) {\nlet tmp = nums[i]\nnums[i] = nums[j]\nnums[j] = tmp\n}\n/* \u54e8\u5175\u5212\u5206 */\nfunc partition(nums: inout [Int], left: Int, right: Int) -> Int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left\nvar j = right\nwhile i < j {\nwhile i < j, nums[j] >= nums[left] {\nj -= 1 // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile i < j, nums[i] <= nums[left] {\ni += 1 // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nswap(nums: &nums, i: i, j: j) // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums: &nums, i: i, j: left) // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.zig
// \u5143\u7d20\u4ea4\u6362\nfn swap(nums: []i32, i: usize, j: usize) void {\nvar tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n// \u54e8\u5175\u5212\u5206\nfn partition(nums: []i32, left: usize, right: usize) usize {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left;\nvar j = right;\nwhile (i < j) {\nwhile (i < j and nums[j] >= nums[left]) j -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j and nums[i] <= nums[left]) i += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j);   // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);    // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;               // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
"},{"location":"chapter_sorting/quick_sort/#1141","title":"11.4.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u9996\u5148\uff0c\u5bf9\u6570\u7ec4\u6267\u884c\u4e00\u6b21\u300c\u54e8\u5175\u5212\u5206\u300d\uff0c\u5f97\u5230\u5f85\u6392\u5e8f\u7684 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4\uff1b
  2. \u63a5\u4e0b\u6765\uff0c\u5bf9 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4 \u5206\u522b \u9012\u5f52\u6267\u884c\u300c\u54e8\u5175\u5212\u5206\u300d\u2026\u2026
  3. \u76f4\u81f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6 \u7ec8\u6b62\u9012\u5f52\uff0c\u5373\u53ef\u5b8c\u6210\u5bf9\u6574\u4e2a\u6570\u7ec4\u7684\u6392\u5e8f\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5feb\u901f\u6392\u5e8f\u548c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7684\u539f\u7406\u7c7b\u4f3c\uff0c\u90fd\u662f\u4ee5\u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u7f29\u5c0f\u5904\u7406\u533a\u95f4\u3002

Fig. \u5feb\u901f\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(int[] nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.cpp
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(vector<int>& nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.py
def quick_sort(self, nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5feb\u901f\u6392\u5e8f \"\"\"\n# \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right:\nreturn\n# \u54e8\u5175\u5212\u5206\npivot: int = self.partition(nums, left, right)\n# \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nself.quick_sort(nums, left, pivot - 1)\nself.quick_sort(nums, pivot + 1, right)\n
quick_sort.go
/* \u5feb\u901f\u6392\u5e8f */\nfunc (q *quickSort) quickSort(nums []int, left, right int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right {\nreturn\n}\n// \u54e8\u5175\u5212\u5206\npivot := q.partition(nums, left, right)\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nq.quickSort(nums, left, pivot-1)\nq.quickSort(nums, pivot+1, right)\n}\n
quick_sort.js
/* \u5feb\u901f\u6392\u5e8f */\nquickSort(nums, left, right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) return;\n// \u54e8\u5175\u5212\u5206\nconst pivot = this.partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nthis.quickSort(nums, left, pivot - 1);\nthis.quickSort(nums, pivot + 1, right);\n}\n
quick_sort.ts
/* \u5feb\u901f\u6392\u5e8f */\nquickSort(nums: number[], left: number, right: number): void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) {\nreturn;\n}\n// \u54e8\u5175\u5212\u5206\nconst pivot = this.partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nthis.quickSort(nums, left, pivot - 1);\nthis.quickSort(nums, pivot + 1, right);\n}\n
quick_sort.c
[class]{quickSort}-[func]{quickSort}\n
quick_sort.cs
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(int[] nums, int left, int right)\n{\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.swift
/* \u5feb\u901f\u6392\u5e8f */\nfunc quickSort(nums: inout [Int], left: Int, right: Int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right {\nreturn\n}\n// \u54e8\u5175\u5212\u5206\nlet pivot = partition(nums: &nums, left: left, right: right)\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums: &nums, left: left, right: pivot - 1)\nquickSort(nums: &nums, left: pivot + 1, right: right)\n}\n
quick_sort.zig
// \u5feb\u901f\u6392\u5e8f\nfn quickSort(nums: []i32, left: usize, right: usize) void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) return;\n// \u54e8\u5175\u5212\u5206\nvar pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
"},{"location":"chapter_sorting/quick_sort/#1142","title":"11.4.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n \\log n)\\) \uff1a\u5e73\u5747\u60c5\u51b5\u4e0b\uff0c\u54e8\u5175\u5212\u5206\u7684\u9012\u5f52\u5c42\u6570\u4e3a \\(\\log n\\) \uff0c\u6bcf\u5c42\u4e2d\u7684\u603b\u5faa\u73af\u6570\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n \\log n)\\) \u65f6\u95f4\u3002

\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u5c06\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6570\u7ec4\u5212\u5206\u4e3a\u957f\u5ea6\u4e3a \\(0\\) \u548c \\(n - 1\\) \u7684\u4e24\u4e2a\u5b50\u6570\u7ec4\uff0c\u6b64\u65f6\u9012\u5f52\u5c42\u6570\u8fbe\u5230 \\(n\\) \u5c42\uff0c\u6bcf\u5c42\u4e2d\u7684\u5faa\u73af\u6570\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u8f93\u5165\u6570\u7ec4\u5b8c\u5168\u5012\u5e8f\u4e0b\uff0c\u8fbe\u5230\u6700\u5dee\u9012\u5f52\u6df1\u5ea6 \\(n\\) \u3002

\u539f\u5730\u6392\u5e8f\uff1a\u53ea\u5728\u9012\u5f52\u4e2d\u4f7f\u7528 \\(O(\\log n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002

\u975e\u7a33\u5b9a\u6392\u5e8f\uff1a\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u53ef\u80fd\u6539\u53d8\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n^2)\\) \u3002

"},{"location":"chapter_sorting/quick_sort/#1143","title":"11.4.3. \u00a0 \u5feb\u6392\u4e3a\u4ec0\u4e48\u5feb\uff1f","text":"

\u4ece\u547d\u540d\u80fd\u591f\u770b\u51fa\uff0c\u5feb\u901f\u6392\u5e8f\u5728\u6548\u7387\u65b9\u9762\u4e00\u5b9a\u201c\u6709\u4e24\u628a\u5237\u5b50\u201d\u3002\u5feb\u901f\u6392\u5e8f\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u867d\u7136\u4e0e\u300c\u5f52\u5e76\u6392\u5e8f\u300d\u548c\u300c\u5806\u6392\u5e8f\u300d\u4e00\u81f4\uff0c\u4f46\u5b9e\u9645 \u6548\u7387\u66f4\u9ad8\uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u51fa\u73b0\u6700\u5dee\u60c5\u51b5\u7684\u6982\u7387\u5f88\u4f4e\uff1a\u867d\u7136\u5feb\u901f\u6392\u5e8f\u7684\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff0c\u4e0d\u5982\u5f52\u5e76\u6392\u5e8f\uff0c\u4f46\u7edd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u5feb\u901f\u6392\u5e8f\u53ef\u4ee5\u8fbe\u5230 \\(O(n \\log n)\\) \u7684\u590d\u6742\u5ea6\u3002
  • \u7f13\u5b58\u4f7f\u7528\u6548\u7387\u9ad8\uff1a\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u65f6\uff0c\u5c06\u6574\u4e2a\u5b50\u6570\u7ec4\u52a0\u8f7d\u5165\u7f13\u5b58\u4e2d\uff0c\u8bbf\u95ee\u5143\u7d20\u6548\u7387\u5f88\u9ad8\u3002\u800c\u8bf8\u5982\u300c\u5806\u6392\u5e8f\u300d\u9700\u8981\u8df3\u8dc3\u5f0f\u8bbf\u95ee\u5143\u7d20\uff0c\u56e0\u6b64\u4e0d\u5177\u6709\u6b64\u7279\u6027\u3002
  • \u590d\u6742\u5ea6\u7684\u5e38\u6570\u7cfb\u6570\u4f4e\uff1a\u5728\u63d0\u53ca\u7684\u4e09\u79cd\u7b97\u6cd5\u4e2d\uff0c\u5feb\u901f\u6392\u5e8f\u7684 \u6bd4\u8f83\u3001\u8d4b\u503c\u3001\u4ea4\u6362 \u4e09\u79cd\u64cd\u4f5c\u7684\u603b\u4f53\u6570\u91cf\u6700\u5c11\uff08\u7c7b\u4f3c\u4e8e\u300c\u63d2\u5165\u6392\u5e8f\u300d\u5feb\u4e8e\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u7684\u539f\u56e0\uff09\u3002
"},{"location":"chapter_sorting/quick_sort/#1144","title":"11.4.4. \u00a0 \u57fa\u51c6\u6570\u4f18\u5316","text":"

\u666e\u901a\u5feb\u901f\u6392\u5e8f\u5728\u67d0\u4e9b\u8f93\u5165\u4e0b\u7684\u65f6\u95f4\u6548\u7387\u53d8\u5dee\u3002\u4e3e\u4e2a\u6781\u7aef\u4f8b\u5b50\uff0c\u5047\u8bbe\u8f93\u5165\u6570\u7ec4\u662f\u5b8c\u5168\u5012\u5e8f\u7684\uff0c\u7531\u4e8e\u6211\u4eec\u9009\u53d6\u6700\u5de6\u7aef\u5143\u7d20\u4e3a\u57fa\u51c6\u6570\uff0c\u90a3\u4e48\u5728\u54e8\u5175\u5212\u5206\u5b8c\u6210\u540e\uff0c\u57fa\u51c6\u6570\u88ab\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u53f3\u7aef\uff0c\u4ece\u800c \u5de6\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n - 1\\)\u3001\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a \\(0\\) \u3002\u8fd9\u6837\u8fdb\u4e00\u6b65\u9012\u5f52\u4e0b\u53bb\uff0c\u6bcf\u8f6e\u54e8\u5175\u5212\u5206\u540e\u7684\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u90fd\u4e3a \\(0\\) \uff0c\u5206\u6cbb\u7b56\u7565\u5931\u6548\uff0c\u5feb\u901f\u6392\u5e8f\u9000\u5316\u4e3a\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u4e86\u3002

\u4e3a\u4e86\u5c3d\u91cf\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u53d1\u751f\uff0c\u6211\u4eec\u53ef\u4ee5\u4f18\u5316\u4e00\u4e0b\u57fa\u51c6\u6570\u7684\u9009\u53d6\u7b56\u7565\u3002\u9996\u5148\uff0c\u5728\u54e8\u5175\u5212\u5206\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5 \u968f\u673a\u9009\u53d6\u4e00\u4e2a\u5143\u7d20\u4f5c\u4e3a\u57fa\u51c6\u6570\u3002\u4f46\u5982\u679c\u8fd0\u6c14\u5f88\u5dee\uff0c\u6bcf\u6b21\u90fd\u9009\u62e9\u5230\u6bd4\u8f83\u5dee\u7684\u57fa\u51c6\u6570\uff0c\u90a3\u4e48\u6548\u7387\u4f9d\u7136\u4e0d\u597d\u3002

\u8fdb\u4e00\u6b65\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6570\u7ec4\u4e2d\u9009\u53d6 3 \u4e2a\u5019\u9009\u5143\u7d20\uff08\u4e00\u822c\u4e3a\u6570\u7ec4\u7684\u9996\u3001\u5c3e\u3001\u4e2d\u70b9\u5143\u7d20\uff09\uff0c\u5e76\u5c06\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\u4f5c\u4e3a\u57fa\u51c6\u6570\uff0c\u8fd9\u6837\u57fa\u51c6\u6570\u201c\u65e2\u4e0d\u5927\u4e5f\u4e0d\u5c0f\u201d\u7684\u6982\u7387\u5c31\u5927\u5927\u63d0\u5347\u4e86\u3002\u5f53\u7136\uff0c\u5982\u679c\u6570\u7ec4\u5f88\u957f\u7684\u8bdd\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u9009\u53d6\u66f4\u591a\u5019\u9009\u5143\u7d20\uff0c\u6765\u8fdb\u4e00\u6b65\u63d0\u5347\u7b97\u6cd5\u7684\u7a33\u5065\u6027\u3002\u91c7\u53d6\u8be5\u65b9\u6cd5\u540e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n^2)\\) \u7684\u6982\u7387\u6781\u4f4e\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(int[] nums, int left, int mid, int right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(int[] nums, int left, int right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.cpp
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(vector<int>& nums, int left, int mid, int right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(vector<int>& nums, int left, int right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.py
def median_three(self, nums: List[int], left: int, mid: int, right: int) -> int:\n\"\"\" \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 \"\"\"\n# \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n# \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (nums[left] < nums[mid]) ^ (nums[left] < nums[right]):\nreturn left\nelif (nums[mid] < nums[left]) ^ (nums[mid] < nums[right]):\nreturn mid\nreturn right\ndef partition(self, nums: List[int], left: int, right: int) -> int:\n\"\"\" \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 \"\"\"\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nmed: int = self.median_three(nums, left, (left + right) // 2, right)\n# \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nnums[left], nums[med] = nums[med], nums[left]\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j = left, right\nwhile i < j:\nwhile i < j and nums[j] >= nums[left]:\nj -= 1  # \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile i < j and nums[i] <= nums[left]:\ni += 1  # \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n# \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n# \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i  # \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n
quick_sort.go
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nfunc (q *quickSortMedian) medianThree(nums []int, left, mid, right int) int {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\uff08!= \u5728\u8fd9\u91cc\u8d77\u5230\u5f02\u6216\u7684\u4f5c\u7528\uff09\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (nums[left] < nums[mid]) != (nums[left] < nums[right]) {\nreturn left\n} else if (nums[mid] < nums[left]) != (nums[mid] < nums[right]) {\nreturn mid\n}\nreturn right\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09*/\nfunc (q *quickSortMedian) partition(nums []int, left, right int) int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nmed := q.medianThree(nums, left, (left+right)/2, right)\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nnums[left], nums[med] = nums[med], nums[left]\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j := left, right\nfor i < j {\nfor i < j && nums[j] >= nums[left] {\nj-- //\u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nfor i < j && nums[i] <= nums[left] {\ni++ //\u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n//\u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n}\n//\u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i //\u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.js
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nmedianThree(nums, left, mid, right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right])) return left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right])) return mid;\nelse return right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\npartition(nums, left, right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = this.medianThree(nums, left, Math.floor((left + right) / 2), right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nthis.swap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) j--; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left]) i++; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.ts
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nmedianThree(nums: number[], left: number, mid: number, right: number): number {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (Number(nums[left] < nums[mid]) ^ Number(nums[left] < nums[right])) {\nreturn left;\n} else if (Number(nums[mid] < nums[left]) ^ Number(nums[mid] < nums[right])) {\nreturn mid;\n} else {\nreturn right;\n}\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\npartition(nums: number[], left: number, right: number): number {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = this.medianThree(nums, left, Math.floor((left + right) / 2), right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nthis.swap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj--; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni++; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.c
[class]{quickSortMedian}-[func]{medianThree}\n[class]{quickSortMedian}-[func]{partition}\n
quick_sort.cs
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(int[] nums, int left, int mid, int right)\n{\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(int[] nums, int left, int right)\n{\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j)\n{\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.swift
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nfunc medianThree(nums: [Int], left: Int, mid: Int, right: Int) -> Int {\nif (nums[left] < nums[mid]) != (nums[left] < nums[right]) {\nreturn left\n} else if (nums[mid] < nums[left]) != (nums[mid] < nums[right]) {\nreturn mid\n} else {\nreturn right\n}\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nfunc partitionMedian(nums: inout [Int], left: Int, right: Int) -> Int {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = medianThree(nums: nums, left: left, mid: (left + right) / 2, right: right)\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums: &nums, i: left, j: med)\nreturn partition(nums: &nums, left: left, right: right)\n}\n
quick_sort.zig
// \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nfn medianThree(nums: []i32, left: usize, mid: usize, right: usize) usize {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) != (nums[left] < nums[right])) {\nreturn left;\n} else if ((nums[mid] < nums[left]) != (nums[mid] < nums[right])) {\nreturn mid;\n} else {\nreturn right;\n}\n}\n// \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09\nfn partition(nums: []i32, left: usize, right: usize) usize {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nvar med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left;\nvar j = right;\nwhile (i < j) {\nwhile (i < j and nums[j] >= nums[left]) j -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j and nums[i] <= nums[left]) i += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j);   // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);    // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;               // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
"},{"location":"chapter_sorting/quick_sort/#1145","title":"11.4.5. \u00a0 \u5c3e\u9012\u5f52\u4f18\u5316","text":"

\u666e\u901a\u5feb\u901f\u6392\u5e8f\u5728\u67d0\u4e9b\u8f93\u5165\u4e0b\u7684\u7a7a\u95f4\u6548\u7387\u53d8\u5dee\u3002\u4ecd\u7136\u4ee5\u5b8c\u5168\u5012\u5e8f\u7684\u8f93\u5165\u6570\u7ec4\u4e3a\u4f8b\uff0c\u7531\u4e8e\u6bcf\u8f6e\u54e8\u5175\u5212\u5206\u540e\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 0 \uff0c\u90a3\u4e48\u5c06\u5f62\u6210\u4e00\u4e2a\u9ad8\u5ea6\u4e3a \\(n - 1\\) \u7684\u9012\u5f52\u6811\uff0c\u6b64\u65f6\u4f7f\u7528\u7684\u6808\u5e27\u7a7a\u95f4\u5927\u5c0f\u52a3\u5316\u81f3 \\(O(n)\\) \u3002

\u4e3a\u4e86\u907f\u514d\u6808\u5e27\u7a7a\u95f4\u7684\u7d2f\u79ef\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6bcf\u8f6e\u54e8\u5175\u6392\u5e8f\u5b8c\u6210\u540e\uff0c\u5224\u65ad\u4e24\u4e2a\u5b50\u6570\u7ec4\u7684\u957f\u5ea6\u5927\u5c0f\uff0c\u4ec5\u9012\u5f52\u6392\u5e8f\u8f83\u77ed\u7684\u5b50\u6570\u7ec4\u3002\u7531\u4e8e\u8f83\u77ed\u7684\u5b50\u6570\u7ec4\u957f\u5ea6\u4e0d\u4f1a\u8d85\u8fc7 \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u8fd9\u6837\u505a\u80fd\u4fdd\u8bc1\u9012\u5f52\u6df1\u5ea6\u4e0d\u8d85\u8fc7 \\(\\log n\\) \uff0c\u5373\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u88ab\u4f18\u5316\u81f3 \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(int[] nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.cpp
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(vector<int>& nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.py
def quick_sort(self, nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 \"\"\"\n# \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile left < right:\n# \u54e8\u5175\u5212\u5206\u64cd\u4f5c\npivot: int = self.partition(nums, left, right)\n# \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif pivot - left < right - pivot:\nself.quick_sort(nums, left, pivot - 1)  # \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1     # \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\nelse:\nself.quick_sort(nums, pivot + 1, right)  # \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1    # \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n
quick_sort.go
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09*/\nfunc (q *quickSortTailCall) quickSort(nums []int, left, right int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nfor left < right {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\npivot := q.partition(nums, left, right)\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif pivot-left < right-pivot {\nq.quickSort(nums, left, pivot-1) // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1                 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nq.quickSort(nums, pivot+1, right) // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1                 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.js
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nquickSort(nums, left, right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = this.partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nthis.quickSort(nums, left, pivot - 1); // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nthis.quickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.ts
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nquickSort(nums: number[], left: number, right: number): void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = this.partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nthis.quickSort(nums, left, pivot - 1); // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nthis.quickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.c
[class]{quickSortTailCall}-[func]{quickSort}\n
quick_sort.cs
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(int[] nums, int left, int right)\n{\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right)\n{\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot)\n{\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n}\nelse\n{\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.swift
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nfunc quickSortTailCall(nums: inout [Int], left: Int, right: Int) {\nvar left = left\nvar right = right\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile left < right {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = partition(nums: &nums, left: left, right: right)\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left) < (right - pivot) {\nquickSortTailCall(nums: &nums, left: left, right: pivot - 1) // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSortTailCall(nums: &nums, left: pivot + 1, right: right) // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.zig
// \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09\nfn quickSort(nums: []i32, left_: usize, right_: usize) void {\nvar left = left_;\nvar right = right_;\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nvar pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);   // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;                   // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right);  // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1;                  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
"},{"location":"chapter_sorting/summary/","title":"11.6. \u00a0 \u5c0f\u7ed3","text":"
  • \u5192\u6ce1\u6392\u5e8f\u901a\u8fc7\u4ea4\u6362\u76f8\u90bb\u5143\u7d20\u6765\u5b9e\u73b0\u6392\u5e8f\u3002\u901a\u8fc7\u589e\u52a0\u6807\u5fd7\u4f4d\u5b9e\u73b0\u63d0\u524d\u8fd4\u56de\uff0c\u6211\u4eec\u53ef\u5c06\u5192\u6ce1\u6392\u5e8f\u7684\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(N)\\) \u3002
  • \u63d2\u5165\u6392\u5e8f\u6bcf\u8f6e\u5c06\u5f85\u6392\u5e8f\u533a\u95f4\u5185\u5143\u7d20\u63d2\u5165\u81f3\u5df2\u6392\u5e8f\u533a\u95f4\u7684\u6b63\u786e\u4f4d\u7f6e\uff0c\u4ece\u800c\u5b9e\u73b0\u6392\u5e8f\u3002\u63d2\u5165\u6392\u5e8f\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u867d\u4e3a \\(O(N^2)\\) \uff0c\u4f46\u56e0\u4e3a\u603b\u4f53\u64cd\u4f5c\u5c11\u800c\u5f88\u53d7\u6b22\u8fce\uff0c\u4e00\u822c\u7528\u4e8e\u5c0f\u6570\u636e\u91cf\u7684\u6392\u5e8f\u5de5\u4f5c\u3002
  • \u5feb\u901f\u6392\u5e8f\u57fa\u4e8e\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u5b9e\u73b0\u6392\u5e8f\u3002\u5728\u54e8\u5175\u5212\u5206\u4e2d\uff0c\u6709\u53ef\u80fd\u6bcf\u6b21\u90fd\u9009\u53d6\u5230\u6700\u5dee\u7684\u57fa\u51c6\u6570\uff0c\u4ece\u800c\u5bfc\u81f4\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(N^2)\\) \uff0c\u901a\u8fc7\u5f15\u5165\u4e2d\u4f4d\u6570\u57fa\u51c6\u6570\u6216\u968f\u673a\u57fa\u51c6\u6570\u53ef\u5927\u5927\u964d\u4f4e\u52a3\u5316\u6982\u7387\u3002\u5c3e\u9012\u5f52\u65b9\u6cd5\u53ef\u4ee5\u6709\u6548\u51cf\u5c0f\u9012\u5f52\u6df1\u5ea6\uff0c\u5c06\u7a7a\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(\\log N)\\) \u3002
  • \u5f52\u5e76\u6392\u5e8f\u5305\u542b\u5212\u5206\u548c\u5408\u5e76\u4e24\u4e2a\u9636\u6bb5\uff0c\u662f\u5206\u800c\u6cbb\u4e4b\u7684\u6807\u51c6\u4f53\u73b0\u3002\u5bf9\u4e8e\u5f52\u5e76\u6392\u5e8f\uff0c\u6392\u5e8f\u6570\u7ec4\u9700\u8981\u501f\u52a9\u8f85\u52a9\u6570\u7ec4\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff1b\u800c\u6392\u5e8f\u94fe\u8868\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u88ab\u4f18\u5316\u81f3 \\(O(1)\\) \u3002
  • \u4e0b\u56fe\u603b\u7ed3\u5bf9\u6bd4\u4e86\u5404\u4e2a\u6392\u5e8f\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u4e0e\u7279\u6027\u3002\u5176\u4e2d\uff0c\u6876\u6392\u5e8f\u4e2d \\(k\\) \u4e3a\u6876\u7684\u6570\u91cf\uff1b\u57fa\u6570\u6392\u5e8f\u4ec5\u9002\u7528\u4e8e\u6b63\u6574\u6570\u3001\u5b57\u7b26\u4e32\u3001\u7279\u5b9a\u683c\u5f0f\u7684\u6d6e\u70b9\u6570\uff0c\\(k\\) \u4e3a\u6700\u5927\u6570\u5b57\u7684\u4f4d\u6570\u3002

Fig. \u6392\u5e8f\u7b97\u6cd5\u5bf9\u6bd4

  • \u603b\u4f53\u6765\u770b\uff0c\u6211\u4eec\u8ffd\u6c42\u8fd0\u884c\u5feb\u3001\u7a33\u5b9a\u3001\u539f\u5730\u3001\u6b63\u5411\u81ea\u9002\u5e94\u6027\u7684\u6392\u5e8f\u3002\u663e\u7136\uff0c\u5982\u540c\u5176\u5b83\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e00\u6837\uff0c\u540c\u65f6\u6ee1\u8db3\u8fd9\u4e9b\u6761\u4ef6\u7684\u6392\u5e8f\u7b97\u6cd5\u5e76\u4e0d\u5b58\u5728\uff0c\u6211\u4eec\u9700\u8981\u6839\u636e\u95ee\u9898\u7279\u70b9\u6765\u9009\u62e9\u6392\u5e8f\u7b97\u6cd5\u3002
"},{"location":"chapter_stack_and_queue/deque/","title":"5.3. \u00a0 \u53cc\u5411\u961f\u5217","text":"

\u5bf9\u4e8e\u961f\u5217\uff0c\u6211\u4eec\u53ea\u80fd\u5728\u5934\u90e8\u5220\u9664\u6216\u5728\u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\uff0c\u800c\u300c\u53cc\u5411\u961f\u5217 Deque\u300d\u66f4\u52a0\u7075\u6d3b\uff0c\u5728\u5176\u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u80fd\u6267\u884c\u5143\u7d20\u6dfb\u52a0\u6216\u5220\u9664\u64cd\u4f5c\u3002

Fig. \u53cc\u5411\u961f\u5217\u7684\u64cd\u4f5c

"},{"location":"chapter_stack_and_queue/deque/#531","title":"5.3.1. \u00a0 \u53cc\u5411\u961f\u5217\u5e38\u7528\u64cd\u4f5c","text":"

\u53cc\u5411\u961f\u5217\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff0c\u65b9\u6cd5\u540d\u9700\u6839\u636e\u8bed\u8a00\u6765\u786e\u5b9a\u3002

\u65b9\u6cd5\u540d \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 pushFirst() \u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u9996 \\(O(1)\\) pushLast() \u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u5c3e \\(O(1)\\) popFirst() \u5220\u9664\u961f\u9996\u5143\u7d20 \\(O(1)\\) popLast() \u5220\u9664\u961f\u5c3e\u5143\u7d20 \\(O(1)\\) peekFirst() \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \\(O(1)\\) peekLast() \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \\(O(1)\\)

\u76f8\u540c\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u53cc\u5411\u961f\u5217\u7c7b\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig deque.java
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\nDeque<Integer> deque = new LinkedList<>();\n/* \u5143\u7d20\u5165\u961f */\ndeque.offerLast(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.offerLast(5);\ndeque.offerLast(4);\ndeque.offerFirst(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.offerFirst(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint peekFirst = deque.peekFirst();  // \u961f\u9996\u5143\u7d20\nint peekLast = deque.peekLast();    // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\nint popFirst = deque.pollFirst();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\nint popLast = deque.pollLast();    // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.size();\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = deque.isEmpty();\n
deque.cpp
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\ndeque<int> deque;\n/* \u5143\u7d20\u5165\u961f */\ndeque.push_back(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.push_back(5);\ndeque.push_back(4);\ndeque.push_front(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.push_front(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint front = deque.front(); // \u961f\u9996\u5143\u7d20\nint back = deque.back();   // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.pop_front();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.pop_back();   // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.size();\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty = deque.empty();\n
deque.py
\"\"\" \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 \"\"\"\ndeque: Deque[int] = collections.deque()\n\"\"\" \u5143\u7d20\u5165\u961f \"\"\"\ndeque.append(2)      # \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.append(5)\ndeque.append(4)\ndeque.appendleft(3)  # \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.appendleft(1)\n\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\nfront: int = deque[0]  # \u961f\u9996\u5143\u7d20\nrear: int = deque[-1]  # \u961f\u5c3e\u5143\u7d20\n\"\"\" \u5143\u7d20\u51fa\u961f \"\"\"\npop_front: int = deque.popleft()  # \u961f\u9996\u5143\u7d20\u51fa\u961f\npop_rear: int = deque.pop()       # \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(deque)\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(deque) == 0\n
deque_test.go
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// \u5728 Go \u4e2d\uff0c\u5c06 list \u4f5c\u4e3a\u53cc\u5411\u961f\u5217\u4f7f\u7528\ndeque := list.New()\n/* \u5143\u7d20\u5165\u961f */\ndeque.PushBack(2)      // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.PushBack(5)\ndeque.PushBack(4)\ndeque.PushFront(3)     // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.PushFront(1)\n/* \u8bbf\u95ee\u5143\u7d20 */\nfront := deque.Front() // \u961f\u9996\u5143\u7d20\nrear := deque.Back()   // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.Remove(front)    // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.Remove(rear)     // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize := deque.Len()\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty := deque.Len() == 0\n
deque.js
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// JavaScript \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u7aef\u961f\u5217\uff0c\u53ea\u80fd\u628a Array \u5f53\u4f5c\u53cc\u7aef\u961f\u5217\u6765\u4f7f\u7528\nconst deque = [];\n/* \u5143\u7d20\u5165\u961f */\ndeque.push(2);\ndeque.push(5);\ndeque.push(4);\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cunshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\ndeque.unshift(3);\ndeque.unshift(1);\nconsole.log(\"\u53cc\u5411\u961f\u5217 deque = \", deque);\n/* \u8bbf\u95ee\u5143\u7d20 */\nconst peekFirst = deque[0];\nconsole.log(\"\u961f\u9996\u5143\u7d20 peekFirst = \" + peekFirst);\nconst peekLast = deque[deque.length - 1];\nconsole.log(\"\u961f\u5c3e\u5143\u7d20 peekLast = \" + peekLast);\n/* \u5143\u7d20\u51fa\u961f */\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst popFront = deque.shift();\nconsole.log(\"\u961f\u9996\u51fa\u961f\u5143\u7d20 popFront = \" + popFront + \"\uff0c\u961f\u9996\u51fa\u961f\u540e deque = \" + deque);\nconst popBack = deque.pop();\nconsole.log(\"\u961f\u5c3e\u51fa\u961f\u5143\u7d20 popBack = \" + popBack + \"\uff0c\u961f\u5c3e\u51fa\u961f\u540e deque = \" + deque);\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = deque.length;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u957f\u5ea6 size = \" + size);\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst isEmpty = size === 0;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a = \" + isEmpty);\n
deque.ts
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// TypeScript \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u7aef\u961f\u5217\uff0c\u53ea\u80fd\u628a Array \u5f53\u4f5c\u53cc\u7aef\u961f\u5217\u6765\u4f7f\u7528\nconst deque: number[] = [];\n/* \u5143\u7d20\u5165\u961f */\ndeque.push(2);\ndeque.push(5);\ndeque.push(4);\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cunshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\ndeque.unshift(3);\ndeque.unshift(1);\nconsole.log(\"\u53cc\u5411\u961f\u5217 deque = \", deque);\n/* \u8bbf\u95ee\u5143\u7d20 */\nconst peekFirst: number = deque[0];\nconsole.log(\"\u961f\u9996\u5143\u7d20 peekFirst = \" + peekFirst);\nconst peekLast: number = deque[deque.length - 1];\nconsole.log(\"\u961f\u5c3e\u5143\u7d20 peekLast = \" + peekLast);\n/* \u5143\u7d20\u51fa\u961f */\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst popFront: number = deque.shift() as number;\nconsole.log(\"\u961f\u9996\u51fa\u961f\u5143\u7d20 popFront = \" + popFront + \"\uff0c\u961f\u9996\u51fa\u961f\u540e deque = \" + deque);\nconst popBack: number = deque.pop() as number;\nconsole.log(\"\u961f\u5c3e\u51fa\u961f\u5143\u7d20 popBack = \" + popBack + \"\uff0c\u961f\u5c3e\u51fa\u961f\u540e deque = \" + deque);\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nconst size: number = deque.length;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u957f\u5ea6 size = \" + size);\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst isEmpty: boolean = size === 0;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a = \" + isEmpty);\n
deque.c
\n
deque.cs
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// \u5728 C# \u4e2d\uff0c\u5c06\u94fe\u8868 LinkedList \u770b\u4f5c\u53cc\u5411\u961f\u5217\u6765\u4f7f\u7528\nLinkedList<int> deque = new LinkedList<int>();\n/* \u5143\u7d20\u5165\u961f */\ndeque.AddLast(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.AddLast(5);\ndeque.AddLast(4);\ndeque.AddFirst(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.AddFirst(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint peekFirst = deque.First.Value;  // \u961f\u9996\u5143\u7d20\nint peekLast = deque.Last.Value;    // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.RemoveFirst();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.RemoveLast();   // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.Count;\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = deque.Count == 0;\n
deque.swift
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u5411\u961f\u5217\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u53cc\u5411\u961f\u5217\u6765\u4f7f\u7528\nvar deque: [Int] = []\n/* \u5143\u7d20\u5165\u961f */\ndeque.append(2) // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.append(5)\ndeque.append(4)\ndeque.insert(3, at: 0) // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.insert(1, at: 0)\n/* \u8bbf\u95ee\u5143\u7d20 */\nlet peekFirst = deque.first! // \u961f\u9996\u5143\u7d20\nlet peekLast = deque.last! // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\n// \u4f7f\u7528 Array \u6a21\u62df\u65f6 popFirst \u7684\u590d\u6742\u5ea6\u4e3a O(n)\nlet popFirst = deque.removeFirst() // \u961f\u9996\u5143\u7d20\u51fa\u961f\nlet popLast = deque.removeLast() // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nlet size = deque.count\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = deque.isEmpty\n
deque.zig
\n
"},{"location":"chapter_stack_and_queue/deque/#532","title":"5.3.2. \u00a0 \u53cc\u5411\u961f\u5217\u5b9e\u73b0 *","text":"

\u4e0e\u961f\u5217\u7c7b\u4f3c\uff0c\u53cc\u5411\u961f\u5217\u540c\u6837\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u6216\u6570\u7ec4\u6765\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/deque/#_1","title":"\u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u56de\u5fc6\u4e0a\u8282\u5185\u5bb9\uff0c\u7531\u4e8e\u53ef\u4ee5\u65b9\u4fbf\u5730\u5220\u9664\u94fe\u8868\u5934\u7ed3\u70b9\uff08\u5bf9\u5e94\u51fa\u961f\u64cd\u4f5c\uff09\uff0c\u4ee5\u53ca\u5728\u94fe\u8868\u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0\u65b0\u7ed3\u70b9\uff08\u5bf9\u5e94\u5165\u961f\u64cd\u4f5c\uff09\uff0c\u56e0\u6b64\u6211\u4eec\u4f7f\u7528\u666e\u901a\u5355\u5411\u94fe\u8868\u6765\u5b9e\u73b0\u961f\u5217\u3002

\u800c\u53cc\u5411\u961f\u5217\u7684\u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u53ef\u4ee5\u6267\u884c\u5165\u961f\u4e0e\u51fa\u961f\u64cd\u4f5c\uff0c\u6362\u8a00\u4e4b\uff0c\u53cc\u5411\u961f\u5217\u7684\u64cd\u4f5c\u662f\u201c\u9996\u5c3e\u5bf9\u79f0\u201d\u7684\uff0c\u4e5f\u9700\u8981\u5b9e\u73b0\u53e6\u4e00\u4e2a\u5bf9\u79f0\u65b9\u5411\u7684\u64cd\u4f5c\u3002\u56e0\u6b64\uff0c\u53cc\u5411\u961f\u5217\u9700\u8981\u4f7f\u7528\u300c\u53cc\u5411\u94fe\u8868\u300d\u6765\u5b9e\u73b0\u3002

\u6211\u4eec\u5c06\u53cc\u5411\u94fe\u8868\u7684\u5934\u7ed3\u70b9\u548c\u5c3e\u7ed3\u70b9\u5206\u522b\u770b\u4f5c\u53cc\u5411\u961f\u5217\u7684\u961f\u9996\u548c\u961f\u5c3e\uff0c\u5e76\u4e14\u5b9e\u73b0\u5728\u4e24\u7aef\u90fd\u80fd\u6dfb\u52a0\u4e0e\u5220\u9664\u7ed3\u70b9\u3002

LinkedListDequepushLast()pushFirst()popLast()popFirst()

\u4ee5\u4e0b\u662f\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_deque.java
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nint val;       // \u7ed3\u70b9\u503c\nListNode next; // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nListNode prev; // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nListNode(int val) {\nthis.val = val;\nprev = next = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate ListNode front, rear; // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear\nprivate int queSize = 0;      // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npublic LinkedListDeque() {\nfront = rear = null;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f\u64cd\u4f5c */\nprivate void push(int num, boolean isFront) {\nListNode node = new ListNode(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (isEmpty())\nfront = rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if (isFront) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront.prev = node;\nnode.next = front;\nfront = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear.next = node;\nnode.prev = rear;\nrear = node;  // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize++; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\npublic void pushFirst(int num) {\npush(num, true);\n}\n/* \u961f\u5c3e\u5165\u961f */\npublic void pushLast(int num) {\npush(num, false);\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nprivate Integer pop(boolean isFront) {\n// \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de null\nif (isEmpty())\nreturn null;\nint val;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (isFront) {\nval = front.val; // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nListNode fNext = front.next;\nif (fNext != null) {\nfNext.prev = null;\nfront.next = null;\n}\nfront = fNext;   // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = rear.val;  // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nListNode rPrev = rear.prev;\nif (rPrev != null) {\nrPrev.next = null;\nrear.prev = null;\n}\nrear = rPrev;    // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize--; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n}\n/* \u961f\u9996\u51fa\u961f */\npublic Integer popFirst() {\nreturn pop(true);\n}\n/* \u961f\u5c3e\u51fa\u961f */\npublic Integer popLast() {\nreturn pop(false);\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic Integer peekFirst() {\nreturn isEmpty() ? null : front.val;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npublic Integer peekLast() {\nreturn isEmpty() ? null : rear.val;\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\npublic int[] toArray() {\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_deque.cpp
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nstruct DoublyListNode {\nint val;               // \u7ed3\u70b9\u503c\nDoublyListNode *next;  // \u540e\u7ee7\u7ed3\u70b9\u6307\u9488\nDoublyListNode *prev;  // \u524d\u9a71\u7ed3\u70b9\u6307\u9488\nDoublyListNode(int val) : val(val), prev(nullptr), next(nullptr) {}\n};\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate:\nDoublyListNode *front, *rear; // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear\nint queSize = 0;              // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nLinkedListDeque() : front(nullptr), rear(nullptr) {}\n/* \u6790\u6784\u65b9\u6cd5 */\n~LinkedListDeque() {\n// \u91ca\u653e\u5185\u5b58\nDoublyListNode *pre, *cur = front;\nwhile (cur != nullptr) {\npre = cur;\ncur = cur->next;\ndelete pre;\n}\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f\u64cd\u4f5c */\nvoid push(int num, bool isFront) {\nDoublyListNode *node = new DoublyListNode(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (isEmpty())\nfront = rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if (isFront) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront->prev = node;\nnode->next = front;\nfront = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear->next = node;\nnode->prev = rear;\nrear = node;  // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize++; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\nvoid pushFirst(int num) {\npush(num, true);\n}\n/* \u961f\u5c3e\u5165\u961f */\nvoid pushLast(int num) {\npush(num, false);\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nint pop(bool isFront) {\n// \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de -1\nif (isEmpty())\nreturn -1;\nint val;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (isFront) {\nval = front->val; // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nDoublyListNode *fNext = front->next;\nif (fNext != nullptr) {\nfNext->prev = nullptr;\nfront->next = nullptr;\n}\nfront = fNext;   // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = rear->val; // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nDoublyListNode *rPrev = rear->prev;\nif (rPrev != nullptr) {\nrPrev->next = nullptr;\nrear->prev = nullptr;\n}\nrear = rPrev;    // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize--; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n}\n/* \u961f\u9996\u51fa\u961f */\nint popFirst() {\nreturn pop(true);\n}\n/* \u961f\u5c3e\u51fa\u961f */\nint popLast() {\nreturn pop(false);\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peekFirst() {\nreturn isEmpty() ? -1 : front->val;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nint peekLast() {\nreturn isEmpty() ? -1 : rear->val;\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\nDoublyListNode *node = front;\nvector<int> res(size());\nfor (int i = 0; i < res.size(); i++) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_deque.py
class ListNode:\n\"\"\" \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 \"\"\"\ndef __init__(self, val: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.val: int = val\nself.next: Optional[ListNode] = None  # \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nself.prev: Optional[ListNode] = None  # \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nclass LinkedListDeque:\n\"\"\" \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 \"\"\"\ndef __init__(self) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.front: Optional[ListNode] = None # \u5934\u7ed3\u70b9 front\nself.rear: Optional[ListNode] = None  # \u5c3e\u7ed3\u70b9 rear\nself.__size: int = 0        # \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.size() == 0\ndef push(self, num: int, is_front: bool) -> None:\n\"\"\" \u5165\u961f\u64cd\u4f5c \"\"\"\nnode = ListNode(num)\n# \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif self.is_empty():\nself.front = self.rear = node\n# \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelif is_front:\n# \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nself.front.prev = node\nnode.next = self.front\nself.front = node  # \u66f4\u65b0\u5934\u7ed3\u70b9\n# \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\nelse:\n# \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nself.rear.next = node\nnode.prev = self.rear\nself.rear = node  # \u66f4\u65b0\u5c3e\u7ed3\u70b9\nself.__size += 1  # \u66f4\u65b0\u961f\u5217\u957f\u5ea6\ndef push_first(self, num: int) -> None:\n\"\"\" \u961f\u9996\u5165\u961f \"\"\"\nself.push(num, True)\ndef push_last(self, num: int) -> None:\n\"\"\" \u961f\u5c3e\u5165\u961f \"\"\"\nself.push(num, False)\ndef pop(self, is_front: bool) -> int:\n\"\"\" \u51fa\u961f\u64cd\u4f5c \"\"\"\n# \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de None\nif self.is_empty():\nreturn None\n# \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif is_front:\nval: int = self.front.val  # \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n# \u5220\u9664\u5934\u7ed3\u70b9\nfnext: Optional[ListNode] = self.front.next\nif fnext != None:\nfnext.prev = None\nself.front.next = None\nself.front = fnext  # \u66f4\u65b0\u5934\u7ed3\u70b9\n# \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\nelse:\nval: int = self.rear.val  # \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n# \u5220\u9664\u5c3e\u7ed3\u70b9\nrprev: Optional[ListNode] = self.rear.prev\nif rprev != None:\nrprev.next = None\nself.rear.prev = None\nself.rear = rprev  # \u66f4\u65b0\u5c3e\u7ed3\u70b9\nself.__size -= 1  # \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val\ndef pop_first(self) -> int:\n\"\"\" \u961f\u9996\u51fa\u961f \"\"\"\nreturn self.pop(True)\ndef pop_last(self) -> int:\n\"\"\" \u961f\u5c3e\u51fa\u961f \"\"\"\nreturn self.pop(False)\ndef peek_first(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nreturn None if self.is_empty() else self.front.val\ndef peek_last(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \"\"\"\nreturn None if self.is_empty() else self.rear.val\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 \"\"\"\nnode: Optional[ListNode] = self.front\nres: List[int] = [0] * self.size()\nfor i in range(self.size()):\nres[i] = node.val\nnode = node.next\nreturn res\n
linkedlist_deque.go
/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\ntype linkedListDeque struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u53cc\u7aef\u961f\u5217 */\nfunc newLinkedListDeque() *linkedListDeque {\nreturn &linkedListDeque{\ndata: list.New(),\n}\n}\n/* \u961f\u9996\u5143\u7d20\u5165\u961f */\nfunc (s *linkedListDeque) pushFirst(value any) {\ns.data.PushFront(value)\n}\n/* \u961f\u5c3e\u5143\u7d20\u5165\u961f */\nfunc (s *linkedListDeque) pushLast(value any) {\ns.data.PushBack(value)\n}\n/* \u961f\u9996\u5143\u7d20\u51fa\u961f */\nfunc (s *linkedListDeque) popFirst() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u961f\u5c3e\u5143\u7d20\u51fa\u961f */\nfunc (s *linkedListDeque) popLast() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (s *linkedListDeque) peekFirst() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc (s *linkedListDeque) peekLast() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\nreturn e.Value\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (s *linkedListDeque) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListDeque) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListDeque) toList() *list.List {\nreturn s.data\n}\n
linkedlist_deque.js
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nprev;   // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nnext;   // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nval;    // \u7ed3\u70b9\u503c\nconstructor(val) {\nthis.val = val;\nthis.next = null;\nthis.prev = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\n#front;  // \u5934\u7ed3\u70b9 front\n#rear;   // \u5c3e\u7ed3\u70b9 rear\n#queSize;    // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nconstructor() {\nthis.#front = null;\nthis.#rear = null;\nthis.#queSize = 0;\n}\n/* \u961f\u5c3e\u5165\u961f\u64cd\u4f5c */\npushLast(val) {\nconst node = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.#queSize === 0) {\nthis.#front = node;\nthis.#rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nthis.#rear.next = node;\nnode.prev = this.#rear;\nthis.#rear = node; // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nthis.#queSize++;\n}\n/* \u961f\u9996\u5165\u961f\u64cd\u4f5c */\npushFirst(val) {\nconst node = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.#queSize === 0) {\nthis.#front = node;\nthis.#rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nthis.#front.prev = node;\nnode.next = this.#front;\nthis.#front = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\nthis.#queSize++;\n}\n/* \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c */\npopLast() {\nif (this.#queSize === 0) {\nreturn null;\n}\nconst value = this.#rear.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet temp = this.#rear.prev;\nif (temp !== null) {\ntemp.next = null;\nthis.#rear.prev = null;\n}\nthis.#rear = temp;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\nthis.#queSize--;\nreturn value;\n}\n/* \u961f\u9996\u51fa\u961f\u64cd\u4f5c */\npopFirst() {\nif (this.#queSize === 0) {\nreturn null;\n}\nconst value = this.#front.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet temp = this.#front.next;\nif (temp !== null) {\ntemp.prev = null;\nthis.#front.next = null;\n}\nthis.#front = temp;   // \u66f4\u65b0\u5934\u7ed3\u70b9\nthis.#queSize--;\nreturn value;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast() {\nreturn this.#queSize === 0 ? null : this.#rear.val;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst() {\nreturn this.#queSize === 0 ? null : this.#front.val;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.#queSize === 0;\n}\n/* \u6253\u5370\u53cc\u5411\u961f\u5217 */\nprint() {\nconst arr = [];\nlet temp = this.#front;\nwhile (temp !== null) {\narr.push(temp.val);\ntemp = temp.next;\n}\nconsole.log(\"[\" + arr.join(\", \") + \"]\");\n}\n}\n
linkedlist_deque.ts
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nprev: ListNode;     // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nnext: ListNode;     // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nval: number;        // \u7ed3\u70b9\u503c\nconstructor(val: number) {\nthis.val = val;\nthis.next = null;\nthis.prev = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate front: ListNode;    // \u5934\u7ed3\u70b9 front\nprivate rear: ListNode;     // \u5c3e\u7ed3\u70b9 rear\nprivate queSize: number;        // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nconstructor() {\nthis.front = null;\nthis.rear = null;\nthis.queSize = 0;\n}\n/* \u961f\u5c3e\u5165\u961f\u64cd\u4f5c */\npushLast(val: number): void {\nconst node: ListNode = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.queSize === 0) {\nthis.front = node;\nthis.rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nthis.rear.next = node;\nnode.prev = this.rear;\nthis.rear = node; // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nthis.queSize++;\n}\n/* \u961f\u9996\u5165\u961f\u64cd\u4f5c */\npushFirst(val: number): void {\nconst node: ListNode = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.queSize === 0) {\nthis.front = node;\nthis.rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nthis.front.prev = node;\nnode.next = this.front;\nthis.front = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\nthis.queSize++;\n}\n/* \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c */\npopLast(): number {\nif (this.queSize === 0) {\nreturn null;\n}\nconst value: number = this.rear.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet temp: ListNode = this.rear.prev;\nif (temp !== null) {\ntemp.next = null;\nthis.rear.prev = null;\n}\nthis.rear = temp;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\nthis.queSize--;\nreturn value;\n}\n/* \u961f\u9996\u51fa\u961f\u64cd\u4f5c */\npopFirst(): number {\nif (this.queSize === 0) {\nreturn null;\n}\nconst value: number = this.front.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet temp: ListNode = this.front.next;\nif (temp !== null) {\ntemp.prev = null;\nthis.front.next = null;\n}\nthis.front = temp;   // \u66f4\u65b0\u5934\u7ed3\u70b9\nthis.queSize--;\nreturn value;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast(): number {\nreturn this.queSize === 0 ? null : this.rear.val;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst(): number {\nreturn this.queSize === 0 ? null : this.front.val;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.queSize === 0;\n}\n/* \u6253\u5370\u53cc\u5411\u961f\u5217 */\nprint(): void {\nconst arr: number[] = [];\nlet temp: ListNode = this.front;\nwhile (temp !== null) {\narr.push(temp.val);\ntemp = temp.next;\n}\nconsole.log(\"[\" + arr.join(\", \") + \"]\");\n}\n}\n
linkedlist_deque.c
[class]{ListNode}-[func]{}\n[class]{LinkedListDeque}-[func]{}\n
linkedlist_deque.cs
[class]{ListNode}-[func]{}\n[class]{LinkedListDeque}-[func]{}\n
linkedlist_deque.swift
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nvar prev: ListNode? // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\ninit(val: Int) {\nself.val = val\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate var front: ListNode? // \u5934\u7ed3\u70b9 front\nprivate var rear: ListNode? // \u5c3e\u7ed3\u70b9 rear\nprivate var queSize: Int // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\ninit() {\nqueSize = 0\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u961f\u64cd\u4f5c */\nprivate func push(num: Int, isFront: Bool) {\nlet node = ListNode(val: num)\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif isEmpty() {\nfront = node\nrear = node\n}\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if isFront {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront?.prev = node\nnode.next = front\nfront = node // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\nelse {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear?.next = node\nnode.prev = rear\nrear = node // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize += 1 // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\nfunc pushFirst(num: Int) {\npush(num: num, isFront: true)\n}\n/* \u961f\u5c3e\u5165\u961f */\nfunc pushLast(num: Int) {\npush(num: num, isFront: false)\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nprivate func pop(isFront: Bool) -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\nlet val: Int\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif isFront {\nval = front!.val // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet fNext = front?.next\nif fNext != nil {\nfNext?.prev = nil\nfront?.next = nil\n}\nfront = fNext // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\nelse {\nval = rear!.val // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet rPrev = rear?.prev\nif rPrev != nil {\nrPrev?.next = nil\nrear?.prev = nil\n}\nrear = rPrev // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize -= 1 // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val\n}\n/* \u961f\u9996\u51fa\u961f */\nfunc popFirst() -> Int {\npop(isFront: true)\n}\n/* \u961f\u5c3e\u51fa\u961f */\nfunc popLast() -> Int {\npop(isFront: false)\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peekFirst() -> Int? {\nisEmpty() ? nil : front?.val\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc peekLast() -> Int? {\nisEmpty() ? nil : rear?.val\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nfunc toArray() -> [Int] {\nvar node = front\nvar res = Array(repeating: 0, count: size())\nfor i in res.indices {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_deque.zig
// \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\nfn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = undefined,     // \u7ed3\u70b9\u503c\nnext: ?*Self = null,    // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nprev: ?*Self = null,    // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\n// Initialize a list node with specific value\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\nself.prev = null;\n}\n};\n}\n// \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217\nfn LinkedListDeque(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nfront: ?*ListNode(T) = null,                    // \u5934\u7ed3\u70b9 front\nrear: ?*ListNode(T) = null,                     // \u5c3e\u7ed3\u70b9 rear\ndeqSize: usize = 0,                             // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u961f\u5217\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.front = null;\nself.rear = null;\nself.deqSize = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.deqSize;\n}\n// \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u5165\u961f\u64cd\u4f5c\npub fn push(self: *Self, num: T, isFront: bool) !void {\nvar node = try self.mem_allocator.create(ListNode(T));\nnode.init(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (self.isEmpty()) {\nself.front = node;\nself.rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\n} else if (isFront) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nself.front.?.prev = node;\nnode.next = self.front;\nself.front = node;  // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nself.rear.?.next = node;\nnode.prev = self.rear;\nself.rear = node;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nself.deqSize += 1;      // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n} // \u961f\u9996\u5165\u961f\npub fn pushFirst(self: *Self, num: T) !void {\ntry self.push(num, true);\n} // \u961f\u5c3e\u5165\u961f\npub fn pushLast(self: *Self, num: T) !void {\ntry self.push(num, false);\n} // \u51fa\u961f\u64cd\u4f5c\npub fn pop(self: *Self, isFront: bool) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nvar val: T = undefined;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (isFront) {\nval = self.front.?.val;     // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nvar fNext = self.front.?.next;\nif (fNext != null) {\nfNext.?.prev = null;\nself.front.?.next = null;\n}\nself.front = fNext;         // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = self.rear.?.val;      // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nvar rPrev = self.rear.?.prev;\nif (rPrev != null) {\nrPrev.?.next = null;\nself.rear.?.prev = null;\n}\nself.rear = rPrev;          // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nself.deqSize -= 1;              // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n} // \u961f\u9996\u51fa\u961f\npub fn popFirst(self: *Self) T {\nreturn self.pop(true);\n} // \u961f\u5c3e\u51fa\u961f\npub fn popLast(self: *Self) T {\nreturn self.pop(false);\n} // \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peekFirst(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn self.front.?.val;\n}  // \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20\npub fn peekLast(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn self.rear.?.val;\n}\n// \u5c06\u94fe\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\nvar node = self.front;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[i] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n// \u6253\u5370\u53cc\u5411\u961f\u5217\npub fn print(self: *Self) !void {\nvar nums = try self.toArray();\nstd.debug.print(\"[\", .{});\nif (nums.len > 0) {\nfor (nums) |num, j| {\nstd.debug.print(\"{}{s}\", .{num, if (j == nums.len - 1) \"]\" else \" <-> \" });\n}\n} else {\nstd.debug.print(\"]\", .{});\n}\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/deque/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u4e0e\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u961f\u5217\u7c7b\u4f3c\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528\u73af\u5f62\u6570\u7ec4\u6765\u5b9e\u73b0\u53cc\u5411\u961f\u5217\u3002\u5728\u5b9e\u73b0\u961f\u5217\u7684\u57fa\u7840\u4e0a\uff0c\u589e\u52a0\u5b9e\u73b0\u201c\u961f\u9996\u5165\u961f\u201d\u548c\u201c\u961f\u5c3e\u51fa\u961f\u201d\u65b9\u6cd5\u5373\u53ef\u3002

ArrayDequepushLast()pushFirst()popLast()popFirst()

\u4ee5\u4e0b\u662f\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_deque.java
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\npublic ArrayDeque(int capacity) {\nthis.nums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity() {\nreturn nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn queSize == 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nprivate int index(int i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + capacity()) % capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npublic void pushFirst(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num;\nqueSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npublic void pushLast(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nint rear = index(front + queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npublic int popFirst() {\nint num = peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(front + 1);\nqueSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npublic int popLast() {\nint num = peekLast();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peekFirst() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn nums[front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npublic int peekLast() {\nif (isEmpty())\nthrow new EmptyStackException();\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nint last = index(front + queSize - 1);\nreturn nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\npublic int[] toArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[index(j)];\n}\nreturn res;\n}\n}\n
array_deque.cpp
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate:\nvector<int> nums;  // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nint front;         // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nint queSize;       // \u53cc\u5411\u961f\u5217\u957f\u5ea6\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nArrayDeque(int capacity) {\nnums.resize(capacity);\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\nint capacity() {\nreturn nums.size();\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty() {\nreturn queSize == 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nint index(int i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + capacity()) % capacity();\n}\n/* \u961f\u9996\u5165\u961f */\nvoid pushFirst(int num) {\nif (queSize == capacity()) {\ncout << \"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num;\nqueSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\nvoid pushLast(int num) {\nif (queSize == capacity()) {\ncout << \"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nint rear = index(front + queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\nint popFirst() {\nint num = peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(front + 1);\nqueSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\nint popLast() {\nint num = peekLast();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peekFirst() {\nif (isEmpty())\nthrow out_of_range(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn nums[front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nint peekLast() {\nif (isEmpty())\nthrow out_of_range(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nint last = index(front + queSize - 1);\nreturn nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> res(queSize);\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[index(j)];\n}\nreturn res;\n}\n};\n
array_deque.py
class ArrayDeque:\n\"\"\" \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 \"\"\"\ndef __init__(self, capacity: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__nums: List[int] = [0] * capacity\nself.__front: int = 0\nself.__size: int = 0\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf \"\"\"\nreturn len(self.__nums)\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__size == 0\ndef index(self, i: int) -> int:\n\"\"\" \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 \"\"\"\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n# \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n# \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + self.capacity()) % self.capacity()\ndef push_first(self, num: int) -> None:\n\"\"\" \u961f\u9996\u5165\u961f \"\"\"\nif self.__size == self.capacity():\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n# \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nself.__front = self.index(self.__front - 1)\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nself.__nums[self.__front] = num\nself.__size += 1\ndef push_last(self, num: int) -> None:\n\"\"\" \u961f\u5c3e\u5165\u961f \"\"\"\nif self.__size == self.capacity():\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n# \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nrear = self.index(self.__front + self.__size)\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.__nums[rear] = num\nself.__size += 1\ndef pop_first(self) -> int:\n\"\"\" \u961f\u9996\u51fa\u961f \"\"\"\nnum = self.peek_first()\n# \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nself.__front = self.index(self.__front + 1)\nself.__size -= 1\nreturn num\ndef pop_last(self) -> int:\n\"\"\" \u961f\u5c3e\u51fa\u961f \"\"\"\nnum = self.peek_last()\nself.__size -= 1\nreturn num\ndef peek_first(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\"\nreturn self.__nums[self.__front]\ndef peek_last(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\"\n# \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nlast = self.index(self.__front + self.__size - 1)\nreturn self.__nums[last]\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 \"\"\"\n# \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nres = []\nfor i in range(self.__size):\nres.append(self.__nums[self.index(self.__front + i)])\nreturn res\n
array_deque.go
[class]{ArrayDeque}-[func]{}\n
array_deque.js
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\n#nums;       // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\n#front;      // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\n#queSize;    // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(capacity) {\nthis.#nums = new Array(capacity);\nthis.#front = 0;\nthis.#queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\ncapacity() {\nreturn this.#nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.#queSize === 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nindex(i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + this.capacity()) % this.capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npushFirst(num) {\nif (this.#queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nthis.#front = this.index(this.#front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nthis.#nums[this.#front] = num;\nthis.#queSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npushLast(num) {\nif (this.#queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nconst rear = this.index(this.#front + this.#queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.#nums[rear] = num;\nthis.#queSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npopFirst() {\nconst num = this.peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nthis.#front = this.index(this.#front + 1);\nthis.#queSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npopLast() {\nconst num = this.peekLast();\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst() {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\nreturn this.#nums[this.#front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast() {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nconst last = this.index(this.#front + this.#queSize - 1);\nreturn this.#nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\ntoArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst res = [];\nfor (let i = 0, j = this.#front; i < this.#queSize; i++, j++) {\nres[i] = this.#nums[this.index(j)];\n}\nreturn res;\n}\n}\n
array_deque.ts
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate nums: number[];     // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate front: number;      // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate queSize: number;    // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(capacity: number) {\nthis.nums = new Array(capacity);\nthis.front = 0;\nthis.queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\ncapacity(): number {\nreturn this.nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.queSize === 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nindex(i: number): number {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + this.capacity()) % this.capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npushFirst(num: number): void {\nif (this.queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nthis.front = this.index(this.front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nthis.nums[this.front] = num;\nthis.queSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npushLast(num: number): void {\nif (this.queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nconst rear: number = this.index(this.front + this.queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.nums[rear] = num;\nthis.queSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npopFirst(): number {\nconst num: number = this.peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nthis.front = this.index(this.front + 1);\nthis.queSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npopLast(): number {\nconst num: number = this.peekLast();\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst(): number {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\nreturn this.nums[this.front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast(): number {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nconst last = this.index(this.front + this.queSize - 1);\nreturn this.nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\ntoArray(): number[] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst res: number[] = [];\nfor (let i = 0, j = this.front; i < this.queSize; i++, j++) {\nres[i] = this.nums[this.index(j)];\n}\nreturn res;\n}\n}\n
array_deque.c
[class]{ArrayDeque}-[func]{}\n
array_deque.cs
[class]{ArrayDeque}-[func]{}\n
array_deque.swift
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate var nums: [Int] // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate var front: Int // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate var queSize: Int // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\ninit(capacity: Int) {\nnums = Array(repeating: 0, count: capacity)\nfront = 0\nqueSize = 0\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\nfunc capacity() -> Int {\nnums.count\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nprivate func index(i: Int) -> Int {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\n(i + capacity()) % capacity()\n}\n/* \u961f\u9996\u5165\u961f */\nfunc pushFirst(num: Int) {\nif size() == capacity() {\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(i: front - 1)\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num\nqueSize += 1\n}\n/* \u961f\u5c3e\u5165\u961f */\nfunc pushLast(num: Int) {\nif size() == capacity() {\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nlet rear = index(i: front + size())\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num\nqueSize += 1\n}\n/* \u961f\u9996\u51fa\u961f */\nfunc popFirst() -> Int {\nlet num = peekFirst()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(i: front + 1)\nqueSize -= 1\nreturn num\n}\n/* \u961f\u5c3e\u51fa\u961f */\nfunc popLast() -> Int {\nlet num = peekLast()\nqueSize -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peekFirst() -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn nums[front]\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc peekLast() -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nlet last = index(i: front + size() - 1)\nreturn nums[last]\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nfunc toArray() -> [Int] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = Array(repeating: 0, count: size())\nfor (i, j) in sequence(first: (0, front), next: { $0 < self.size() - 1 ? ($0 + 1, $1 + 1) : nil }) {\nres[i] = nums[index(i: j)]\n}\nreturn res\n}\n}\n
array_deque.zig
[class]{ArrayDeque}-[func]{}\n
"},{"location":"chapter_stack_and_queue/deque/#533","title":"5.3.3. \u00a0 \u53cc\u5411\u961f\u5217\u5e94\u7528","text":"

\u53cc\u5411\u961f\u5217\u540c\u65f6\u8868\u73b0\u51fa\u6808\u4e0e\u961f\u5217\u7684\u903b\u8f91\uff0c\u56e0\u6b64\u53ef\u4ee5\u5b9e\u73b0\u4e24\u8005\u7684\u6240\u6709\u5e94\u7528\uff0c\u5e76\u4e14\u63d0\u4f9b\u66f4\u9ad8\u7684\u81ea\u7531\u5ea6\u3002

\u6211\u4eec\u77e5\u9053\uff0c\u8f6f\u4ef6\u7684\u201c\u64a4\u9500\u201d\u529f\u80fd\u9700\u8981\u4f7f\u7528\u6808\u6765\u5b9e\u73b0\uff1b\u7cfb\u7edf\u628a\u6bcf\u4e00\u6b21\u66f4\u6539\u64cd\u4f5c push \u5230\u6808\u4e2d\uff0c\u7136\u540e\u901a\u8fc7 pop \u5b9e\u73b0\u64a4\u9500\u3002\u7136\u800c\uff0c\u8003\u8651\u5230\u7cfb\u7edf\u8d44\u6e90\u6709\u9650\uff0c\u8f6f\u4ef6\u4e00\u822c\u4f1a\u9650\u5236\u64a4\u9500\u7684\u6b65\u6570\uff08\u4f8b\u5982\u4ec5\u5141\u8bb8\u4fdd\u5b58 \\(50\\) \u6b65\uff09\uff0c\u90a3\u4e48\u5f53\u6808\u7684\u957f\u5ea6 \\(> 50\\) \u65f6\uff0c\u8f6f\u4ef6\u5c31\u9700\u8981\u5728\u6808\u5e95\uff08\u5373\u961f\u9996\uff09\u6267\u884c\u5220\u9664\uff0c\u4f46\u6808\u65e0\u6cd5\u5b9e\u73b0\uff0c\u6b64\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u53cc\u5411\u961f\u5217\u6765\u66ff\u4ee3\u6808\u3002\u6ce8\u610f\uff0c\u201c\u64a4\u9500\u201d\u7684\u6838\u5fc3\u903b\u8f91\u4ecd\u7136\u662f\u6808\u7684\u5148\u5165\u540e\u51fa\uff0c\u53ea\u662f\u53cc\u5411\u961f\u5217\u53ef\u4ee5\u66f4\u52a0\u7075\u6d3b\u5730\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/","title":"5.2. \u00a0 \u961f\u5217","text":"

\u300c\u961f\u5217 Queue\u300d\u662f\u4e00\u79cd\u9075\u5faa\u300c\u5148\u5165\u5148\u51fa first in, first out\u300d\u6570\u636e\u64cd\u4f5c\u89c4\u5219\u7684\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002\u987e\u540d\u601d\u4e49\uff0c\u961f\u5217\u6a21\u62df\u7684\u662f\u6392\u961f\u73b0\u8c61\uff0c\u5373\u5916\u9762\u7684\u4eba\u4e0d\u65ad\u52a0\u5165\u961f\u5217\u5c3e\u90e8\uff0c\u800c\u5904\u4e8e\u961f\u5217\u5934\u90e8\u7684\u4eba\u4e0d\u65ad\u5730\u79bb\u5f00\u3002

\u6211\u4eec\u5c06\u961f\u5217\u5934\u90e8\u79f0\u4e3a\u300c\u961f\u9996\u300d\uff0c\u961f\u5217\u5c3e\u90e8\u79f0\u4e3a\u300c\u961f\u5c3e\u300d\uff0c\u5c06\u628a\u5143\u7d20\u52a0\u5165\u961f\u5c3e\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u5165\u961f\u300d\uff0c\u5220\u9664\u961f\u9996\u5143\u7d20\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u51fa\u961f\u300d\u3002

Fig. \u961f\u5217\u7684\u5148\u5165\u5148\u51fa\u89c4\u5219

"},{"location":"chapter_stack_and_queue/queue/#521","title":"5.2.1. \u00a0 \u961f\u5217\u5e38\u7528\u64cd\u4f5c","text":"

\u961f\u5217\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\u3002\u9700\u8981\u6ce8\u610f\uff0c\u4e0d\u540c\u7f16\u7a0b\u8bed\u8a00\u7684\u65b9\u6cd5\u540d\u662f\u4e0d\u540c\u7684\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u91c7\u7528\u4e0e\u6808\u76f8\u540c\u7684\u65b9\u6cd5\u547d\u540d\u3002

\u65b9\u6cd5\u540d \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 push() \u5143\u7d20\u5165\u961f\uff0c\u5373\u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u5c3e \\(O(1)\\) pop() \u961f\u9996\u5143\u7d20\u51fa\u961f \\(O(1)\\) peek() \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u961f\u5217\u7c7b\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig queue.java
/* \u521d\u59cb\u5316\u961f\u5217 */\nQueue<Integer> queue = new LinkedList<>();\n/* \u5143\u7d20\u5165\u961f */\nqueue.offer(1);\nqueue.offer(3);\nqueue.offer(2);\nqueue.offer(5);\nqueue.offer(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek = queue.peek();\n/* \u5143\u7d20\u51fa\u961f */\nint pop = queue.poll();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.size();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = queue.isEmpty();\n
queue.cpp
/* \u521d\u59cb\u5316\u961f\u5217 */\nqueue<int> queue;\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint front = queue.front();\n/* \u5143\u7d20\u51fa\u961f */\nqueue.pop();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.size();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty = queue.empty();\n
queue.py
\"\"\" \u521d\u59cb\u5316\u961f\u5217 \"\"\"\n# \u5728 Python \u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u5c06\u53cc\u5411\u961f\u5217\u7c7b deque \u770b\u4f5c\u961f\u5217\u4f7f\u7528\n# \u867d\u7136 queue.Queue() \u662f\u7eaf\u6b63\u7684\u961f\u5217\u7c7b\uff0c\u4f46\u4e0d\u592a\u597d\u7528\uff0c\u56e0\u6b64\u4e0d\u5efa\u8bae\nque: Deque[int] = collections.deque()\n\"\"\" \u5143\u7d20\u5165\u961f \"\"\"\nque.append(1)\nque.append(3)\nque.append(2)\nque.append(5)\nque.append(4)\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nfront: int = que[0];\n\"\"\" \u5143\u7d20\u51fa\u961f \"\"\"\npop: int = que.popleft()\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(que)\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(que) == 0\n
queue_test.go
/* \u521d\u59cb\u5316\u961f\u5217 */\n// \u5728 Go \u4e2d\uff0c\u5c06 list \u4f5c\u4e3a\u961f\u5217\u6765\u4f7f\u7528\nqueue := list.New()\n/* \u5143\u7d20\u5165\u961f */\nqueue.PushBack(1)\nqueue.PushBack(3)\nqueue.PushBack(2)\nqueue.PushBack(5)\nqueue.PushBack(4)\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek := queue.Front()\n/* \u5143\u7d20\u51fa\u961f */\npop := queue.Front()\nqueue.Remove(pop)\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nsize := queue.Len()\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty := queue.Len() == 0\n
queue.js
/* \u521d\u59cb\u5316\u961f\u5217 */\n// JavaScript \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528\nconst queue = [];\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nconst peek = queue[0];\n/* \u5143\u7d20\u51fa\u961f */\n// \u5e95\u5c42\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 shift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst pop = queue.shift();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = queue.length;\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst empty = queue.length === 0;\n
queue.ts
/* \u521d\u59cb\u5316\u961f\u5217 */\n// TypeScript \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528 \nconst queue: number[] = [];\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nconst peek = queue[0];\n/* \u5143\u7d20\u51fa\u961f */\n// \u5e95\u5c42\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 shift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst pop = queue.shift();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = queue.length;\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst empty = queue.length === 0;\n
queue.c
\n
queue.cs
/* \u521d\u59cb\u5316\u961f\u5217 */\nQueue<int> queue = new();\n/* \u5143\u7d20\u5165\u961f */\nqueue.Enqueue(1);\nqueue.Enqueue(3);\nqueue.Enqueue(2);\nqueue.Enqueue(5);\nqueue.Enqueue(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek = queue.Peek();\n/* \u5143\u7d20\u51fa\u961f */\nint pop = queue.Dequeue();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.Count();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = queue.Count() == 0;\n
queue.swift
/* \u521d\u59cb\u5316\u961f\u5217 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528\nvar queue: [Int] = []\n/* \u5143\u7d20\u5165\u961f */\nqueue.append(1)\nqueue.append(3)\nqueue.append(2)\nqueue.append(5)\nqueue.append(4)\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nlet peek = queue.first!\n/* \u5143\u7d20\u51fa\u961f */\n// \u7531\u4e8e\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 removeFirst \u7684\u590d\u6742\u5ea6\u4e3a O(n)\nlet pool = queue.removeFirst()\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nlet size = queue.count\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = queue.isEmpty\n
queue.zig
\n
"},{"location":"chapter_stack_and_queue/queue/#522","title":"5.2.2. \u00a0 \u961f\u5217\u5b9e\u73b0","text":"

\u961f\u5217\u9700\u8981\u4e00\u79cd\u53ef\u4ee5\u5728\u4e00\u7aef\u6dfb\u52a0\uff0c\u5e76\u5728\u53e6\u4e00\u7aef\u5220\u9664\u7684\u6570\u636e\u7ed3\u6784\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u6216\u6570\u7ec4\u6765\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/#_1","title":"\u57fa\u4e8e\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u6211\u4eec\u5c06\u94fe\u8868\u7684\u300c\u5934\u7ed3\u70b9\u300d\u548c\u300c\u5c3e\u7ed3\u70b9\u300d\u5206\u522b\u770b\u4f5c\u662f\u961f\u9996\u548c\u961f\u5c3e\uff0c\u5e76\u89c4\u5b9a\u961f\u5c3e\u53ea\u53ef\u6dfb\u52a0\u7ed3\u70b9\uff0c\u961f\u9996\u53ea\u53ef\u5220\u9664\u7ed3\u70b9\u3002

LinkedListQueuepush()pop()

\u4ee5\u4e0b\u662f\u4f7f\u7528\u94fe\u8868\u5b9e\u73b0\u961f\u5217\u7684\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_queue.java
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate ListNode front, rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nprivate int queSize = 0;\npublic LinkedListQueue() {\nfront = null;\nrear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f */\npublic void push(int num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == null) {\nfront = node;\nrear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nrear.next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop() {\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front.next;\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek() {\nif (size() == 0)\nthrow new EmptyStackException();\nreturn front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray() {\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.cpp
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate:\nListNode *front, *rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nint queSize;\npublic:\nLinkedListQueue() {\nfront = nullptr;\nrear = nullptr;\nqueSize = 0;\n}\n~LinkedListQueue() {\ndelete front;\ndelete rear;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn queSize == 0;\n}\n/* \u5165\u961f */\nvoid push(int num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode* node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == nullptr) {\nfront = node;\nrear = node;\n}\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse {\nrear->next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\nvoid pop() {\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nListNode *tmp = front;\nfront = front->next;\n// \u91ca\u653e\u5185\u5b58\ndelete tmp; queSize--;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek() {\nif (size() == 0)\nthrow out_of_range(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn front->val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Vector \u5e76\u8fd4\u56de */\nvector<int> toVector() {\nListNode* node = front;\nvector<int> res(size());\nfor (int i = 0; i < res.size(); i++) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_queue.py
class LinkedListQueue:\n\"\"\" \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__front: Optional[ListNode] = None  # \u5934\u7ed3\u70b9 front\nself.__rear: Optional[ListNode] = None   # \u5c3e\u7ed3\u70b9 rear\nself.__size: int = 0\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn not self.__front\ndef push(self, num: int) -> None:\n\"\"\" \u5165\u961f \"\"\"\n# \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nnode = ListNode(num)\n# \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif self.__front is None:\nself.__front = node\nself.__rear = node\n# \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse:\nself.__rear.next = node\nself.__rear = node\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u961f \"\"\"\nnum = self.peek()\n# \u5220\u9664\u5934\u7ed3\u70b9\nself.__front = self.__front.next\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nif self.size() == 0:\nprint(\"\u961f\u5217\u4e3a\u7a7a\")\nreturn False\nreturn self.__front.val\ndef to_list(self) -> List[int]:\n\"\"\" \u8f6c\u5316\u4e3a\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nqueue = []\ntemp = self.__front\nwhile temp:\nqueue.append(temp.val)\ntemp = temp.next\nreturn queue\n
linkedlist_queue.go
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\ntype linkedListQueue struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list \u6765\u5b9e\u73b0\u961f\u5217\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u961f\u5217 */\nfunc newLinkedListQueue() *linkedListQueue {\nreturn &linkedListQueue{\ndata: list.New(),\n}\n}\n/* \u5165\u961f */\nfunc (s *linkedListQueue) push(value any) {\ns.data.PushBack(value)\n}\n/* \u51fa\u961f */\nfunc (s *linkedListQueue) pop() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (s *linkedListQueue) peek() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\nreturn e.Value\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (s *linkedListQueue) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListQueue) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListQueue) toList() *list.List {\nreturn s.data\n}\n
linkedlist_queue.js
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\n#front;  // \u5934\u7ed3\u70b9 #front\n#rear;   // \u5c3e\u7ed3\u70b9 #rear\n#queSize = 0;\nconstructor() {\nthis.#front = null;\nthis.#rear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.size === 0;\n}\n/* \u5165\u961f */\npush(num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nconst node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (!this.#front) {\nthis.#front = node;\nthis.#rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nthis.#rear.next = node;\nthis.#rear = node;\n}\nthis.#queSize++;\n}\n/* \u51fa\u961f */\npop() {\nconst num = this.peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nthis.#front = this.#front.next;\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek() {\nif (this.size === 0)\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.#front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray() {\nlet node = this.#front;\nconst res = new Array(this.size);\nfor (let i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.ts
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate front: ListNode | null; // \u5934\u7ed3\u70b9 front\nprivate rear: ListNode | null; // \u5c3e\u7ed3\u70b9 rear\nprivate queSize: number = 0;\nconstructor() {\nthis.front = null;\nthis.rear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.size === 0;\n}\n/* \u5165\u961f */\npush(num: number): void {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nconst node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (!this.front) {\nthis.front = node;\nthis.rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nthis.rear!.next = node;\nthis.rear = node;\n}\nthis.queSize++;\n}\n/* \u51fa\u961f */\npop(): number {\nconst num = this.peek();\nif (!this.front) throw new Error('\u961f\u5217\u4e3a\u7a7a');\n// \u5220\u9664\u5934\u7ed3\u70b9\nthis.front = this.front.next;\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek(): number {\nif (this.size === 0) throw new Error('\u961f\u5217\u4e3a\u7a7a');\nreturn this.front!.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray(): number[] {\nlet node = this.front;\nconst res = new Array<number>(this.size);\nfor (let i = 0; i < res.length; i++) {\nres[i] = node!.val;\nnode = node!.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.c
[class]{linkedListQueue}-[func]{}\n
linkedlist_queue.cs
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue\n{\nprivate ListNode? front, rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nprivate int queSize = 0;\npublic LinkedListQueue()\n{\nfront = null;\nrear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u961f */\npublic void push(int num)\n{\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == null)\n{\nfront = node;\nrear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n}\nelse if (rear != null)\n{\nrear.next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop()\n{\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front?.next;\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek()\n{\nif (size() == 0 || front == null)\nthrow new Exception();\nreturn front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nif (front == null)\nreturn Array.Empty<int>();\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.Length; i++)\n{\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.swift
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate var front: ListNode? // \u5934\u7ed3\u70b9\nprivate var rear: ListNode? // \u5c3e\u7ed3\u70b9\nprivate var _size = 0\ninit() {}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\n_size\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u961f */\nfunc push(num: Int) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nlet node = ListNode(x: num)\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif front == nil {\nfront = node\nrear = node\n}\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse {\nrear?.next = node\nrear = node\n}\n_size += 1\n}\n/* \u51fa\u961f */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front?.next\n_size -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn front!.val\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nvar node = front\nvar res = Array(repeating: 0, count: size())\nfor i in res.indices {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_queue.zig
// \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217\nfn LinkedListQueue(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nfront: ?*inc.ListNode(T) = null,                // \u5934\u7ed3\u70b9 front\nrear: ?*inc.ListNode(T) = null,                 // \u5c3e\u7ed3\u70b9 rear\nqueSize: usize = 0,                             // \u961f\u5217\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u961f\u5217\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.front = null;\nself.rear = null;\nself.queSize = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.queSize;\n}\n// \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.size() == 0) @panic(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn self.front.?.val;\n}  // \u5165\u961f\npub fn push(self: *Self, num: T) !void {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nvar node = try self.mem_allocator.create(inc.ListNode(T));\nnode.init(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (self.front == null) {\nself.front = node;\nself.rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nself.rear.?.next = node;\nself.rear = node;\n}\nself.queSize += 1;\n} // \u51fa\u961f\npub fn pop(self: *Self) T {\nvar num = self.peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nself.front = self.front.?.next;\nself.queSize -= 1;\nreturn num;\n} // \u5c06\u94fe\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\nvar node = self.front;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[i] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/queue/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u6570\u7ec4\u7684\u5220\u9664\u9996\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u8fd9\u4f1a\u5bfc\u81f4\u51fa\u961f\u64cd\u4f5c\u6548\u7387\u4f4e\u4e0b\u3002\u7136\u800c\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u53d6\u4e0b\u8ff0\u7684\u5de7\u5999\u65b9\u6cd5\u6765\u907f\u514d\u8fd9\u4e2a\u95ee\u9898\u3002

\u8003\u8651\u501f\u52a9\u4e00\u4e2a\u53d8\u91cf front \u6765\u6307\u5411\u961f\u9996\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u5e76\u7ef4\u62a4\u53d8\u91cf queSize \u6765\u8bb0\u5f55\u961f\u5217\u957f\u5ea6\u3002\u6211\u4eec\u5b9a\u4e49 rear = front + queSize \uff0c\u8be5\u516c\u5f0f\u8ba1\u7b97\u51fa\u6765\u7684 rear \u6307\u5411\u201c\u961f\u5c3e\u5143\u7d20\u7d22\u5f15 \\(+1\\) \u201d\u7684\u4f4d\u7f6e\u3002

\u5728\u8be5\u8bbe\u8ba1\u4e0b\uff0c\u6570\u7ec4\u4e2d\u5305\u542b\u5143\u7d20\u7684\u6709\u6548\u533a\u95f4\u4e3a [front, rear - 1] \uff0c\u8fdb\u800c

  • \u5bf9\u4e8e\u5165\u961f\u64cd\u4f5c\uff0c\u5c06\u8f93\u5165\u5143\u7d20\u8d4b\u503c\u7ed9 rear \u7d22\u5f15\u5904\uff0c\u5e76\u5c06 queSize \u81ea\u589e \\(1\\) \u5373\u53ef\uff1b
  • \u5bf9\u4e8e\u51fa\u961f\u64cd\u4f5c\uff0c\u4ec5\u9700\u5c06 front \u81ea\u589e \\(1\\) \uff0c\u5e76\u5c06 queSize \u81ea\u51cf \\(1\\) \u5373\u53ef\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5165\u961f\u4e0e\u51fa\u961f\u64cd\u4f5c\u90fd\u4ec5\u9700\u5355\u6b21\u64cd\u4f5c\u5373\u53ef\u5b8c\u6210\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(1)\\) \u3002

ArrayQueuepush()pop()

\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u4f1a\u53d1\u73b0\u4e00\u4e2a\u95ee\u9898\uff1a\u5728\u4e0d\u65ad\u5165\u961f\u4e0e\u51fa\u961f\u7684\u8fc7\u7a0b\u4e2d\uff0cfront \u548c rear \u90fd\u5728\u5411\u53f3\u79fb\u52a8\uff0c\u5728\u5230\u8fbe\u6570\u7ec4\u5c3e\u90e8\u540e\u5c31\u65e0\u6cd5\u7ee7\u7eed\u79fb\u52a8\u4e86\u3002\u4e3a\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u6211\u4eec\u8003\u8651\u5c06\u6570\u7ec4\u770b\u4f5c\u662f\u9996\u5c3e\u76f8\u63a5\u7684\uff0c\u8fd9\u6837\u7684\u6570\u7ec4\u88ab\u79f0\u4e3a\u300c\u73af\u5f62\u6570\u7ec4\u300d\u3002

\u5bf9\u4e8e\u73af\u5f62\u6570\u7ec4\uff0c\u6211\u4eec\u9700\u8981\u4ee4 front \u6216 rear \u5728\u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u76f4\u63a5\u7ed5\u56de\u5230\u6570\u7ec4\u5934\u90e8\u63a5\u7eed\u904d\u5386\u3002\u8fd9\u79cd\u5468\u671f\u6027\u89c4\u5f8b\u53ef\u4ee5\u901a\u8fc7\u300c\u53d6\u4f59\u64cd\u4f5c\u300d\u6765\u5b9e\u73b0\uff0c\u8be6\u60c5\u8bf7\u89c1\u4ee5\u4e0b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_queue.java
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u961f\u5217\u957f\u5ea6\npublic ArrayQueue(int capacity) {\nnums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity() {\nreturn nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn queSize == 0;\n}\n/* \u5165\u961f */\npublic void push(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop() {\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn nums[front];\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\npublic int[] toArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[j % capacity()];\n}\nreturn res;\n}\n}\n
array_queue.cpp
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate:\nint *nums;       // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nint front;       // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nint queSize;     // \u961f\u5217\u957f\u5ea6\nint queCapacity; // \u961f\u5217\u5bb9\u91cf\npublic:\nArrayQueue(int capacity) {\n// \u521d\u59cb\u5316\u6570\u7ec4\nnums = new int[capacity];\nqueCapacity = capacity;\nfront = queSize = 0;\n}\n~ArrayQueue() {\ndelete[] nums;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nint capacity() {\nreturn queCapacity;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn size() == 0;\n}\n/* \u5165\u961f */\nvoid push(int num) {\nif (queSize == queCapacity) {\ncout << \"\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u8ba1\u7b97\u961f\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % queCapacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\nvoid pop() {\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % queCapacity;\nqueSize--;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek() {\nif (empty())\nthrow out_of_range(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn nums[front];\n}\n/* \u5c06\u6570\u7ec4\u8f6c\u5316\u4e3a Vector \u5e76\u8fd4\u56de */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> arr(queSize);\nfor (int i = 0, j = front; i < queSize; i++, j++) {\narr[i] = nums[j % queCapacity];\n}\nreturn arr;\n}\n};\n
array_queue.py
class ArrayQueue:\n\"\"\" \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 \"\"\"\ndef __init__(self, size: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__nums: List[int] = [0] * size  # \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nself.__front: int = 0          # \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nself.__size: int = 0           # \u961f\u5217\u957f\u5ea6\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf \"\"\"\nreturn len(self.__nums)\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__size == 0\ndef push(self, num: int) -> None:\n\"\"\" \u5165\u961f \"\"\"\nassert self.__size < self.capacity(), \"\u961f\u5217\u5df2\u6ee1\"\n# \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nrear: int = (self.__front + self.__size) % self.capacity()\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.__nums[rear] = num\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u961f \"\"\"\nnum: int = self.peek()\n# \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nself.__front = (self.__front + 1) % self.capacity()\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u961f\u5217\u4e3a\u7a7a\"\nreturn self.__nums[self.__front]\ndef to_list(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nres: List[int] = [0] * self.size()\nj: int = self.__front\nfor i in range(self.size()):\nres[i] = self.__nums[(j % self.capacity())]\nj += 1\nreturn res\n
array_queue.go
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\ntype arrayQueue struct {\nnums        []int // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nfront       int   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nqueSize     int   // \u961f\u5217\u957f\u5ea6\nqueCapacity int   // \u961f\u5217\u5bb9\u91cf\uff08\u5373\u6700\u5927\u5bb9\u7eb3\u5143\u7d20\u6570\u91cf\uff09\n}\n/* \u521d\u59cb\u5316\u961f\u5217 */\nfunc newArrayQueue(queCapacity int) *arrayQueue {\nreturn &arrayQueue{\nnums:        make([]int, queCapacity),\nqueCapacity: queCapacity,\nfront:       0,\nqueSize:     0,\n}\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (q *arrayQueue) size() int {\nreturn q.queSize\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (q *arrayQueue) isEmpty() bool {\nreturn q.queSize == 0\n}\n/* \u5165\u961f */\nfunc (q *arrayQueue) push(num int) {\n// \u5f53 rear == queCapacity \u8868\u793a\u961f\u5217\u5df2\u6ee1\nif q.queSize == q.queCapacity {\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nrear := (q.front + q.queSize) % q.queCapacity\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nq.nums[rear] = num\nq.queSize++\n}\n/* \u51fa\u961f */\nfunc (q *arrayQueue) pop() any {\nnum := q.peek()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nq.front = (q.front + 1) % q.queCapacity\nq.queSize--\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (q *arrayQueue) peek() any {\nif q.isEmpty() {\nreturn nil\n}\nreturn q.nums[q.front]\n}\n/* \u83b7\u53d6 Slice \u7528\u4e8e\u6253\u5370 */\nfunc (q *arrayQueue) toSlice() []int {\nrear := (q.front + q.queSize)\nif rear >= q.queCapacity {\nrear %= q.queCapacity\nreturn append(q.nums[q.front:], q.nums[:rear]...)\n}\nreturn q.nums[q.front:rear]\n}\n
array_queue.js
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\n#nums;         // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\n#front = 0;    // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\n#queSize = 0;  // \u961f\u5217\u957f\u5ea6\nconstructor(capacity) {\nthis.#nums = new Array(capacity);\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nget capacity() {\nreturn this.#nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nempty() {\nreturn this.#queSize == 0;\n}\n/* \u5165\u961f */\npush(num) {\nif (this.size == this.capacity) {\nconsole.log(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nconst rear = (this.#front + this.size) % this.capacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.#nums[rear] = num;\nthis.#queSize++;\n}\n/* \u51fa\u961f */\npop() {\nconst num = this.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nthis.#front = (this.#front + 1) % this.capacity;\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek() {\nif (this.empty())\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.#nums[this.#front];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst arr = new Array(this.size);\nfor (let i = 0, j = this.#front; i < this.size; i++, j++) {\narr[i] = this.#nums[j % this.capacity];\n}\nreturn arr;\n}\n}\n
array_queue.ts
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate nums: number[];  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate front: number;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate queSize: number; // \u961f\u5217\u957f\u5ea6\nconstructor(capacity: number) {\nthis.nums = new Array(capacity);\nthis.front = this.queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nget capacity(): number {\nreturn this.nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nempty(): boolean {\nreturn this.queSize == 0;\n}\n/* \u5165\u961f */\npush(num: number): void {\nif (this.size == this.capacity) {\nconsole.log(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nconst rear = (this.front + this.queSize) % this.capacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.nums[rear] = num;\nthis.queSize++;\n}\n/* \u51fa\u961f */\npop(): number {\nconst num = this.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nthis.front = (this.front + 1) % this.capacity;\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek(): number {\nif (this.empty())\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.nums[this.front];\n}\n/* \u8fd4\u56de Array */\ntoArray(): number[] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst arr = new Array(this.size);\nfor (let i = 0, j = this.front; i < this.size; i++, j++) {\narr[i] = this.nums[j % this.capacity];\n}\nreturn arr;\n}\n}\n
array_queue.c
[class]{arrayQueue}-[func]{}\n
array_queue.cs
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue\n{\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u961f\u5217\u957f\u5ea6\npublic ArrayQueue(int capacity)\n{\nnums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity()\n{\nreturn nums.Length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn queSize == 0;\n}\n/* \u5165\u961f */\npublic void push(int num)\n{\nif (queSize == capacity())\n{\nConsole.WriteLine(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop()\n{\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek()\n{\nif (isEmpty())\nthrow new Exception();\nreturn nums[front];\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\npublic int[] toArray()\n{\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++)\n{\nres[i] = nums[j % this.capacity()];\n}\nreturn res;\n}\n}\n
array_queue.swift
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate var nums: [Int] // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate var front = 0 // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate var queSize = 0 // \u961f\u5217\u957f\u5ea6\ninit(capacity: Int) {\n// \u521d\u59cb\u5316\u6570\u7ec4\nnums = Array(repeating: 0, count: capacity)\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nfunc capacity() -> Int {\nnums.count\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nqueSize == 0\n}\n/* \u5165\u961f */\nfunc push(num: Int) {\nif size() == capacity() {\nprint(\"\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nlet rear = (front + queSize) % capacity()\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num\nqueSize += 1\n}\n/* \u51fa\u961f */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity()\nqueSize -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn nums[front]\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\nfunc toArray() -> [Int] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = Array(repeating: 0, count: queSize)\nfor (i, j) in sequence(first: (0, front), next: { $0 < self.queSize - 1 ? ($0 + 1, $1 + 1) : nil }) {\nres[i] = nums[j % capacity()]\n}\nreturn res\n}\n}\n
array_queue.zig
// \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217\nfn ArrayQueue(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nnums: []T = undefined,                          // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4     \ncap: usize = 0,                                 // \u961f\u5217\u5bb9\u91cf\nfront: usize = 0,                               // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nqueSize: usize = 0,                             // \u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e + 1\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6570\u7ec4\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator, cap: usize) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.cap = cap;\nself.nums = try self.mem_allocator.alloc(T, self.cap);\nstd.mem.set(T, self.nums, @as(T, 0));\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf\npub fn capacity(self: *Self) usize {\nreturn self.cap;\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.queSize;\n}\n// \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.queSize == 0;\n}\n// \u5165\u961f\npub fn push(self: *Self, num: T) !void {\nif (self.size() == self.capacity()) {\nstd.debug.print(\"\u961f\u5217\u5df2\u6ee1\\n\", .{});\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nvar rear = (self.front + self.queSize) % self.capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.nums[rear] = num;\nself.queSize += 1;\n} // \u51fa\u961f\npub fn pop(self: *Self) T {\nvar num = self.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nself.front = (self.front + 1) % self.capacity();\nself.queSize -= 1;\nreturn num;\n} // \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn self.nums[self.front];\n} // \u8fd4\u56de\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nvar j: usize = self.front;\nwhile (i < self.size()) : ({ i += 1; j += 1; }) {\nres[i] = self.nums[j % self.capacity()];\n}\nreturn res;\n}\n};\n}\n

\u4ee5\u4e0a\u5b9e\u73b0\u7684\u961f\u5217\u4ecd\u5b58\u5728\u5c40\u9650\u6027\uff0c\u5373\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u4e0d\u8fc7\u8fd9\u4e2a\u95ee\u9898\u5f88\u5bb9\u6613\u89e3\u51b3\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6570\u7ec4\u66ff\u6362\u4e3a\u5217\u8868\uff08\u5373\u52a8\u6001\u6570\u7ec4\uff09\uff0c\u4ece\u800c\u5f15\u5165\u6269\u5bb9\u673a\u5236\u3002\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u5c1d\u8bd5\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/#523","title":"5.2.3. \u00a0 \u4e24\u79cd\u5b9e\u73b0\u5bf9\u6bd4","text":"

\u4e0e\u6808\u7684\u7ed3\u8bba\u4e00\u81f4\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_stack_and_queue/queue/#524","title":"5.2.4. \u00a0 \u961f\u5217\u5178\u578b\u5e94\u7528","text":"
  • \u6dd8\u5b9d\u8ba2\u5355\u3002\u8d2d\u7269\u8005\u4e0b\u5355\u540e\uff0c\u8ba2\u5355\u5c31\u88ab\u52a0\u5165\u5230\u961f\u5217\u4e4b\u4e2d\uff0c\u968f\u540e\u7cfb\u7edf\u518d\u6839\u636e\u987a\u5e8f\u4f9d\u6b21\u5904\u7406\u961f\u5217\u4e2d\u7684\u8ba2\u5355\u3002\u5728\u53cc\u5341\u4e00\u65f6\uff0c\u5728\u77ed\u65f6\u95f4\u5185\u4f1a\u4ea7\u751f\u6d77\u91cf\u7684\u8ba2\u5355\uff0c\u5982\u4f55\u5904\u7406\u300c\u9ad8\u5e76\u53d1\u300d\u5219\u662f\u5de5\u7a0b\u5e08\u4eec\u9700\u8981\u91cd\u70b9\u601d\u8003\u7684\u95ee\u9898\u3002
  • \u5404\u79cd\u5f85\u529e\u4e8b\u9879\u3002\u4efb\u4f55\u9700\u8981\u5b9e\u73b0\u201c\u5148\u6765\u540e\u5230\u201d\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u6253\u5370\u673a\u7684\u4efb\u52a1\u961f\u5217\u3001\u9910\u5385\u7684\u51fa\u9910\u961f\u5217\u7b49\u7b49\u3002
"},{"location":"chapter_stack_and_queue/stack/","title":"5.1. \u00a0 \u6808","text":"

\u300c\u6808 Stack\u300d\u662f\u4e00\u79cd\u9075\u5faa\u300c\u5148\u5165\u540e\u51fa first in, last out\u300d\u6570\u636e\u64cd\u4f5c\u89c4\u5219\u7684\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u6808\u7c7b\u6bd4\u4e3a\u653e\u5728\u684c\u9762\u4e0a\u7684\u4e00\u645e\u76d8\u5b50\uff0c\u5982\u679c\u9700\u8981\u62ff\u51fa\u5e95\u90e8\u7684\u76d8\u5b50\uff0c\u5219\u9700\u8981\u5148\u5c06\u4e0a\u9762\u7684\u76d8\u5b50\u4f9d\u6b21\u53d6\u51fa\u3002

\u201c\u76d8\u5b50\u201d\u662f\u4e00\u79cd\u5f62\u8c61\u6bd4\u55bb\uff0c\u6211\u4eec\u5c06\u76d8\u5b50\u66ff\u6362\u4e3a\u4efb\u610f\u4e00\u79cd\u5143\u7d20\uff08\u4f8b\u5982\u6574\u6570\u3001\u5b57\u7b26\u3001\u5bf9\u8c61\u7b49\uff09\uff0c\u5c31\u5f97\u5230\u4e86\u6808\u6570\u636e\u7ed3\u6784\u3002

\u6211\u4eec\u5c06\u8fd9\u4e00\u645e\u5143\u7d20\u7684\u9876\u90e8\u79f0\u4e3a\u300c\u6808\u9876\u300d\uff0c\u5c06\u5e95\u90e8\u79f0\u4e3a\u300c\u6808\u5e95\u300d\uff0c\u5c06\u628a\u5143\u7d20\u6dfb\u52a0\u5230\u6808\u9876\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u5165\u6808\u300d\uff0c\u5c06\u5220\u9664\u6808\u9876\u5143\u7d20\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u51fa\u6808\u300d\u3002

Fig. \u6808\u7684\u5148\u5165\u540e\u51fa\u89c4\u5219

"},{"location":"chapter_stack_and_queue/stack/#511","title":"5.1.1. \u00a0 \u6808\u5e38\u7528\u64cd\u4f5c","text":"

\u6808\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff0c\u65b9\u6cd5\u540d\u9700\u6839\u636e\u7f16\u7a0b\u8bed\u8a00\u6765\u786e\u5b9a\uff0c\u6b64\u5904\u6211\u4eec\u4ee5\u5e38\u89c1\u7684 push , pop , peek \u4e3a\u4f8b\u3002

\u65b9\u6cd5 \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 push() \u5143\u7d20\u5165\u6808\uff08\u6dfb\u52a0\u81f3\u6808\u9876\uff09 \\(O(1)\\) pop() \u6808\u9876\u5143\u7d20\u51fa\u6808 \\(O(1)\\) peek() \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u6808\u7c7b\u3002 \u67d0\u4e9b\u8bed\u8a00\u5e76\u672a\u4e13\u95e8\u63d0\u4f9b\u6808\u7c7b\uff0c\u4f46\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u628a\u8be5\u8bed\u8a00\u7684\u300c\u6570\u7ec4\u300d\u6216\u300c\u94fe\u8868\u300d\u770b\u4f5c\u6808\u6765\u4f7f\u7528\uff0c\u5e76\u901a\u8fc7\u201c\u8111\u8865\u201d\u6765\u5c4f\u853d\u65e0\u5173\u64cd\u4f5c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig stack.java
/* \u521d\u59cb\u5316\u6808 */\nStack<Integer> stack = new Stack<>();\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint peek = stack.peek();\n/* \u5143\u7d20\u51fa\u6808 */\nint pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.size();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = stack.isEmpty();\n
stack.cpp
/* \u521d\u59cb\u5316\u6808 */\nstack<int> stack;\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top = stack.top();\n/* \u5143\u7d20\u51fa\u6808 */\nstack.pop(); // \u65e0\u8fd4\u56de\u503c\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.size();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nbool empty = stack.empty();\n
stack.py
\"\"\" \u521d\u59cb\u5316\u6808 \"\"\"\n# Python \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a List \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nstack: List[int] = []\n\"\"\" \u5143\u7d20\u5165\u6808 \"\"\"\nstack.append(1)\nstack.append(3)\nstack.append(2)\nstack.append(5)\nstack.append(4)\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\npeek: int = stack[-1]\n\"\"\" \u5143\u7d20\u51fa\u6808 \"\"\"\npop: int = stack.pop()\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(stack)\n\"\"\" \u5224\u65ad\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(stack) == 0\n
stack_test.go
/* \u521d\u59cb\u5316\u6808 */\n// \u5728 Go \u4e2d\uff0c\u63a8\u8350\u5c06 Slice \u5f53\u4f5c\u6808\u6765\u4f7f\u7528\nvar stack []int\n/* \u5143\u7d20\u5165\u6808 */\nstack = append(stack, 1)\nstack = append(stack, 3)\nstack = append(stack, 2)\nstack = append(stack, 5)\nstack = append(stack, 4)\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek := stack[len(stack)-1]\n/* \u5143\u7d20\u51fa\u6808 */\npop := stack[len(stack)-1]\nstack = stack[:len(stack)-1]\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nsize := len(stack)\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nisEmpty := len(stack) == 0\n
stack.js
/* \u521d\u59cb\u5316\u6808 */\n// Javascript \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nconst stack = [];\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nconst peek = stack[stack.length-1];\n/* \u5143\u7d20\u51fa\u6808 */\nconst pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nconst size = stack.length;\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nconst is_empty = stack.length === 0;\n
stack.ts
/* \u521d\u59cb\u5316\u6808 */\n// Typescript \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nconst stack: number[] = [];\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nconst peek = stack[stack.length - 1];\n/* \u5143\u7d20\u51fa\u6808 */\nconst pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nconst size = stack.length;\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nconst is_empty = stack.length === 0;\n
stack.c
\n
stack.cs
/* \u521d\u59cb\u5316\u6808 */\nStack<int> stack = new ();\n/* \u5143\u7d20\u5165\u6808 */\nstack.Push(1);\nstack.Push(3);\nstack.Push(2);\nstack.Push(5);\nstack.Push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint peek = stack.Peek();\n/* \u5143\u7d20\u51fa\u6808 */\nint pop = stack.Pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.Count();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = stack.Count()==0;\n
stack.swift
/* \u521d\u59cb\u5316\u6808 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528\nvar stack: [Int] = []\n/* \u5143\u7d20\u5165\u6808 */\nstack.append(1)\nstack.append(3)\nstack.append(2)\nstack.append(5)\nstack.append(4)\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nlet peek = stack.last!\n/* \u5143\u7d20\u51fa\u6808 */\nlet pop = stack.removeLast()\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nlet size = stack.count\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = stack.isEmpty\n
stack.zig
\n
"},{"location":"chapter_stack_and_queue/stack/#512","title":"5.1.2. \u00a0 \u6808\u7684\u5b9e\u73b0","text":"

\u4e3a\u4e86\u66f4\u52a0\u6e05\u6670\u5730\u4e86\u89e3\u6808\u7684\u8fd0\u884c\u673a\u5236\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u81ea\u5df1\u52a8\u624b\u5b9e\u73b0\u4e00\u4e2a\u6808\u7c7b\u3002

\u6808\u89c4\u5b9a\u5143\u7d20\u662f\u5148\u5165\u540e\u51fa\u7684\uff0c\u56e0\u6b64\u6211\u4eec\u53ea\u80fd\u5728\u6808\u9876\u6dfb\u52a0\u6216\u5220\u9664\u5143\u7d20\u3002\u7136\u800c\uff0c\u6570\u7ec4\u6216\u94fe\u8868\u90fd\u53ef\u4ee5\u5728\u4efb\u610f\u4f4d\u7f6e\u6dfb\u52a0\u5220\u9664\u5143\u7d20\uff0c\u56e0\u6b64 \u6808\u53ef\u88ab\u770b\u4f5c\u662f\u4e00\u79cd\u53d7\u7ea6\u675f\u7684\u6570\u7ec4\u6216\u94fe\u8868\u3002\u6362\u8a00\u4e4b\uff0c\u6211\u4eec\u53ef\u4ee5\u201c\u5c4f\u853d\u201d\u6570\u7ec4\u6216\u94fe\u8868\u7684\u90e8\u5206\u65e0\u5173\u64cd\u4f5c\uff0c\u4f7f\u4e4b\u5bf9\u5916\u7684\u8868\u73b0\u903b\u8f91\u7b26\u5408\u6808\u7684\u89c4\u5b9a\u5373\u53ef\u3002

"},{"location":"chapter_stack_and_queue/stack/#_1","title":"\u57fa\u4e8e\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u4f7f\u7528\u300c\u94fe\u8868\u300d\u5b9e\u73b0\u6808\u65f6\uff0c\u5c06\u94fe\u8868\u7684\u5934\u7ed3\u70b9\u770b\u4f5c\u6808\u9876\uff0c\u5c06\u5c3e\u7ed3\u70b9\u770b\u4f5c\u6808\u5e95\u3002

\u5bf9\u4e8e\u5165\u6808\u64cd\u4f5c\uff0c\u5c06\u5143\u7d20\u63d2\u5165\u5230\u94fe\u8868\u5934\u90e8\u5373\u53ef\uff0c\u8fd9\u79cd\u7ed3\u70b9\u6dfb\u52a0\u65b9\u5f0f\u88ab\u79f0\u4e3a\u201c\u5934\u63d2\u6cd5\u201d\u3002\u800c\u5bf9\u4e8e\u51fa\u6808\u64cd\u4f5c\uff0c\u5219\u5c06\u5934\u7ed3\u70b9\u4ece\u94fe\u8868\u4e2d\u5220\u9664\u5373\u53ef\u3002

LinkedListStackpush()pop()

\u4ee5\u4e0b\u662f\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u6808\u7684\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_stack.java
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate ListNode stackPeek;  // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate int stkSize = 0;   // \u6808\u7684\u957f\u5ea6\npublic LinkedListStack() {\nstackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size() {\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num) {\nListNode node = new ListNode(num);\nnode.next = stackPeek;\nstackPeek = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\npublic int pop() {\nint num = peek();\nstackPeek = stackPeek.next;\nstkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek() {\nif (size() == 0)\nthrow new EmptyStackException();\nreturn stackPeek.val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray() {\nListNode node = stackPeek;\nint[] res = new int[size()];\nfor (int i = res.length - 1; i >= 0; i--) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.cpp
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate:\nListNode* stackTop; // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nint stkSize;        // \u6808\u7684\u957f\u5ea6\npublic:\nLinkedListStack() {\nstackTop = nullptr;\nstkSize = 0;\n}\n~LinkedListStack() {\nfreeMemoryLinkedList(stackTop);\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size() {\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\nvoid push(int num) {\nListNode* node = new ListNode(num);\nnode->next = stackTop;\nstackTop = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\nvoid pop() {\nint num = top();\nListNode *tmp = stackTop;\nstackTop = stackTop->next;\n// \u91ca\u653e\u5185\u5b58\ndelete tmp;\nstkSize--;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top() {\nif (size() == 0)\nthrow out_of_range(\"\u6808\u4e3a\u7a7a\");\nreturn stackTop->val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nvector<int> toVector() {\nListNode* node = stackTop;\nvector<int> res(size());\nfor (int i = res.size() - 1; i >= 0; i--) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_stack.py
class LinkedListStack:\n\"\"\" \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__peek: Optional[ListNode] = None\nself.__size: int = 0\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn not self.__peek\ndef push(self, val: int) -> None:\n\"\"\" \u5165\u6808 \"\"\"\nnode = ListNode(val)\nnode.next = self.__peek\nself.__peek = node\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u6808 \"\"\"\nnum: int = self.peek()\nself.__peek = self.__peek.next\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\n# \u5224\u7a7a\u5904\u7406\nif not self.__peek: return None\nreturn self.__peek.val\ndef to_list(self) -> List[int]:\n\"\"\" \u8f6c\u5316\u4e3a\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\narr: List[int] = []\nnode = self.__peek\nwhile node:\narr.append(node.val)\nnode = node.next\narr.reverse()\nreturn arr\n
linkedlist_stack.go
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\ntype linkedListStack struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list \u6765\u5b9e\u73b0\u6808\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u6808 */\nfunc newLinkedListStack() *linkedListStack {\nreturn &linkedListStack{\ndata: list.New(),\n}\n}\n/* \u5165\u6808 */\nfunc (s *linkedListStack) push(value int) {\ns.data.PushBack(value)\n}\n/* \u51fa\u6808 */\nfunc (s *linkedListStack) pop() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc (s *linkedListStack) peek() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\nreturn e.Value\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc (s *linkedListStack) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListStack) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListStack) toList() *list.List {\nreturn s.data\n}\n
linkedlist_stack.js
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\n#stackPeek;     // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\n#stkSize = 0;   // \u6808\u7684\u957f\u5ea6\nconstructor() {\nthis.#stackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.size == 0;\n}\n/* \u5165\u6808 */\npush(num) {\nconst node = new ListNode(num);\nnode.next = this.#stackPeek;\nthis.#stackPeek = node;\nthis.#stkSize++;\n}\n/* \u51fa\u6808 */\npop() {\nconst num = this.peek();\nthis.#stackPeek = this.#stackPeek.next;\nthis.#stkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek() {\nif (!this.#stackPeek)\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stackPeek.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray() {\nlet node = this.#stackPeek;\nconst res = new Array(this.size);\nfor (let i = res.length - 1; i >= 0; i--) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.ts
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate stackPeek: ListNode | null; // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate stkSize: number = 0; // \u6808\u7684\u957f\u5ea6\nconstructor() {\nthis.stackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.size == 0;\n}\n/* \u5165\u6808 */\npush(num: number): void {\nconst node = new ListNode(num);\nnode.next = this.stackPeek;\nthis.stackPeek = node;\nthis.stkSize++;\n}\n/* \u51fa\u6808 */\npop(): number {\nconst num = this.peek();\nif (!this.stackPeek) throw new Error('\u6808\u4e3a\u7a7a');\nthis.stackPeek = this.stackPeek.next;\nthis.stkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek(): number {\nif (!this.stackPeek) throw new Error('\u6808\u4e3a\u7a7a');\nreturn this.stackPeek.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray(): number[] {\nlet node = this.stackPeek;\nconst res = new Array<number>(this.size);\nfor (let i = res.length - 1; i >= 0; i--) {\nres[i] = node!.val;\nnode = node!.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.c
[class]{linkedListStack}-[func]{}\n
linkedlist_stack.cs
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack\n{\nprivate ListNode? stackPeek;  // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate int stkSize = 0;   // \u6808\u7684\u957f\u5ea6\npublic LinkedListStack()\n{\nstackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num)\n{\nListNode node = new ListNode(num);\nnode.next = stackPeek;\nstackPeek = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\npublic int pop()\n{\nif (stackPeek == null)\nthrow new Exception();\nint num = peek();\nstackPeek = stackPeek.next;\nstkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek()\n{\nif (size() == 0 || stackPeek == null)\nthrow new Exception();\nreturn stackPeek.val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nif (stackPeek == null)\nreturn Array.Empty<int>();\nListNode node = stackPeek;\nint[] res = new int[size()];\nfor (int i = res.Length - 1; i >= 0; i--)\n{\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.swift
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate var _peek: ListNode? // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate var _size = 0 // \u6808\u7684\u957f\u5ea6\ninit() {}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc size() -> Int {\n_size\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u6808 */\nfunc push(num: Int) {\nlet node = ListNode(x: num)\nnode.next = _peek\n_peek = node\n_size += 1\n}\n/* \u51fa\u6808 */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n_peek = _peek?.next\n_size -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn _peek!.val\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nvar node = _peek\nvar res = Array(repeating: 0, count: _size)\nfor i in sequence(first: res.count - 1, next: { $0 >= 0 + 1 ? $0 - 1 : nil }) {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_stack.zig
// \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808\nfn LinkedListStack(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nstackTop: ?*inc.ListNode(T) = null,             // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nstkSize: usize = 0,                             // \u6808\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6808\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.stackTop = null;\nself.stkSize = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u6808\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.stkSize;\n}\n// \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u6808\u9876\u5143\u7d20\npub fn top(self: *Self) T {\nif (self.size() == 0) @panic(\"\u6808\u4e3a\u7a7a\");\nreturn self.stackTop.?.val;\n}  // \u5165\u6808\npub fn push(self: *Self, num: T) !void {\nvar node = try self.mem_allocator.create(inc.ListNode(T));\nnode.init(num);\nnode.next = self.stackTop;\nself.stackTop = node;\nself.stkSize += 1;\n} // \u51fa\u6808\npub fn pop(self: *Self) T {\nvar num = self.top();\nself.stackTop = self.stackTop.?.next;\nself.stkSize -= 1;\nreturn num;\n} // \u5c06\u6808\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\nvar node = self.stackTop;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[res.len - i - 1] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/stack/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u5b9e\u73b0\u6808\u65f6\uff0c\u8003\u8651\u5c06\u6570\u7ec4\u7684\u5c3e\u90e8\u5f53\u4f5c\u6808\u9876\u3002\u8fd9\u6837\u8bbe\u8ba1\u4e0b\uff0c\u300c\u5165\u6808\u300d\u4e0e\u300c\u51fa\u6808\u300d\u64cd\u4f5c\u5c31\u5bf9\u5e94\u5728\u6570\u7ec4\u5c3e\u90e8\u300c\u6dfb\u52a0\u5143\u7d20\u300d\u4e0e\u300c\u5220\u9664\u5143\u7d20\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(1)\\) \u3002

ArrayStackpush()pop()

\u7531\u4e8e\u5165\u6808\u7684\u5143\u7d20\u53ef\u80fd\u662f\u6e90\u6e90\u4e0d\u65ad\u7684\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528\u652f\u6301\u52a8\u6001\u6269\u5bb9\u7684\u300c\u5217\u8868\u300d\uff0c\u8fd9\u6837\u5c31\u65e0\u9700\u81ea\u884c\u5b9e\u73b0\u6570\u7ec4\u6269\u5bb9\u4e86\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_stack.java
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate ArrayList<Integer> stack;\npublic ArrayStack() {\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = new ArrayList<>();\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size() {\nreturn stack.size();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num) {\nstack.add(num);\n}\n/* \u51fa\u6808 */\npublic int pop() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn stack.remove(size() - 1);\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn stack.get(size() - 1);\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic Object[] toArray() {\nreturn stack.toArray();\n}\n}\n
array_stack.cpp
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate:\nvector<int> stack;\npublic:\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size() {\nreturn stack.size();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn stack.empty();\n}\n/* \u5165\u6808 */\nvoid push(int num) {\nstack.push_back(num);\n}\n/* \u51fa\u6808 */\nvoid pop() {\nint oldTop = top();\nstack.pop_back();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top() {\nif(empty())\nthrow out_of_range(\"\u6808\u4e3a\u7a7a\");\nreturn stack.back();\n}\n/* \u8fd4\u56de Vector */\nvector<int> toVector() {\nreturn stack;\n}\n};\n
array_stack.py
class ArrayStack:\n\"\"\" \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 \"\"\"\ndef __init__(self) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__stack: List[int] = []\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nreturn len(self.__stack)\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__stack == []\ndef push(self, item: int) -> None:\n\"\"\" \u5165\u6808 \"\"\"\nself.__stack.append(item)\ndef pop(self) -> int:\n\"\"\" \u51fa\u6808 \"\"\"\nassert not self.is_empty(), \"\u6808\u4e3a\u7a7a\"\nreturn self.__stack.pop()\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u6808\u4e3a\u7a7a\"\nreturn self.__stack[-1]\ndef to_list(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nreturn self.__stack\n
array_stack.go
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\ntype arrayStack struct {\ndata []int // \u6570\u636e\n}\n/* \u521d\u59cb\u5316\u6808 */\nfunc newArrayStack() *arrayStack {\nreturn &arrayStack{\n// \u8bbe\u7f6e\u6808\u7684\u957f\u5ea6\u4e3a 0\uff0c\u5bb9\u91cf\u4e3a 16\ndata: make([]int, 0, 16),\n}\n}\n/* \u6808\u7684\u957f\u5ea6 */\nfunc (s *arrayStack) size() int {\nreturn len(s.data)\n}\n/* \u6808\u662f\u5426\u4e3a\u7a7a */\nfunc (s *arrayStack) isEmpty() bool {\nreturn s.size() == 0\n}\n/* \u5165\u6808 */\nfunc (s *arrayStack) push(v int) {\n// \u5207\u7247\u4f1a\u81ea\u52a8\u6269\u5bb9\ns.data = append(s.data, v)\n}\n/* \u51fa\u6808 */\nfunc (s *arrayStack) pop() any {\nval := s.peek()\ns.data = s.data[:len(s.data)-1]\nreturn val\n}\n/* \u83b7\u53d6\u6808\u9876\u5143\u7d20 */\nfunc (s *arrayStack) peek() any {\nif s.isEmpty() {\nreturn nil\n}\nval := s.data[len(s.data)-1]\nreturn val\n}\n/* \u83b7\u53d6 Slice \u7528\u4e8e\u6253\u5370 */\nfunc (s *arrayStack) toSlice() []int {\nreturn s.data\n}\n
array_stack.js
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\n#stack;\nconstructor() {\nthis.#stack = [];\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#stack.length;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nempty() {\nreturn this.#stack.length === 0;\n}\n/* \u5165\u6808 */\npush(num) {\nthis.#stack.push(num);\n}\n/* \u51fa\u6808 */\npop() {\nif (this.empty())\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stack.pop();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\ntop() {\nif (this.empty())\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stack[this.#stack.length - 1];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\nreturn this.#stack;\n}\n};\n
array_stack.ts
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate stack: number[];\nconstructor() {\nthis.stack = [];\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.stack.length;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nempty(): boolean {\nreturn this.stack.length === 0;\n}\n/* \u5165\u6808 */\npush(num: number): void {\nthis.stack.push(num);\n}\n/* \u51fa\u6808 */\npop(): number | undefined {\nif (this.empty())\nthrow new Error('\u6808\u4e3a\u7a7a');\nreturn this.stack.pop();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\ntop(): number | undefined {\nif (this.empty())\nthrow new Error('\u6808\u4e3a\u7a7a');\nreturn this.stack[this.stack.length - 1];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\nreturn this.stack;\n}\n};\n
array_stack.c
[class]{arrayStack}-[func]{}\n
array_stack.cs
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack\n{\nprivate List<int> stack;\npublic ArrayStack()\n{\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = new();\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn stack.Count();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num)\n{\nstack.Add(num);\n}\n/* \u51fa\u6808 */\npublic int pop()\n{\nif (isEmpty())\nthrow new Exception();\nvar val = peek();\nstack.RemoveAt(size() - 1);\nreturn val;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek()\n{\nif (isEmpty())\nthrow new Exception();\nreturn stack[size() - 1];\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nreturn stack.ToArray();\n}\n}\n
array_stack.swift
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate var stack: [Int]\ninit() {\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = []\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nstack.count\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nstack.isEmpty\n}\n/* \u5165\u6808 */\nfunc push(num: Int) {\nstack.append(num)\n}\n/* \u51fa\u6808 */\n@discardableResult\nfunc pop() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn stack.removeLast()\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn stack.last!\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nstack\n}\n}\n
array_stack.zig
// \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808\nfn ArrayStack(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nstack: ?std.ArrayList(T) = null,     // \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6808\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) void {\nif (self.stack == null) {\nself.stack = std.ArrayList(T).init(allocator);\n}\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.stack == null) return;\nself.stack.?.deinit();\n}\n// \u83b7\u53d6\u6808\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.stack.?.items.len;\n}\n// \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u6808\u9876\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u6808\u4e3a\u7a7a\");\nreturn self.stack.?.items[self.size() - 1];\n}  // \u5165\u6808\npub fn push(self: *Self, num: T) !void {\ntry self.stack.?.append(num);\n} // \u51fa\u6808\npub fn pop(self: *Self) T {\nvar num = self.stack.?.pop();\nreturn num;\n} // \u8fd4\u56de ArrayList\npub fn toList(self: *Self) std.ArrayList(T) {\nreturn self.stack.?;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/stack/#513","title":"5.1.3. \u00a0 \u4e24\u79cd\u5b9e\u73b0\u5bf9\u6bd4","text":""},{"location":"chapter_stack_and_queue/stack/#_3","title":"\u652f\u6301\u64cd\u4f5c","text":"

\u4e24\u79cd\u5b9e\u73b0\u90fd\u652f\u6301\u6808\u5b9a\u4e49\u4e2d\u7684\u5404\u9879\u64cd\u4f5c\uff0c\u6570\u7ec4\u5b9e\u73b0\u989d\u5916\u652f\u6301\u968f\u673a\u8bbf\u95ee\uff0c\u4f46\u8fd9\u5df2\u7ecf\u8d85\u51fa\u6808\u7684\u5b9a\u4e49\u8303\u7574\uff0c\u4e00\u822c\u4e0d\u4f1a\u7528\u5230\u3002

"},{"location":"chapter_stack_and_queue/stack/#_4","title":"\u65f6\u95f4\u6548\u7387","text":"

\u5728\u6570\u7ec4\uff08\u5217\u8868\uff09\u5b9e\u73b0\u4e2d\uff0c\u5165\u6808\u4e0e\u51fa\u6808\u64cd\u4f5c\u90fd\u662f\u5728\u9884\u5148\u5206\u914d\u597d\u7684\u8fde\u7eed\u5185\u5b58\u4e2d\u64cd\u4f5c\uff0c\u5177\u6709\u5f88\u597d\u7684\u7f13\u5b58\u672c\u5730\u6027\uff0c\u6548\u7387\u5f88\u597d\u3002\u7136\u800c\uff0c\u5982\u679c\u5165\u6808\u65f6\u8d85\u51fa\u6570\u7ec4\u5bb9\u91cf\uff0c\u5219\u4f1a\u89e6\u53d1\u6269\u5bb9\u673a\u5236\uff0c\u90a3\u4e48\u8be5\u6b21\u5165\u6808\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \u3002

\u5728\u94fe\u8868\u5b9e\u73b0\u4e2d\uff0c\u94fe\u8868\u7684\u6269\u5bb9\u975e\u5e38\u7075\u6d3b\uff0c\u4e0d\u5b58\u5728\u4e0a\u8ff0\u6570\u7ec4\u6269\u5bb9\u65f6\u53d8\u6162\u7684\u95ee\u9898\u3002\u7136\u800c\uff0c\u5165\u6808\u64cd\u4f5c\u9700\u8981\u521d\u59cb\u5316\u7ed3\u70b9\u5bf9\u8c61\u5e76\u4fee\u6539\u6307\u9488\uff0c\u56e0\u800c\u6548\u7387\u4e0d\u5982\u6570\u7ec4\u3002\u8fdb\u4e00\u6b65\u5730\u601d\u8003\uff0c\u5982\u679c\u5165\u6808\u5143\u7d20\u4e0d\u662f int \u800c\u662f\u7ed3\u70b9\u5bf9\u8c61\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u7701\u53bb\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u4ece\u800c\u63d0\u5347\u6548\u7387\u3002

\u7efc\u4e0a\u6240\u8ff0\uff0c\u5f53\u5165\u6808\u4e0e\u51fa\u6808\u64cd\u4f5c\u7684\u5143\u7d20\u662f\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff08\u4f8b\u5982 int , double \uff09\u65f6\uff0c\u5219\u7ed3\u8bba\u5982\u4e0b\uff1a

  • \u6570\u7ec4\u5b9e\u73b0\u7684\u6808\u5728\u89e6\u53d1\u6269\u5bb9\u65f6\u4f1a\u53d8\u6162\uff0c\u4f46\u7531\u4e8e\u6269\u5bb9\u662f\u4f4e\u9891\u64cd\u4f5c\uff0c\u56e0\u6b64 \u603b\u4f53\u6548\u7387\u66f4\u9ad8\uff1b
  • \u94fe\u8868\u5b9e\u73b0\u7684\u6808\u53ef\u4ee5\u63d0\u4f9b \u66f4\u52a0\u7a33\u5b9a\u7684\u6548\u7387\u8868\u73b0\uff1b
"},{"location":"chapter_stack_and_queue/stack/#_5","title":"\u7a7a\u95f4\u6548\u7387","text":"

\u5728\u521d\u59cb\u5316\u5217\u8868\u65f6\uff0c\u7cfb\u7edf\u4f1a\u7ed9\u5217\u8868\u5206\u914d\u201c\u521d\u59cb\u5bb9\u91cf\u201d\uff0c\u8be5\u5bb9\u91cf\u53ef\u80fd\u8d85\u8fc7\u6211\u4eec\u7684\u9700\u6c42\u3002\u5e76\u4e14\u6269\u5bb9\u673a\u5236\u4e00\u822c\u662f\u6309\u7167\u7279\u5b9a\u500d\u7387\uff08\u6bd4\u5982 2 \u500d\uff09\u8fdb\u884c\u6269\u5bb9\uff0c\u6269\u5bb9\u540e\u7684\u5bb9\u91cf\u4e5f\u53ef\u80fd\u8d85\u51fa\u6211\u4eec\u7684\u9700\u6c42\u3002\u56e0\u6b64\uff0c\u6570\u7ec4\u5b9e\u73b0\u6808\u4f1a\u9020\u6210\u4e00\u5b9a\u7684\u7a7a\u95f4\u6d6a\u8d39\u3002

\u5f53\u7136\uff0c\u7531\u4e8e\u7ed3\u70b9\u9700\u8981\u989d\u5916\u5b58\u50a8\u6307\u9488\uff0c\u56e0\u6b64 \u94fe\u8868\u7ed3\u70b9\u6bd4\u6570\u7ec4\u5143\u7d20\u5360\u7528\u66f4\u5927\u3002

\u7efc\u4e0a\uff0c\u6211\u4eec\u4e0d\u80fd\u7b80\u5355\u5730\u786e\u5b9a\u54ea\u79cd\u5b9e\u73b0\u66f4\u52a0\u7701\u5185\u5b58\uff0c\u9700\u8981 case-by-case \u5730\u5206\u6790\u3002

"},{"location":"chapter_stack_and_queue/stack/#514","title":"5.1.4. \u00a0 \u6808\u5178\u578b\u5e94\u7528","text":"
  • \u6d4f\u89c8\u5668\u4e2d\u7684\u540e\u9000\u4e0e\u524d\u8fdb\u3001\u8f6f\u4ef6\u4e2d\u7684\u64a4\u9500\u4e0e\u53cd\u64a4\u9500\u3002\u6bcf\u5f53\u6211\u4eec\u6253\u5f00\u65b0\u7684\u7f51\u9875\uff0c\u6d4f\u89c8\u5668\u5c31\u5c06\u4e0a\u4e00\u4e2a\u7f51\u9875\u6267\u884c\u5165\u6808\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7\u300c\u540e\u9000\u300d\u64cd\u4f5c\u6765\u56de\u5230\u4e0a\u4e00\u9875\u9762\uff0c\u540e\u9000\u64cd\u4f5c\u5b9e\u9645\u4e0a\u662f\u5728\u6267\u884c\u51fa\u6808\u3002\u5982\u679c\u8981\u540c\u65f6\u652f\u6301\u540e\u9000\u548c\u524d\u8fdb\uff0c\u90a3\u4e48\u5219\u9700\u8981\u4e24\u4e2a\u6808\u6765\u914d\u5408\u5b9e\u73b0\u3002
  • \u7a0b\u5e8f\u5185\u5b58\u7ba1\u7406\u3002\u6bcf\u5f53\u8c03\u7528\u51fd\u6570\u65f6\uff0c\u7cfb\u7edf\u5c31\u4f1a\u5728\u6808\u9876\u6dfb\u52a0\u4e00\u4e2a\u6808\u5e27\uff0c\u7528\u6765\u8bb0\u5f55\u51fd\u6570\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002\u5728\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u5411\u4e0b\u9012\u63a8\u4f1a\u4e0d\u65ad\u6267\u884c\u5165\u6808\uff0c\u5411\u4e0a\u56de\u6eaf\u9636\u6bb5\u65f6\u51fa\u6808\u3002
"},{"location":"chapter_stack_and_queue/summary/","title":"5.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u6808\u662f\u4e00\u79cd\u9075\u5faa\u5148\u5165\u540e\u51fa\u7684\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6216\u94fe\u8868\u5b9e\u73b0\u3002
  • \u5728\u65f6\u95f4\u6548\u7387\u65b9\u9762\uff0c\u6808\u7684\u6570\u7ec4\u5b9e\u73b0\u5177\u6709\u66f4\u597d\u7684\u5e73\u5747\u6548\u7387\uff0c\u4f46\u6269\u5bb9\u65f6\u4f1a\u5bfc\u81f4\u5355\u6b21\u5165\u6808\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \u3002\u76f8\u5bf9\u5730\uff0c\u6808\u7684\u94fe\u8868\u5b9e\u73b0\u5177\u6709\u66f4\u52a0\u7a33\u5b9a\u7684\u6548\u7387\u8868\u73b0\u3002
  • \u5728\u7a7a\u95f4\u6548\u7387\u65b9\u9762\uff0c\u6808\u7684\u6570\u7ec4\u5b9e\u73b0\u4f1a\u9020\u6210\u4e00\u5b9a\u7a7a\u95f4\u6d6a\u8d39\uff0c\u7136\u800c\u94fe\u8868\u7ed3\u70b9\u6bd4\u6570\u7ec4\u5143\u7d20\u5360\u7528\u5185\u5b58\u66f4\u5927\u3002
  • \u961f\u5217\u662f\u4e00\u79cd\u9075\u5faa\u5148\u5165\u5148\u51fa\u7684\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6216\u94fe\u8868\u5b9e\u73b0\u3002\u5bf9\u4e8e\u4e24\u79cd\u5b9e\u73b0\u7684\u65f6\u95f4\u6548\u7387\u4e0e\u7a7a\u95f4\u6548\u7387\u5bf9\u6bd4\uff0c\u4e0e\u4e0a\u8ff0\u6808\u7684\u7ed3\u8bba\u76f8\u540c\u3002
  • \u53cc\u5411\u961f\u5217\u7684\u4e24\u7aef\u90fd\u53ef\u4ee5\u6dfb\u52a0\u4e0e\u5220\u9664\u5143\u7d20\u3002
"},{"location":"chapter_tree/avl_tree/","title":"7.4. \u00a0 AVL \u6811 *","text":"

\u5728\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u7ae0\u8282\u4e2d\u63d0\u5230\uff0c\u5728\u8fdb\u884c\u591a\u6b21\u63d2\u5165\u4e0e\u5220\u9664\u64cd\u4f5c\u540e\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u53ef\u80fd\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\u3002\u6b64\u65f6\u6240\u6709\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4f1a\u7531 \\(O(\\log n)\\) \u52a3\u5316\u81f3 \\(O(n)\\) \u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u6267\u884c\u4e24\u6b65\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u8be5\u4e8c\u53c9\u641c\u7d22\u6811\u5c31\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\u3002

Fig. AVL \u6811\u5728\u5220\u9664\u7ed3\u70b9\u540e\u53d1\u751f\u9000\u5316

\u518d\u6bd4\u5982\uff0c\u5728\u4ee5\u4e0b\u5b8c\u7f8e\u4e8c\u53c9\u6811\u4e2d\u63d2\u5165\u4e24\u4e2a\u7ed3\u70b9\u540e\uff0c\u6811\u4e25\u91cd\u5411\u5de6\u504f\u659c\uff0c\u67e5\u627e\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u968f\u4e4b\u53d1\u751f\u52a3\u5316\u3002

Fig. AVL \u6811\u5728\u63d2\u5165\u7ed3\u70b9\u540e\u53d1\u751f\u9000\u5316

G. M. Adelson-Velsky \u548c E. M. Landis \u5728\u5176 1962 \u5e74\u53d1\u8868\u7684\u8bba\u6587 \"An algorithm for the organization of information\" \u4e2d\u63d0\u51fa\u4e86\u300cAVL \u6811\u300d\u3002\u8bba\u6587\u4e2d\u63cf\u8ff0\u4e86\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u4f7f\u5f97\u5728\u4e0d\u65ad\u6dfb\u52a0\u4e0e\u5220\u9664\u7ed3\u70b9\u540e\uff0cAVL \u6811\u4ecd\u7136\u4e0d\u4f1a\u53d1\u751f\u9000\u5316\uff0c\u8fdb\u800c\u4f7f\u5f97\u5404\u79cd\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u80fd\u4fdd\u6301\u5728 \\(O(\\log n)\\) \u7ea7\u522b\u3002

\u6362\u8a00\u4e4b\uff0c\u5728\u9891\u7e41\u589e\u5220\u67e5\u6539\u7684\u4f7f\u7528\u573a\u666f\u4e2d\uff0cAVL \u6811\u53ef\u59cb\u7ec8\u4fdd\u6301\u5f88\u9ad8\u7684\u6570\u636e\u589e\u5220\u67e5\u6539\u6548\u7387\uff0c\u5177\u6709\u5f88\u597d\u7684\u5e94\u7528\u4ef7\u503c\u3002

"},{"location":"chapter_tree/avl_tree/#741-avl","title":"7.4.1. \u00a0 AVL \u6811\u5e38\u89c1\u672f\u8bed","text":"

\u300cAVL \u6811\u300d\u65e2\u662f\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u53c8\u662f\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\uff0c\u540c\u65f6\u6ee1\u8db3\u8fd9\u4e24\u79cd\u4e8c\u53c9\u6811\u7684\u6240\u6709\u6027\u8d28\uff0c\u56e0\u6b64\u53c8\u88ab\u79f0\u4e3a\u300c\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u3002

"},{"location":"chapter_tree/avl_tree/#_1","title":"\u7ed3\u70b9\u9ad8\u5ea6","text":"

\u5728 AVL \u6811\u7684\u64cd\u4f5c\u4e2d\uff0c\u9700\u8981\u83b7\u53d6\u7ed3\u70b9\u300c\u9ad8\u5ea6 Height\u300d\uff0c\u6240\u4ee5\u7ed9 AVL \u6811\u7684\u7ed3\u70b9\u7c7b\u6dfb\u52a0 height \u53d8\u91cf\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\npublic int val;        // \u7ed3\u70b9\u503c\npublic int height;     // \u7ed3\u70b9\u9ad8\u5ea6\npublic TreeNode left;  // \u5de6\u5b50\u7ed3\u70b9\npublic TreeNode right; // \u53f3\u5b50\u7ed3\u70b9\npublic TreeNode(int x) { val = x; }\n}\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nstruct TreeNode {\nint val{};          // \u7ed3\u70b9\u503c\nint height = 0;     // \u7ed3\u70b9\u9ad8\u5ea6\nTreeNode *left{};   // \u5de6\u5b50\u7ed3\u70b9\nTreeNode *right{};  // \u53f3\u5b50\u7ed3\u70b9\nTreeNode() = default;\nexplicit TreeNode(int x) : val(x){}\n};\n
\"\"\" AVL \u6811\u7ed3\u70b9\u7c7b \"\"\"\nclass TreeNode:\ndef __init__(self, val: int):\nself.val: int = val                    # \u7ed3\u70b9\u503c\nself.height: int = 0                   # \u7ed3\u70b9\u9ad8\u5ea6\nself.left: Optional[TreeNode] = None   # \u5de6\u5b50\u7ed3\u70b9\u5f15\u7528\nself.right: Optional[TreeNode] = None  # \u53f3\u5b50\u7ed3\u70b9\u5f15\u7528\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\ntype TreeNode struct {\nVal    int       // \u7ed3\u70b9\u503c\nHeight int       // \u7ed3\u70b9\u9ad8\u5ea6\nLeft   *TreeNode // \u5de6\u5b50\u7ed3\u70b9\u5f15\u7528\nRight  *TreeNode // \u53f3\u5b50\u7ed3\u70b9\u5f15\u7528\n}\n
class TreeNode {\nval; // \u7ed3\u70b9\u503c\nheight; //\u7ed3\u70b9\u9ad8\u5ea6\nleft; // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nright; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nconstructor(val, left, right, height) {\nthis.val = val === undefined ? 0 : val;\nthis.height = height === undefined ? 0 : height;\nthis.left = left === undefined ? null : left;\nthis.right = right === undefined ? null : right;\n}\n}\n
class TreeNode {\nval: number;            // \u7ed3\u70b9\u503c\nheight: number;         // \u7ed3\u70b9\u9ad8\u5ea6\nleft: TreeNode | null;  // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nright: TreeNode | null; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nconstructor(val?: number, height?: number, left?: TreeNode | null, right?: TreeNode | null) {\nthis.val = val === undefined ? 0 : val;\nthis.height = height === undefined ? 0 : height; this.left = left === undefined ? null : left; this.right = right === undefined ? null : right; }\n}\n
\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\npublic int val;          // \u7ed3\u70b9\u503c\npublic int height;       // \u7ed3\u70b9\u9ad8\u5ea6\npublic TreeNode? left;   // \u5de6\u5b50\u7ed3\u70b9\npublic TreeNode? right;  // \u53f3\u5b50\u7ed3\u70b9\npublic TreeNode(int x) { val = x; }\n}\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar height: Int // \u7ed3\u70b9\u9ad8\u5ea6\nvar left: TreeNode? // \u5de6\u5b50\u7ed3\u70b9\nvar right: TreeNode? // \u53f3\u5b50\u7ed3\u70b9\ninit(x: Int) {\nval = x\nheight = 0\n}\n}\n
\n

\u300c\u7ed3\u70b9\u9ad8\u5ea6\u300d\u662f\u6700\u8fdc\u53f6\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u7684\u8ddd\u79bb\uff0c\u5373\u8d70\u8fc7\u7684\u300c\u8fb9\u300d\u7684\u6570\u91cf\u3002\u9700\u8981\u7279\u522b\u6ce8\u610f\uff0c\u53f6\u7ed3\u70b9\u7684\u9ad8\u5ea6\u4e3a 0 \uff0c\u7a7a\u7ed3\u70b9\u7684\u9ad8\u5ea6\u4e3a -1\u3002\u6211\u4eec\u5c01\u88c5\u4e24\u4e2a\u5de5\u5177\u51fd\u6570\uff0c\u5206\u522b\u7528\u4e8e\u83b7\u53d6\u4e0e\u66f4\u65b0\u7ed3\u70b9\u7684\u9ad8\u5ea6\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(height(node.left), height(node.right)) + 1;\n}\n
avl_tree.cpp
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode* node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == nullptr ? -1 : node->height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode* node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode->height = max(height(node->left), height(node->right)) + 1;\n}\n
avl_tree.py
def height(self, node: Optional[TreeNode]) -> int:\n\"\"\" \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 \"\"\"\n# \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nif node is not None:\nreturn node.height\nreturn -1\ndef __update_height(self, node: Optional[TreeNode]):\n\"\"\" \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 \"\"\"\n# \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = max([self.height(node.left), self.height(node.right)]) + 1\n
avl_tree.go
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc (t *aVLTree) height(node *TreeNode) int {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nif node != nil {\nreturn node.Height\n}\nreturn -1\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc (t *aVLTree) updateHeight(node *TreeNode) {\nlh := t.height(node.Left)\nrh := t.height(node.Right)\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nif lh > rh {\nnode.Height = lh + 1\n} else {\nnode.Height = rh + 1\n}\n}\n
avl_tree.js
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nheight(node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node === null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\n#updateHeight(node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(this.height(node.left), this.height(node.right)) + 1;\n}\n
avl_tree.ts
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nheight(node: TreeNode): number {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node === null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nupdateHeight(node: TreeNode): void {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(this.height(node.left), this.height(node.right)) + 1;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{height}\n[class]{aVLTree}-[func]{updateHeight}\n
avl_tree.cs
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode? node)\n{\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode node)\n{\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.Max(height(node.left), height(node.right)) + 1;\n}\n
avl_tree.swift
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc height(node: TreeNode?) -> Int {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nnode == nil ? -1 : node!.height\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc updateHeight(node: TreeNode?) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode?.height = max(height(node: node?.left), height(node: node?.right)) + 1\n}\n
avl_tree.zig
// \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6\nfn height(self: *Self, node: ?*inc.TreeNode(T)) i32 {\n_ = self;\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn if (node == null) -1 else node.?.height;\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nfn updateHeight(self: *Self, node: ?*inc.TreeNode(T)) void {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.?.height = std.math.max(self.height(node.?.left), self.height(node.?.right)) + 1;\n}\n
"},{"location":"chapter_tree/avl_tree/#_2","title":"\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50","text":"

\u7ed3\u70b9\u7684\u300c\u5e73\u8861\u56e0\u5b50 Balance Factor\u300d\u662f \u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u51cf\u53bb\u53f3\u5b50\u6811\u9ad8\u5ea6\uff0c\u5e76\u5b9a\u4e49\u7a7a\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u4e3a 0 \u3002\u540c\u6837\u5730\uff0c\u6211\u4eec\u5c06\u83b7\u53d6\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u5c01\u88c5\u6210\u51fd\u6570\uff0c\u4ee5\u4fbf\u540e\u7eed\u4f7f\u7528\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node.left) - height(node.right);\n}\n
avl_tree.cpp
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode* node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == nullptr) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node->left) - height(node->right);\n}\n
avl_tree.py
def balance_factor(self, node: Optional[TreeNode]) -> int:\n\"\"\" \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 \"\"\"\n# \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif node is None:\nreturn 0\n# \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn self.height(node.left) - self.height(node.right)\n
avl_tree.go
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nfunc (t *aVLTree) balanceFactor(node *TreeNode) int {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif node == nil {\nreturn 0\n}\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn t.height(node.Left) - t.height(node.Right)\n}\n
avl_tree.js
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nbalanceFactor(node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node === null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn this.height(node.left) - this.height(node.right);\n}\n
avl_tree.ts
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nbalanceFactor(node: TreeNode): number {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node === null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn this.height(node.left) - this.height(node.right);\n}\n
avl_tree.c
[class]{aVLTree}-[func]{balanceFactor}\n
avl_tree.cs
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode? node)\n{\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node.left) - height(node.right);\n}\n
avl_tree.swift
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nfunc balanceFactor(node: TreeNode?) -> Int {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nguard let node = node else { return 0 }\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node: node.left) - height(node: node.right)\n}\n
avl_tree.zig
// \u83b7\u53d6\u5e73\u8861\u56e0\u5b50\nfn balanceFactor(self: *Self, node: ?*inc.TreeNode(T)) i32 {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn self.height(node.?.left) - self.height(node.?.right);\n}\n

Note

\u8bbe\u5e73\u8861\u56e0\u5b50\u4e3a \\(f\\) \uff0c\u5219\u4e00\u68f5 AVL \u6811\u7684\u4efb\u610f\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u7686\u6ee1\u8db3 \\(-1 \\le f \\le 1\\) \u3002

"},{"location":"chapter_tree/avl_tree/#742-avl","title":"7.4.2. \u00a0 AVL \u6811\u65cb\u8f6c","text":"

AVL \u6811\u7684\u72ec\u7279\u4e4b\u5904\u5728\u4e8e\u300c\u65cb\u8f6c Rotation\u300d\u7684\u64cd\u4f5c\uff0c\u5176\u53ef \u5728\u4e0d\u5f71\u54cd\u4e8c\u53c9\u6811\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u524d\u63d0\u4e0b\uff0c\u4f7f\u5931\u8861\u7ed3\u70b9\u91cd\u65b0\u6062\u590d\u5e73\u8861\u3002\u6362\u8a00\u4e4b\uff0c\u65cb\u8f6c\u64cd\u4f5c\u65e2\u53ef\u4ee5\u4f7f\u6811\u4fdd\u6301\u4e3a\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u6811\u91cd\u65b0\u6062\u590d\u4e3a\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\u3002

\u6211\u4eec\u5c06\u5e73\u8861\u56e0\u5b50\u7684\u7edd\u5bf9\u503c \\(> 1\\) \u7684\u7ed3\u70b9\u79f0\u4e3a\u300c\u5931\u8861\u7ed3\u70b9\u300d\u3002\u6839\u636e\u7ed3\u70b9\u7684\u5931\u8861\u60c5\u51b5\uff0c\u65cb\u8f6c\u64cd\u4f5c\u5206\u4e3a \u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u3001\u5148\u5de6\u65cb\u540e\u53f3\u65cb\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u4e00\u8d77\u6765\u770b\u770b\u5b83\u4eec\u662f\u5982\u4f55\u64cd\u4f5c\u7684\u3002

"},{"location":"chapter_tree/avl_tree/#case-1-","title":"Case 1 - \u53f3\u65cb","text":"

\u5982\u4e0b\u56fe\u6240\u793a\uff08\u7ed3\u70b9\u4e0b\u65b9\u4e3a\u300c\u5e73\u8861\u56e0\u5b50\u300d\uff09\uff0c\u4ece\u5e95\u81f3\u9876\u770b\uff0c\u4e8c\u53c9\u6811\u4e2d\u9996\u4e2a\u5931\u8861\u7ed3\u70b9\u662f \u7ed3\u70b9 3\u3002\u6211\u4eec\u805a\u7126\u5728\u4ee5\u8be5\u5931\u8861\u7ed3\u70b9\u4e3a\u6839\u7ed3\u70b9\u7684\u5b50\u6811\u4e0a\uff0c\u5c06\u8be5\u7ed3\u70b9\u8bb0\u4e3a node \uff0c\u5c06\u5176\u5de6\u5b50\u7ed3\u70b9\u8bb0\u4e3a child \uff0c\u6267\u884c\u300c\u53f3\u65cb\u300d\u64cd\u4f5c\u3002\u5b8c\u6210\u53f3\u65cb\u540e\uff0c\u8be5\u5b50\u6811\u5df2\u7ecf\u6062\u590d\u5e73\u8861\uff0c\u5e76\u4e14\u4ecd\u7136\u4e3a\u4e8c\u53c9\u641c\u7d22\u6811\u3002

<1><2><3><4>

\u8fdb\u800c\uff0c\u5982\u679c\u7ed3\u70b9 child \u672c\u8eab\u6709\u53f3\u5b50\u7ed3\u70b9\uff08\u8bb0\u4e3a grandChild \uff09\uff0c\u5219\u9700\u8981\u5728\u300c\u53f3\u65cb\u300d\u4e2d\u6dfb\u52a0\u4e00\u6b65\uff1a\u5c06 grandChild \u4f5c\u4e3a node \u7684\u5de6\u5b50\u7ed3\u70b9\u3002

Fig. \u6709 grandChild \u7684\u53f3\u65cb\u64cd\u4f5c

\u201c\u5411\u53f3\u65cb\u8f6c\u201d\u662f\u4e00\u79cd\u5f62\u8c61\u5316\u7684\u8bf4\u6cd5\uff0c\u5b9e\u9645\u9700\u8981\u901a\u8fc7\u4fee\u6539\u7ed3\u70b9\u6307\u9488\u5b9e\u73b0\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode rightRotate(TreeNode node) {\nTreeNode child = node.left;\nTreeNode grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.cpp
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode* rightRotate(TreeNode* node) {\nTreeNode* child = node->left;\nTreeNode* grandChild = child->right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild->right = node;\nnode->left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.py
def __right_rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u53f3\u65cb\u64cd\u4f5c \"\"\"\nchild = node.left\ngrand_child = child.right\n# \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node\nnode.left = grand_child\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\nself.__update_height(child)\n# \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n
avl_tree.go
/* \u53f3\u65cb\u64cd\u4f5c */\nfunc (t *aVLTree) rightRotate(node *TreeNode) *TreeNode {\nchild := node.Left\ngrandChild := child.Right\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.Right = node\nnode.Left = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\nt.updateHeight(child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.js
/* \u53f3\u65cb\u64cd\u4f5c */\n#rightRotate(node) {\nconst child = node.left;\nconst grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.#updateHeight(node);\nthis.#updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.ts
/* \u53f3\u65cb\u64cd\u4f5c */\nrightRotate(node: TreeNode): TreeNode {\nconst child = node.left;\nconst grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.updateHeight(node);\nthis.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{rightRotate}\n
avl_tree.cs
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode? rightRotate(TreeNode? node)\n{\nTreeNode? child = node.left;\nTreeNode? grandChild = child?.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.swift
/* \u53f3\u65cb\u64cd\u4f5c */\nfunc rightRotate(node: TreeNode?) -> TreeNode? {\nlet child = node?.left\nlet grandChild = child?.right\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild?.right = node\nnode?.left = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node: node)\nupdateHeight(node: child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.zig
// \u53f3\u65cb\u64cd\u4f5c\nfn rightRotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\nvar child = node.?.left;\nvar grandChild = child.?.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.?.right = node;\nnode.?.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.updateHeight(node);\nself.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
"},{"location":"chapter_tree/avl_tree/#case-2-","title":"Case 2 - \u5de6\u65cb","text":"

\u7c7b\u4f3c\u5730\uff0c\u5982\u679c\u5c06\u53d6\u4e0a\u8ff0\u5931\u8861\u4e8c\u53c9\u6811\u7684\u201c\u955c\u50cf\u201d\uff0c\u90a3\u4e48\u5219\u9700\u8981\u300c\u5de6\u65cb\u300d\u64cd\u4f5c\u3002

Fig. \u5de6\u65cb\u64cd\u4f5c

\u540c\u7406\uff0c\u82e5\u7ed3\u70b9 child \u672c\u8eab\u6709\u5de6\u5b50\u7ed3\u70b9\uff08\u8bb0\u4e3a grandChild \uff09\uff0c\u5219\u9700\u8981\u5728\u300c\u5de6\u65cb\u300d\u4e2d\u6dfb\u52a0\u4e00\u6b65\uff1a\u5c06 grandChild \u4f5c\u4e3a node \u7684\u53f3\u5b50\u7ed3\u70b9\u3002

Fig. \u6709 grandChild \u7684\u5de6\u65cb\u64cd\u4f5c

\u89c2\u5bdf\u53d1\u73b0\uff0c\u300c\u5de6\u65cb\u300d\u548c\u300c\u53f3\u65cb\u300d\u64cd\u4f5c\u662f\u955c\u50cf\u5bf9\u79f0\u7684\uff0c\u4e24\u8005\u5bf9\u5e94\u89e3\u51b3\u7684\u4e24\u79cd\u5931\u8861\u60c5\u51b5\u4e5f\u662f\u5bf9\u79f0\u7684\u3002\u6839\u636e\u5bf9\u79f0\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4ece\u300c\u53f3\u65cb\u300d\u63a8\u5bfc\u51fa\u300c\u5de6\u65cb\u300d\u3002\u5177\u4f53\u5730\uff0c\u53ea\u9700\u5c06\u300c\u53f3\u65cb\u300d\u4ee3\u7801\u4e2d\u7684\u628a\u6240\u6709\u7684 left \u66ff\u6362\u4e3a right \u3001\u6240\u6709\u7684 right \u66ff\u6362\u4e3a left \uff0c\u5373\u53ef\u5f97\u5230\u300c\u5de6\u65cb\u300d\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode leftRotate(TreeNode node) {\nTreeNode child = node.right;\nTreeNode grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.cpp
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode* leftRotate(TreeNode* node) {\nTreeNode* child = node->right;\nTreeNode* grandChild = child->left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild->left = node;\nnode->right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.py
def __left_rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u5de6\u65cb\u64cd\u4f5c \"\"\"\nchild = node.right\ngrand_child = child.left\n# \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node\nnode.right = grand_child\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\nself.__update_height(child)\n# \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n
avl_tree.go
/* \u5de6\u65cb\u64cd\u4f5c */\nfunc (t *aVLTree) leftRotate(node *TreeNode) *TreeNode {\nchild := node.Right\ngrandChild := child.Left\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.Left = node\nnode.Right = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\nt.updateHeight(child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.js
/* \u5de6\u65cb\u64cd\u4f5c */\n#leftRotate(node) {\nconst child = node.right;\nconst grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.#updateHeight(node);\nthis.#updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.ts
/* \u5de6\u65cb\u64cd\u4f5c */\nleftRotate(node: TreeNode): TreeNode {\nconst child = node.right;\nconst grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.updateHeight(node);\nthis.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{leftRotate}\n
avl_tree.cs
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode? leftRotate(TreeNode? node)\n{\nTreeNode? child = node.right;\nTreeNode? grandChild = child?.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.swift
/* \u5de6\u65cb\u64cd\u4f5c */\nfunc leftRotate(node: TreeNode?) -> TreeNode? {\nlet child = node?.right\nlet grandChild = child?.left\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild?.left = node\nnode?.right = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node: node)\nupdateHeight(node: child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.zig
// \u5de6\u65cb\u64cd\u4f5c\nfn leftRotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\nvar child = node.?.right;\nvar grandChild = child.?.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.?.left = node;\nnode.?.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.updateHeight(node);\nself.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
"},{"location":"chapter_tree/avl_tree/#case-3-","title":"Case 3 - \u5148\u5de6\u540e\u53f3","text":"

\u5bf9\u4e8e\u4e0b\u56fe\u7684\u5931\u8861\u7ed3\u70b9 3 \uff0c\u5355\u4e00\u4f7f\u7528\u5de6\u65cb\u6216\u53f3\u65cb\u90fd\u65e0\u6cd5\u4f7f\u5b50\u6811\u6062\u590d\u5e73\u8861\uff0c\u6b64\u65f6\u9700\u8981\u300c\u5148\u5de6\u65cb\u540e\u53f3\u65cb\u300d\uff0c\u5373\u5148\u5bf9 child \u6267\u884c\u300c\u5de6\u65cb\u300d\uff0c\u518d\u5bf9 node \u6267\u884c\u300c\u53f3\u65cb\u300d\u3002

Fig. \u5148\u5de6\u65cb\u540e\u53f3\u65cb

"},{"location":"chapter_tree/avl_tree/#case-4-","title":"Case 4 - \u5148\u53f3\u540e\u5de6","text":"

\u540c\u7406\uff0c\u53d6\u4ee5\u4e0a\u5931\u8861\u4e8c\u53c9\u6811\u7684\u955c\u50cf\uff0c\u5219\u9700\u8981\u300c\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u300d\uff0c\u5373\u5148\u5bf9 child \u6267\u884c\u300c\u53f3\u65cb\u300d\uff0c\u7136\u540e\u5bf9 node \u6267\u884c\u300c\u5de6\u65cb\u300d\u3002

Fig. \u5148\u53f3\u65cb\u540e\u5de6\u65cb

"},{"location":"chapter_tree/avl_tree/#_3","title":"\u65cb\u8f6c\u7684\u9009\u62e9","text":"

\u4e0b\u56fe\u63cf\u8ff0\u7684\u56db\u79cd\u5931\u8861\u60c5\u51b5\u4e0e\u4e0a\u8ff0 Cases \u9010\u4e2a\u5bf9\u5e94\uff0c\u5206\u522b\u9700\u91c7\u7528 \u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u540e\u5de6\u3001\u5148\u5de6\u540e\u53f3 \u7684\u65cb\u8f6c\u64cd\u4f5c\u3002

Fig. AVL \u6811\u7684\u56db\u79cd\u65cb\u8f6c\u60c5\u51b5

\u5177\u4f53\u5730\uff0c\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528 \u5931\u8861\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u3001\u8f83\u9ad8\u4e00\u4fa7\u5b50\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u6765\u786e\u5b9a\u5931\u8861\u7ed3\u70b9\u5c5e\u4e8e\u4e0a\u56fe\u4e2d\u7684\u54ea\u79cd\u60c5\u51b5\u3002

\u5931\u8861\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u5b50\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u5e94\u91c7\u7528\u7684\u65cb\u8f6c\u65b9\u6cd5 \\(>0\\) \uff08\u5373\u5de6\u504f\u6811\uff09 \\(\\geq 0\\) \u53f3\u65cb \\(>0\\) \uff08\u5373\u5de6\u504f\u6811\uff09 \\(<0\\) \u5148\u5de6\u65cb\u540e\u53f3\u65cb \\(<0\\) \uff08\u5373\u53f3\u504f\u6811\uff09 \\(\\leq 0\\) \u5de6\u65cb \\(<0\\) \uff08\u5373\u53f3\u504f\u6811\uff09 \\(>0\\) \u5148\u53f3\u65cb\u540e\u5de6\u65cb

\u4e3a\u65b9\u4fbf\u4f7f\u7528\uff0c\u6211\u4eec\u5c06\u65cb\u8f6c\u64cd\u4f5c\u5c01\u88c5\u6210\u4e00\u4e2a\u51fd\u6570\u3002\u81f3\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6b64\u51fd\u6570\u6765\u65cb\u8f6c\u5404\u79cd\u5931\u8861\u60c5\u51b5\uff0c\u4f7f\u5931\u8861\u7ed3\u70b9\u91cd\u65b0\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode rotate(TreeNode node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint balanceFactor = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = leftRotate(node.left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = rightRotate(node.right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.cpp
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode* rotate(TreeNode* node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint _balanceFactor = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (_balanceFactor > 1) {\nif (balanceFactor(node->left) >= 0) {\n// \u53f3\u65cb\nreturn rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode->left = leftRotate(node->left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (_balanceFactor < -1) {\nif (balanceFactor(node->right) <= 0) {\n// \u5de6\u65cb\nreturn leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode->right = rightRotate(node->right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.py
def __rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 \"\"\"\n# \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nbalance_factor = self.balance_factor(node)\n# \u5de6\u504f\u6811\nif balance_factor > 1:\nif self.balance_factor(node.left) >= 0:\n# \u53f3\u65cb\nreturn self.__right_rotate(node)\nelse:\n# \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = self.__left_rotate(node.left)\nreturn self.__right_rotate(node)\n# \u53f3\u504f\u6811\nelif balance_factor < -1:\nif self.balance_factor(node.right) <= 0:\n# \u5de6\u65cb\nreturn self.__left_rotate(node)\nelse:\n# \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = self.__right_rotate(node.right)\nreturn self.__left_rotate(node)\n# \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n
avl_tree.go
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nfunc (t *aVLTree) rotate(node *TreeNode) *TreeNode {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\n// Go \u63a8\u8350\u77ed\u53d8\u91cf\uff0c\u8fd9\u91cc bf \u6307\u4ee3 t.balanceFactor\nbf := t.balanceFactor(node)\n// \u5de6\u504f\u6811\nif bf > 1 {\nif t.balanceFactor(node.Left) >= 0 {\n// \u53f3\u65cb\nreturn t.rightRotate(node)\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.Left = t.leftRotate(node.Left)\nreturn t.rightRotate(node)\n}\n}\n// \u53f3\u504f\u6811\nif bf < -1 {\nif t.balanceFactor(node.Right) <= 0 {\n// \u5de6\u65cb\nreturn t.leftRotate(node)\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.Right = t.rightRotate(node.Right)\nreturn t.leftRotate(node)\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n
avl_tree.js
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\n#rotate(node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nconst balanceFactor = this.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (this.balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn this.#rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = this.#leftRotate(node.left);\nreturn this.#rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (this.balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn this.#leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = this.#rightRotate(node.right);\nreturn this.#leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.ts
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nrotate(node: TreeNode): TreeNode {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nconst balanceFactor = this.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (this.balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn this.rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = this.leftRotate(node.left);\nreturn this.rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (this.balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn this.leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = this.rightRotate(node.right);\nreturn this.leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{rotate}\n
avl_tree.cs
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode? rotate(TreeNode? node)\n{\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint balanceFactorInt = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactorInt > 1)\n{\nif (balanceFactor(node.left) >= 0)\n{\n// \u53f3\u65cb\nreturn rightRotate(node);\n}\nelse\n{\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = leftRotate(node?.left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactorInt < -1)\n{\nif (balanceFactor(node.right) <= 0)\n{\n// \u5de6\u65cb\nreturn leftRotate(node);\n}\nelse\n{\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = rightRotate(node?.right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.swift
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nfunc rotate(node: TreeNode?) -> TreeNode? {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nlet balanceFactor = balanceFactor(node: node)\n// \u5de6\u504f\u6811\nif balanceFactor > 1 {\nif self.balanceFactor(node: node?.left) >= 0 {\n// \u53f3\u65cb\nreturn rightRotate(node: node)\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode?.left = leftRotate(node: node?.left)\nreturn rightRotate(node: node)\n}\n}\n// \u53f3\u504f\u6811\nif balanceFactor < -1 {\nif self.balanceFactor(node: node?.right) <= 0 {\n// \u5de6\u65cb\nreturn leftRotate(node: node)\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode?.right = rightRotate(node: node?.right)\nreturn leftRotate(node: node)\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n
avl_tree.zig
// \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nfn rotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nvar balance_factor = self.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balance_factor > 1) {\nif (self.balanceFactor(node.?.left) >= 0) {\n// \u53f3\u65cb\nreturn self.rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.?.left = self.leftRotate(node.?.left);\nreturn self.rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balance_factor < -1) {\nif (self.balanceFactor(node.?.right) <= 0) {\n// \u5de6\u65cb\nreturn self.leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.?.right = self.rightRotate(node.?.right);\nreturn self.leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#743-avl","title":"7.4.3. \u00a0 AVL \u6811\u5e38\u7528\u64cd\u4f5c","text":""},{"location":"chapter_tree/avl_tree/#_4","title":"\u63d2\u5165\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u7684\u7ed3\u70b9\u63d2\u5165\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u4e3b\u4f53\u7c7b\u4f3c\u3002\u4e0d\u540c\u7684\u662f\uff0c\u5728\u63d2\u5165\u7ed3\u70b9\u540e\uff0c\u4ece\u8be5\u7ed3\u70b9\u5230\u6839\u7ed3\u70b9\u7684\u8def\u5f84\u4e0a\u4f1a\u51fa\u73b0\u4e00\u7cfb\u5217\u300c\u5931\u8861\u7ed3\u70b9\u300d\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u9700\u8981\u4ece\u8be5\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6240\u6709\u5931\u8861\u7ed3\u70b9\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode insert(int val) {\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode insertHelper(TreeNode node, int val) {\nif (node == null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val)\nnode.left = insertHelper(node.left, val);\nelse if (val > node.val)\nnode.right = insertHelper(node.right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.cpp
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode* insert(int val) {\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode* insertHelper(TreeNode* node, int val) {\nif (node == nullptr) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node->val)\nnode->left = insertHelper(node->left, val);\nelse if (val > node->val)\nnode->right = insertHelper(node->right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.py
def insert(self, val) -> TreeNode:\n\"\"\" \u63d2\u5165\u7ed3\u70b9 \"\"\"\nself.__root = self.__insert_helper(self.__root, val)\nreturn self.__root\ndef __insert_helper(self, node: Optional[TreeNode], val: int) -> TreeNode:\n\"\"\" \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\"\"\"\nif node is None:\nreturn TreeNode(val)\n# 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9\nif val < node.val:\nnode.left = self.__insert_helper(node.left, val)\nelif val > node.val:\nnode.right = self.__insert_helper(node.right, val)\nelse:\n# \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\n# 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nreturn self.__rotate(node)\n
avl_tree.go
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc (t *aVLTree) insert(val int) *TreeNode {\nt.root = t.insertHelper(t.root, val)\nreturn t.root\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc (t *aVLTree) insertHelper(node *TreeNode, val int) *TreeNode {\nif node == nil {\nreturn NewTreeNode(val)\n}\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif val < node.Val {\nnode.Left = t.insertHelper(node.Left, val)\n} else if val > node.Val {\nnode.Right = t.insertHelper(node.Right, val)\n} else {\n// \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = t.rotate(node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n
avl_tree.js
/* \u63d2\u5165\u7ed3\u70b9 */\ninsert(val) {\nthis.root = this.#insertHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\n#insertHelper(node, val) {\nif (node === null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val) node.left = this.#insertHelper(node.left, val);\nelse if (val > node.val) node.right = this.#insertHelper(node.right, val);\nelse return node; // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nthis.#updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.#rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.ts
/* \u63d2\u5165\u7ed3\u70b9 */\ninsert(val: number): TreeNode {\nthis.root = this.insertHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\ninsertHelper(node: TreeNode, val: number): TreeNode {\nif (node === null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val) {\nnode.left = this.insertHelper(node.left, val);\n} else if (val > node.val) {\nnode.right = this.insertHelper(node.right, val);\n} else {\nreturn node; // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nthis.updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{insert}\n[class]{aVLTree}-[func]{insertHelper}\n
avl_tree.cs
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode? insert(int val)\n{\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode? insertHelper(TreeNode? node, int val)\n{\nif (node == null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val)\nnode.left = insertHelper(node.left, val);\nelse if (val > node.val)\nnode.right = insertHelper(node.right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.swift
/* \u63d2\u5165\u7ed3\u70b9 */\n@discardableResult\nfunc insert(val: Int) -> TreeNode? {\nroot = insertHelper(node: root, val: val)\nreturn root\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc insertHelper(node: TreeNode?, val: Int) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn TreeNode(x: val)\n}\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif val < node!.val {\nnode?.left = insertHelper(node: node?.left, val: val)\n} else if val > node!.val {\nnode?.right = insertHelper(node: node?.right, val: val)\n} else {\nreturn node // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nupdateHeight(node: node) // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node: node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n
avl_tree.zig
// \u63d2\u5165\u7ed3\u70b9\nfn insert(self: *Self, val: T) !?*inc.TreeNode(T) {\nself.root = try self.insertHelper(self.root, val);\nreturn self.root;\n}\n// \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\nfn insertHelper(self: *Self, node_: ?*inc.TreeNode(T), val: T) !?*inc.TreeNode(T) {\nvar node = node_;\nif (node == null) {\nvar tmp_node = try self.mem_allocator.create(inc.TreeNode(T));\ntmp_node.init(val);\nreturn tmp_node;\n}\n// 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9\nif (val < node.?.val) {\nnode.?.left = try self.insertHelper(node.?.left, val);\n} else if (val > node.?.val) {\nnode.?.right = try self.insertHelper(node.?.right, val);\n} else {\nreturn node;            // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nself.updateHeight(node);    // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n// 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nnode = self.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#_5","title":"\u5220\u9664\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u603b\u4f53\u76f8\u540c\u3002\u7c7b\u4f3c\u5730\uff0c\u5728\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u4e5f\u9700\u8981\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6240\u6709\u5931\u8861\u7ed3\u70b9\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode remove(int val) {\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode removeHelper(TreeNode node, int val) {\nif (node == null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val)\nnode.left = removeHelper(node.left, val);\nelse if (val > node.val)\nnode.right = removeHelper(node.right, val);\nelse {\nif (node.left == null || node.right == null) {\nTreeNode child = node.left != null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null)\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse\nnode = child;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode temp = getInOrderNext(node.right);\nnode.right = removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode getInOrderNext(TreeNode node) {\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left != null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.cpp
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode* remove(int val) {\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode* removeHelper(TreeNode* node, int val) {\nif (node == nullptr) return nullptr;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node->val)\nnode->left = removeHelper(node->left, val);\nelse if (val > node->val)\nnode->right = removeHelper(node->right, val);\nelse {\nif (node->left == nullptr || node->right == nullptr) {\nTreeNode* child = node->left != nullptr ? node->left : node->right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == nullptr) {\ndelete node;\nreturn nullptr;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse {\ndelete node;\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode* temp = getInOrderNext(node->right);\nnode->right = removeHelper(node->right, temp->val);\nnode->val = temp->val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode* getInOrderNext(TreeNode* node) {\nif (node == nullptr) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node->left != nullptr) {\nnode = node->left;\n}\nreturn node;\n}\n
avl_tree.py
def remove(self, val: int) -> Optional[TreeNode]:\n\"\"\" \u5220\u9664\u7ed3\u70b9 \"\"\"\nself.__root = self.__remove_helper(self.__root, val)\nreturn self.__root \ndef __remove_helper(self, node: Optional[TreeNode], val: int) -> Optional[TreeNode]:\n\"\"\" \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 \"\"\"\nif node is None:\nreturn None\n# 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b\nif val < node.val:\nnode.left = self.__remove_helper(node.left, val)\nelif val > node.val:\nnode.right = self.__remove_helper(node.right, val)\nelse:\nif node.left is None or node.right is None:\nchild = node.left or node.right\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child is None:\nreturn None\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse:\nnode = child\nelse:  # \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\ntemp = self.__get_inorder_next(node.right)\nnode.right = self.__remove_helper(node.right, temp.val)\nnode.val = temp.val\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\n# 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nreturn self.__rotate(node)\ndef __get_inorder_next(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 \"\"\"\nif node is None:\nreturn None\n# \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile node.left is not None:\nnode = node.left\nreturn node\n
avl_tree.go
/* \u5220\u9664\u7ed3\u70b9 */\nfunc (t *aVLTree) remove(val int) *TreeNode {\nroot := t.removeHelper(t.root, val)\nreturn root\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc (t *aVLTree) removeHelper(node *TreeNode, val int) *TreeNode {\nif node == nil {\nreturn nil\n}\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif val < node.Val {\nnode.Left = t.removeHelper(node.Left, val)\n} else if val > node.Val {\nnode.Right = t.removeHelper(node.Right, val)\n} else {\nif node.Left == nil || node.Right == nil {\nchild := node.Left\nif node.Right != nil {\nchild = node.Right\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child == nil {\nreturn nil\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nnode = child\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\ntemp := t.getInOrderNext(node.Right)\nnode.Right = t.removeHelper(node.Right, temp.Val)\nnode.Val = temp.Val\n}\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = t.rotate(node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc (t *aVLTree) getInOrderNext(node *TreeNode) *TreeNode {\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nfor node.Left != nil {\nnode = node.Left\n}\nreturn node\n}\n
avl_tree.js
/* \u5220\u9664\u7ed3\u70b9 */\nremove(val) {\nthis.root = this.#removeHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\n#removeHelper(node, val) {\nif (node === null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val) node.left = this.#removeHelper(node.left, val);\nelse if (val > node.val) node.right = this.#removeHelper(node.right, val);\nelse {\nif (node.left === null || node.right === null) {\nconst child = node.left !== null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child === null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse node = child;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nconst temp = this.#getInOrderNext(node.right);\nnode.right = this.#removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nthis.#updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.#rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\n#getInOrderNext(node) {\nif (node === null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left !== null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.ts
/* \u5220\u9664\u7ed3\u70b9 */\nremove(val: number): TreeNode {\nthis.root = this.removeHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nremoveHelper(node: TreeNode, val: number): TreeNode {\nif (node === null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val) {\nnode.left = this.removeHelper(node.left, val);\n} else if (val > node.val) {\nnode.right = this.removeHelper(node.right, val);\n} else {\nif (node.left === null || node.right === null) {\nconst child = node.left !== null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child === null) {\nreturn null;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nconst temp = this.getInOrderNext(node.right);\nnode.right = this.removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nthis.updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\ngetInOrderNext(node: TreeNode): TreeNode {\nif (node === null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left !== null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{remove}\n[class]{aVLTree}-[func]{removeHelper}\n[class]{aVLTree}-[func]{getInOrderNext}\n
avl_tree.cs
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode? remove(int val)\n{\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode? removeHelper(TreeNode? node, int val)\n{\nif (node == null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val)\nnode.left = removeHelper(node.left, val);\nelse if (val > node.val)\nnode.right = removeHelper(node.right, val);\nelse\n{\nif (node.left == null || node.right == null)\n{\nTreeNode? child = node.left != null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null)\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse\nnode = child;\n}\nelse\n{\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode? temp = getInOrderNext(node.right);\nnode.right = removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode? getInOrderNext(TreeNode? node)\n{\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left != null)\n{\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.swift
/* \u5220\u9664\u7ed3\u70b9 */\n@discardableResult\nfunc remove(val: Int) -> TreeNode? {\nroot = removeHelper(node: root, val: val)\nreturn root\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc removeHelper(node: TreeNode?, val: Int) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn nil\n}\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif val < node!.val {\nnode?.left = removeHelper(node: node?.left, val: val)\n} else if val > node!.val {\nnode?.right = removeHelper(node: node?.right, val: val)\n} else {\nif node?.left == nil || node?.right == nil {\nlet child = node?.left != nil ? node?.left : node?.right\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse {\nnode = child\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nlet temp = getInOrderNext(node: node?.right)\nnode?.right = removeHelper(node: node?.right, val: temp!.val)\nnode?.val = temp!.val\n}\n}\nupdateHeight(node: node) // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node: node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc getInOrderNext(node: TreeNode?) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile node?.left != nil {\nnode = node?.left\n}\nreturn node\n}\n
avl_tree.zig
// \u5220\u9664\u7ed3\u70b9\nfn remove(self: *Self, val: T) ?*inc.TreeNode(T) {\nself.root = self.removeHelper(self.root, val);\nreturn self.root;\n}\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\nfn removeHelper(self: *Self, node_: ?*inc.TreeNode(T), val: T) ?*inc.TreeNode(T) {\nvar node = node_;\nif (node == null) return null;\n// 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b\nif (val < node.?.val) {\nnode.?.left = self.removeHelper(node.?.left, val);\n} else if (val > node.?.val) {\nnode.?.right = self.removeHelper(node.?.right, val);\n} else {\nif (node.?.left == null or node.?.right == null) {\nvar child = if (node.?.left != null) node.?.left else node.?.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null) {\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\n} else {\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nvar temp = self.getInOrderNext(node.?.right);\nnode.?.right = self.removeHelper(node.?.right, temp.?.val);\nnode.?.val = temp.?.val;\n}\n}\nself.updateHeight(node);    // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n// 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nnode = self.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09\nfn getInOrderNext(self: *Self, node_: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n_ = self;\nvar node = node_;\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.?.left != null) {\nnode = node.?.left;\n}\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#_6","title":"\u67e5\u627e\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u7684\u7ed3\u70b9\u67e5\u627e\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u4e00\u81f4\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_tree/avl_tree/#744-avl","title":"7.4.4. \u00a0 AVL \u6811\u5178\u578b\u5e94\u7528","text":"
  • \u7ec4\u7ec7\u5b58\u50a8\u5927\u578b\u6570\u636e\uff0c\u9002\u7528\u4e8e\u9ad8\u9891\u67e5\u627e\u3001\u4f4e\u9891\u589e\u5220\u573a\u666f\uff1b
  • \u7528\u4e8e\u5efa\u7acb\u6570\u636e\u5e93\u4e2d\u7684\u7d22\u5f15\u7cfb\u7edf\uff1b

\u4e3a\u4ec0\u4e48\u7ea2\u9ed1\u6811\u6bd4 AVL \u6811\u66f4\u53d7\u6b22\u8fce\uff1f

\u7ea2\u9ed1\u6811\u7684\u5e73\u8861\u6761\u4ef6\u76f8\u5bf9\u5bbd\u677e\uff0c\u56e0\u6b64\u5728\u7ea2\u9ed1\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u6240\u9700\u7684\u65cb\u8f6c\u64cd\u4f5c\u76f8\u5bf9\u66f4\u5c11\uff0c\u7ed3\u70b9\u589e\u5220\u64cd\u4f5c\u76f8\u6bd4 AVL \u6811\u7684\u6548\u7387\u66f4\u9ad8\u3002

"},{"location":"chapter_tree/binary_search_tree/","title":"7.3. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811","text":"

\u300c\u4e8c\u53c9\u641c\u7d22\u6811 Binary Search Tree\u300d\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff1a

  1. \u5bf9\u4e8e\u6839\u7ed3\u70b9\uff0c\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u7684\u503c \\(<\\) \u6839\u7ed3\u70b9\u7684\u503c \\(<\\) \u53f3\u5b50\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u7684\u503c\uff1b
  2. \u4efb\u610f\u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u4e5f\u662f\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u5373\u4e5f\u6ee1\u8db3\u6761\u4ef6 1. \uff1b

Fig. \u4e8c\u53c9\u641c\u7d22\u6811

"},{"location":"chapter_tree/binary_search_tree/#731","title":"7.3.1. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u64cd\u4f5c","text":""},{"location":"chapter_tree/binary_search_tree/#_1","title":"\u67e5\u627e\u7ed3\u70b9","text":"

\u7ed9\u5b9a\u76ee\u6807\u7ed3\u70b9\u503c num \uff0c\u53ef\u4ee5\u6839\u636e\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6027\u8d28\u6765\u67e5\u627e\u3002\u6211\u4eec\u58f0\u660e\u4e00\u4e2a\u7ed3\u70b9 cur \uff0c\u4ece\u4e8c\u53c9\u6811\u7684\u6839\u7ed3\u70b9 root \u51fa\u53d1\uff0c\u5faa\u73af\u6bd4\u8f83\u7ed3\u70b9\u503c cur.val \u548c num \u4e4b\u95f4\u7684\u5927\u5c0f\u5173\u7cfb

  • \u82e5 cur.val < num \uff0c\u8bf4\u660e\u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\uff0c\u56e0\u6b64\u6267\u884c cur = cur.right \uff1b
  • \u82e5 cur.val > num \uff0c\u8bf4\u660e\u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\uff0c\u56e0\u6b64\u6267\u884c cur = cur.left \uff1b
  • \u82e5 cur.val = num \uff0c\u8bf4\u660e\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\u5e76\u8fd4\u56de\u8be5\u7ed3\u70b9\u5373\u53ef\uff1b
<1><2><3><4>

\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u67e5\u627e\u64cd\u4f5c\u548c\u4e8c\u5206\u67e5\u627e\u7b97\u6cd5\u5982\u51fa\u4e00\u8f99\uff0c\u4e5f\u662f\u5728\u6bcf\u8f6e\u6392\u9664\u4e00\u534a\u60c5\u51b5\u3002\u5faa\u73af\u6b21\u6570\u6700\u591a\u4e3a\u4e8c\u53c9\u6811\u7684\u9ad8\u5ea6\uff0c\u5f53\u4e8c\u53c9\u6811\u5e73\u8861\u65f6\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode search(int num) {\nTreeNode cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.cpp
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode* search(int num) {\nTreeNode* cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur->val > num) cur = cur->left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.py
def search(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u67e5\u627e\u7ed3\u70b9 \"\"\"\ncur: Optional[TreeNode] = self.__root\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur is not None:\n# \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur.val < num:\ncur = cur.right\n# \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelif cur.val > num:\ncur = cur.left\n# \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse:\nbreak\nreturn cur\n
binary_search_tree.go
/* \u67e5\u627e\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) search(num int) *TreeNode {\nnode := bst.root\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor node != nil {\nif node.Val < num {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nnode = node.Right\n} else if node.Val > num {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nnode = node.Left\n} else {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nbreak\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn node\n}\n
binary_search_tree.js
/* \u67e5\u627e\u7ed3\u70b9 */\nfunction search(num) {\nlet cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.ts
/* \u67e5\u627e\u7ed3\u70b9 */\nfunction search(num: number): TreeNode | null {\nlet cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\nif (cur.val < num) {\ncur = cur.right; // \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else if (cur.val > num) {\ncur = cur.left; // \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\nbreak; // \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{search}\n
binary_search_tree.cs
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode? search(int num)\n{\nTreeNode? cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.swift
/* \u67e5\u627e\u7ed3\u70b9 */\nfunc search(num: Int) -> TreeNode? {\nvar cur = root\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if cur!.val > num {\ncur = cur?.left\n}\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse {\nbreak\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur\n}\n
binary_search_tree.zig
// \u67e5\u627e\u7ed3\u70b9\nfn search(self: *Self, num: T) ?*inc.TreeNode(T) {\nvar cur = self.root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else if (cur.?.val > num) {\ncur = cur.?.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\n} else {\nbreak;\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
"},{"location":"chapter_tree/binary_search_tree/#_2","title":"\u63d2\u5165\u7ed3\u70b9","text":"

\u7ed9\u5b9a\u4e00\u4e2a\u5f85\u63d2\u5165\u5143\u7d20 num \uff0c\u4e3a\u4e86\u4fdd\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u201c\u5de6\u5b50\u6811 < \u6839\u7ed3\u70b9 < \u53f3\u5b50\u6811\u201d\u7684\u6027\u8d28\uff0c\u63d2\u5165\u64cd\u4f5c\u5206\u4e3a\u4e24\u6b65\uff1a

  1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff1a\u4e0e\u67e5\u627e\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u6211\u4eec\u4ece\u6839\u7ed3\u70b9\u51fa\u53d1\uff0c\u6839\u636e\u5f53\u524d\u7ed3\u70b9\u503c\u548c num \u7684\u5927\u5c0f\u5173\u7cfb\u5faa\u73af\u5411\u4e0b\u641c\u7d22\uff0c\u76f4\u5230\u8d8a\u8fc7\u53f6\u7ed3\u70b9\uff08\u904d\u5386\u5230 \\(\\text{null}\\) \uff09\u65f6\u8df3\u51fa\u5faa\u73af\uff1b
  2. \u5728\u8be5\u4f4d\u7f6e\u63d2\u5165\u7ed3\u70b9\uff1a\u521d\u59cb\u5316\u7ed3\u70b9 num \uff0c\u5c06\u8be5\u7ed3\u70b9\u653e\u5230 \\(\\text{null}\\) \u7684\u4f4d\u7f6e \uff1b

\u4e8c\u53c9\u641c\u7d22\u6811\u4e0d\u5141\u8bb8\u5b58\u5728\u91cd\u590d\u7ed3\u70b9\uff0c\u5426\u5219\u5c06\u4f1a\u8fdd\u80cc\u5176\u5b9a\u4e49\u3002\u56e0\u6b64\u82e5\u5f85\u63d2\u5165\u7ed3\u70b9\u5728\u6811\u4e2d\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4e0d\u6267\u884c\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u63d2\u5165\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode insert(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode node = new TreeNode(num);\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\nreturn node;\n}\n
binary_search_tree.cpp
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode* insert(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == nullptr) return nullptr;\nTreeNode *cur = root, *pre = nullptr;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur->val == num) return nullptr;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur->left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode* node = new TreeNode(num);\nif (pre->val < num) pre->right = node;\nelse pre->left = node;\nreturn node;\n}\n
binary_search_tree.py
def insert(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u63d2\u5165\u7ed3\u70b9 \"\"\"\n# \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif self.__root is None:\nreturn None\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\ncur, pre = self.__root, None\nwhile cur is not None:\n# \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif cur.val == num:\nreturn None\npre = cur\n# \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur.val < num:\ncur = cur.right\n# \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse:\ncur = cur.left\n# \u63d2\u5165\u7ed3\u70b9 val\nnode = TreeNode(num)\nif pre.val < num:\npre.right = node\nelse:\npre.left = node\nreturn node\n
binary_search_tree.go
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) insert(num int) *TreeNode {\ncur := bst.root\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5f85\u63d2\u5165\u7ed3\u70b9\u4e4b\u524d\u7684\u7ed3\u70b9\u4f4d\u7f6e\nvar pre *TreeNode = nil\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor cur != nil {\nif cur.Val == num {\nreturn nil\n}\npre = cur\nif cur.Val < num {\ncur = cur.Right\n} else {\ncur = cur.Left\n}\n}\n// \u63d2\u5165\u7ed3\u70b9\nnode := NewTreeNode(num)\nif pre.Val < num {\npre.Right = node\n} else {\npre.Left = node\n}\nreturn cur\n}\n
binary_search_tree.js
/* \u63d2\u5165\u7ed3\u70b9 */\nfunction insert(num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) return null;\nlet cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val === num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = new TreeNode(num);\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\nreturn node;\n}\n
binary_search_tree.ts
/* \u63d2\u5165\u7ed3\u70b9 */\nfunction insert(num: number): TreeNode | null {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) {\nreturn null;\n}\nlet cur = root,\npre: TreeNode | null = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\nif (cur.val === num) {\nreturn null; // \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\n}\npre = cur;\nif (cur.val < num) {\ncur = cur.right as TreeNode; // \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else {\ncur = cur.left as TreeNode; // \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = new TreeNode(num);\nif (pre!.val < num) {\npre!.right = node;\n} else {\npre!.left = node;\n}\nreturn node;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{insert}\n
binary_search_tree.cs
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode? insert(int num)\n{\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode? cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode node = new TreeNode(num);\nif (pre != null)\n{\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\n}\nreturn node;\n}\n
binary_search_tree.swift
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc insert(num: Int) -> TreeNode? {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif root == nil {\nreturn nil\n}\nvar cur = root\nvar pre: TreeNode?\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif cur!.val == num {\nreturn nil\n}\npre = cur\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse {\ncur = cur?.left\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = TreeNode(x: num)\nif pre!.val < num {\npre?.right = node\n} else {\npre?.left = node\n}\nreturn node\n}\n
binary_search_tree.zig
// \u63d2\u5165\u7ed3\u70b9\nfn insert(self: *Self, num: T) !?*inc.TreeNode(T) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (self.root == null) return null;\nvar cur = self.root;\nvar pre: ?*inc.TreeNode(T) = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.?.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\ncur = cur.?.left;\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nvar node = try self.mem_allocator.create(inc.TreeNode(T));\nnode.init(num);\nif (pre.?.val < num) {\npre.?.right = node;\n} else {\npre.?.left = node;\n}\nreturn node;\n}\n

\u4e3a\u4e86\u63d2\u5165\u7ed3\u70b9\uff0c\u9700\u8981\u501f\u52a9 \u8f85\u52a9\u7ed3\u70b9 pre \u4fdd\u5b58\u4e0a\u4e00\u8f6e\u5faa\u73af\u7684\u7ed3\u70b9\uff0c\u8fd9\u6837\u5728\u904d\u5386\u5230 \\(\\text{null}\\) \u65f6\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u83b7\u53d6\u5230\u5176\u7236\u7ed3\u70b9\uff0c\u4ece\u800c\u5b8c\u6210\u7ed3\u70b9\u63d2\u5165\u64cd\u4f5c\u3002

\u4e0e\u67e5\u627e\u7ed3\u70b9\u76f8\u540c\uff0c\u63d2\u5165\u7ed3\u70b9\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

"},{"location":"chapter_tree/binary_search_tree/#_3","title":"\u5220\u9664\u7ed3\u70b9","text":"

\u4e0e\u63d2\u5165\u7ed3\u70b9\u4e00\u6837\uff0c\u6211\u4eec\u9700\u8981\u5728\u5220\u9664\u64cd\u4f5c\u540e\u7ef4\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u201c\u5de6\u5b50\u6811 < \u6839\u7ed3\u70b9 < \u53f3\u5b50\u6811\u201d\u7684\u6027\u8d28\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728\u4e8c\u53c9\u6811\u4e2d\u6267\u884c\u67e5\u627e\u64cd\u4f5c\uff0c\u83b7\u53d6\u5f85\u5220\u9664\u7ed3\u70b9\u3002\u63a5\u4e0b\u6765\uff0c\u6839\u636e\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf\uff0c\u5220\u9664\u64cd\u4f5c\u9700\u8981\u5206\u4e3a\u4e09\u79cd\u60c5\u51b5\uff1a

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 0\\) \u65f6\uff0c\u8868\u660e\u5f85\u5220\u9664\u7ed3\u70b9\u662f\u53f6\u7ed3\u70b9\uff0c\u76f4\u63a5\u5220\u9664\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u5220\u9664\u7ed3\u70b9\uff08\u5ea6\u4e3a 0\uff09

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 1\\) \u65f6\uff0c\u5c06\u5f85\u5220\u9664\u7ed3\u70b9\u66ff\u6362\u4e3a\u5176\u5b50\u7ed3\u70b9\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u5220\u9664\u7ed3\u70b9\uff08\u5ea6\u4e3a 1\uff09

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 2\\) \u65f6\uff0c\u5220\u9664\u64cd\u4f5c\u5206\u4e3a\u4e09\u6b65\uff1a

  1. \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\u5728 \u4e2d\u5e8f\u904d\u5386\u5e8f\u5217 \u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff0c\u8bb0\u4e3a nex \uff1b
  2. \u5728\u6811\u4e2d\u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex \uff1b
  3. \u4f7f\u7528 nex \u66ff\u6362\u5f85\u5220\u9664\u7ed3\u70b9\uff1b
<1><2><3><4>

\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u4e5f\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d\u67e5\u627e\u5f85\u5220\u9664\u7ed3\u70b9 \\(O(\\log n)\\) \uff0c\u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u540e\u7ee7\u7ed3\u70b9 \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode remove(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left == null || cur.right == null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nTreeNode child = cur.left != null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left == cur) pre.left = child;\nelse pre.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode nex = getInOrderNext(cur.right);\nint tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode getInOrderNext(TreeNode root) {\nif (root == null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left != null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.cpp
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode* remove(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == nullptr) return nullptr;\nTreeNode *cur = root, *pre = nullptr;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur->val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur->left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == nullptr) return nullptr;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur->left == nullptr || cur->right == nullptr) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = nullptr / \u8be5\u5b50\u7ed3\u70b9\nTreeNode* child = cur->left != nullptr ? cur->left : cur->right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre->left == cur) pre->left = child;\nelse pre->right = child;\n// \u91ca\u653e\u5185\u5b58\ndelete cur;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode* nex = getInOrderNext(cur->right);\nint tmp = nex->val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex->val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur->val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode* getInOrderNext(TreeNode* root) {\nif (root == nullptr) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root->left != nullptr) {\nroot = root->left;\n}\nreturn root;\n}\n
binary_search_tree.py
def remove(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u5220\u9664\u7ed3\u70b9 \"\"\"\n# \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif self.__root is None:\nreturn None\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\ncur, pre = self.__root, None\nwhile cur is not None:\n# \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif cur.val == num:\nbreak\npre = cur\nif cur.val < num:  # \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\ncur = cur.right\nelse:  # \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\ncur = cur.left\n# \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur is None:\nreturn None\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif cur.left is None or cur.right is None:\n# \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nchild = cur.left or cur.right\n# \u5220\u9664\u7ed3\u70b9 cur\nif pre.left == cur:\npre.left = child\nelse:\npre.right = child\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse:\n# \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nnex: TreeNode = self.get_inorder_next(cur.right)\ntmp: int = nex.val\n# \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nself.remove(nex.val)\n# \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp\nreturn cur\ndef get_inorder_next(self, root: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 \"\"\"\nif root is None:\nreturn root\n# \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile root.left is not None:\nroot = root.left\nreturn root\n
binary_search_tree.go
/* \u5220\u9664\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) remove(num int) *TreeNode {\ncur := bst.root\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5f85\u5220\u9664\u7ed3\u70b9\u4e4b\u524d\u7684\u7ed3\u70b9\u4f4d\u7f6e\nvar pre *TreeNode = nil\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor cur != nil {\nif cur.Val == num {\nbreak\n}\npre = cur\nif cur.Val < num {\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728\u53f3\u5b50\u6811\u4e2d\ncur = cur.Right\n} else {\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728\u5de6\u5b50\u6811\u4e2d\ncur = cur.Left\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u4e3a 0 \u6216 1\nif cur.Left == nil || cur.Right == nil {\nvar child *TreeNode = nil\n// \u53d6\u51fa\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\nif cur.Left != nil {\nchild = cur.Left\n} else {\nchild = cur.Right\n}\n// \u5c06\u5b50\u7ed3\u70b9\u66ff\u6362\u4e3a\u5f85\u5220\u9664\u7ed3\u70b9\nif pre.Left == cur {\npre.Left = child\n} else {\npre.Right = child\n}\n// \u5b50\u7ed3\u70b9\u6570\u4e3a 2\n} else {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u5f85\u5220\u9664\u7ed3\u70b9 cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nnext := bst.getInOrderNext(cur)\ntemp := next.Val\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 next\nbst.remove(next.Val)\n// \u5c06 next \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.Val = temp\n}\nreturn cur\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc (bst *binarySearchTree) getInOrderNext(node *TreeNode) *TreeNode {\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nfor node.Left != nil {\nnode = node.Left\n}\nreturn node\n}\n
binary_search_tree.js
/* \u5220\u9664\u7ed3\u70b9 */\nfunction remove(num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) return null;\nlet cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val === num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur === null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left === null || cur.right === null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur.left !== null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left === cur) pre.left = child;\nelse pre.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet nex = getInOrderNext(cur.right);\nlet tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunction getInOrderNext(root) {\nif (root === null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left !== null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.ts
/* \u5220\u9664\u7ed3\u70b9 */\nfunction remove(num: number): TreeNode | null {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) {\nreturn null;\n}\nlet cur = root,\npre: TreeNode | null = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val === num) {\nbreak;\n}\npre = cur;\nif (cur.val < num) {\ncur = cur.right as TreeNode; // \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else {\ncur = cur.left as TreeNode; // \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur === null) {\nreturn null;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left === null || cur.right === null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur.left !== null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre!.left === cur) {\npre!.left = child;\n} else {\npre!.right = child;\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet next = getInOrderNext(cur.right);\nlet tmp = next!.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(next!.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunction getInOrderNext(root: TreeNode | null): TreeNode | null {\nif (root === null) {\nreturn null;\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left !== null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{remove}\n[class]{binarySearchTree}-[func]{getInOrderNext}\n
binary_search_tree.cs
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode? remove(int num)\n{\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode? cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null || pre == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left == null || cur.right == null)\n{\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nTreeNode? child = cur.left != null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left == cur)\n{\npre.left = child;\n}\nelse\n{\npre.right = child;\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse\n{\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode? nex = getInOrderNext(cur.right);\nif (nex != null)\n{\nint tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode? getInOrderNext(TreeNode? root)\n{\nif (root == null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left != null)\n{\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.swift
/* \u5220\u9664\u7ed3\u70b9 */\n@discardableResult\nfunc remove(num: Int) -> TreeNode? {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif root == nil {\nreturn nil\n}\nvar cur = root\nvar pre: TreeNode?\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif cur!.val == num {\nbreak\n}\npre = cur\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse {\ncur = cur?.left\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif cur?.left == nil || cur?.right == nil {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur?.left != nil ? cur?.left : cur?.right\n// \u5220\u9664\u7ed3\u70b9 cur\nif pre?.left === cur {\npre?.left = child\n} else {\npre?.right = child\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet nex = getInOrderNext(root: cur?.right)\nlet tmp = nex!.val\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(num: nex!.val)\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur?.val = tmp\n}\nreturn cur\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc getInOrderNext(root: TreeNode?) -> TreeNode? {\nvar root = root\nif root == nil {\nreturn root\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile root?.left != nil {\nroot = root?.left\n}\nreturn root\n}\n
binary_search_tree.zig
// \u5220\u9664\u7ed3\u70b9\nfn remove(self: *Self, num: T) ?*inc.TreeNode(T) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (self.root == null) return null;\nvar cur = self.root;\nvar pre: ?*inc.TreeNode(T) = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.?.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\ncur = cur.?.left;\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.?.left == null or cur.?.right == null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nvar child = if (cur.?.left != null) cur.?.left else cur.?.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.?.left == cur) {\npre.?.left = child;\n} else {\npre.?.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\n} else {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nvar nex = self.getInOrderNext(cur.?.right);\nvar tmp = nex.?.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\n_ = self.remove(nex.?.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.?.val = tmp;\n}\nreturn cur;\n}\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09\nfn getInOrderNext(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n_ = self;\nvar node_tmp = node;\nif (node_tmp == null) return null;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node_tmp.?.left != null) {\nnode_tmp = node_tmp.?.left;\n}\nreturn node_tmp;\n}\n
"},{"location":"chapter_tree/binary_search_tree/#_4","title":"\u6392\u5e8f","text":"

\u6211\u4eec\u77e5\u9053\uff0c\u300c\u4e2d\u5e8f\u904d\u5386\u300d\u9075\u5faa\u201c\u5de6 \\(\\rightarrow\\) \u6839 \\(\\rightarrow\\) \u53f3\u201d\u7684\u904d\u5386\u4f18\u5148\u7ea7\uff0c\u800c\u4e8c\u53c9\u641c\u7d22\u6811\u9075\u5faa\u201c\u5de6\u5b50\u7ed3\u70b9 \\(<\\) \u6839\u7ed3\u70b9 \\(<\\) \u53f3\u5b50\u7ed3\u70b9\u201d\u7684\u5927\u5c0f\u5173\u7cfb\u3002\u56e0\u6b64\uff0c\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u8fdb\u884c\u4e2d\u5e8f\u904d\u5386\u65f6\uff0c\u603b\u662f\u4f1a\u4f18\u5148\u904d\u5386\u4e0b\u4e00\u4e2a\u6700\u5c0f\u7ed3\u70b9\uff0c\u4ece\u800c\u5f97\u51fa\u4e00\u6761\u91cd\u8981\u6027\u8d28\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217\u662f\u5347\u5e8f\u7684\u3002

\u501f\u52a9\u4e2d\u5e8f\u904d\u5386\u5347\u5e8f\u7684\u6027\u8d28\uff0c\u6211\u4eec\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u83b7\u53d6\u6709\u5e8f\u6570\u636e\u4ec5\u9700 \\(O(n)\\) \u65f6\u95f4\uff0c\u800c\u65e0\u9700\u989d\u5916\u6392\u5e8f\uff0c\u975e\u5e38\u9ad8\u6548\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217

"},{"location":"chapter_tree/binary_search_tree/#732","title":"7.3.2. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6548\u7387","text":"

\u5047\u8bbe\u7ed9\u5b9a \\(n\\) \u4e2a\u6570\u5b57\uff0c\u6700\u5e38\u7528\u7684\u5b58\u50a8\u65b9\u5f0f\u662f\u300c\u6570\u7ec4\u300d\uff0c\u90a3\u4e48\u5bf9\u4e8e\u8fd9\u4e32\u4e71\u5e8f\u7684\u6570\u5b57\uff0c\u5e38\u89c1\u64cd\u4f5c\u7684\u6548\u7387\u4e3a\uff1a

  • \u67e5\u627e\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u662f\u65e0\u5e8f\u7684\uff0c\u56e0\u6b64\u9700\u8981\u904d\u5386\u6570\u7ec4\u6765\u786e\u5b9a\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u63d2\u5165\u5143\u7d20\uff1a\u53ea\u9700\u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u6570\u7ec4\u5c3e\u90e8\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\uff1b
  • \u5220\u9664\u5143\u7d20\uff1a\u5148\u67e5\u627e\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u518d\u5728\u6570\u7ec4\u4e2d\u5220\u9664\u8be5\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20\uff1a\u9700\u8981\u904d\u5386\u6570\u7ec4\u6765\u786e\u5b9a\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b

\u4e3a\u4e86\u5f97\u5230\u5148\u9a8c\u4fe1\u606f\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u9884\u5148\u5c06\u6570\u7ec4\u5143\u7d20\u8fdb\u884c\u6392\u5e8f\uff0c\u5f97\u5230\u4e00\u4e2a\u300c\u6392\u5e8f\u6570\u7ec4\u300d\uff0c\u6b64\u65f6\u64cd\u4f5c\u6548\u7387\u4e3a\uff1a

  • \u67e5\u627e\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u5df2\u6392\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\uff0c\u5e73\u5747\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff1b
  • \u63d2\u5165\u5143\u7d20\uff1a\u5148\u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u518d\u63d2\u5165\u5230\u6307\u5b9a\u4f4d\u7f6e\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u5220\u9664\u5143\u7d20\uff1a\u5148\u67e5\u627e\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u518d\u5728\u6570\u7ec4\u4e2d\u5220\u9664\u8be5\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20\uff1a\u6570\u7ec4\u5934\u90e8\u548c\u5c3e\u90e8\u5143\u7d20\u5373\u662f\u6700\u5c0f\u548c\u6700\u5927\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u65e0\u5e8f\u6570\u7ec4\u548c\u6709\u5e8f\u6570\u7ec4\u4e2d\u7684\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u201c\u504f\u79d1\u201d\u7684\uff0c\u5373\u6709\u7684\u5feb\u6709\u7684\u6162\uff1b\u800c\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f\u5bf9\u6570\u9636\uff0c\u5728\u6570\u636e\u91cf \\(n\\) \u5f88\u5927\u65f6\u6709\u5de8\u5927\u4f18\u52bf\u3002

\u65e0\u5e8f\u6570\u7ec4 \u6709\u5e8f\u6570\u7ec4 \u4e8c\u53c9\u641c\u7d22\u6811 \u67e5\u627e\u6307\u5b9a\u5143\u7d20 \\(O(n)\\) \\(O(\\log n)\\) \\(O(\\log n)\\) \u63d2\u5165\u5143\u7d20 \\(O(1)\\) \\(O(n)\\) \\(O(\\log n)\\) \u5220\u9664\u5143\u7d20 \\(O(n)\\) \\(O(n)\\) \\(O(\\log n)\\) \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20 \\(O(n)\\) \\(O(1)\\) \\(O(\\log n)\\)"},{"location":"chapter_tree/binary_search_tree/#733","title":"7.3.3. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u9000\u5316","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u662f\u201c\u5de6\u53f3\u5e73\u8861\u201d\u7684\uff08\u8be6\u89c1\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\u7ae0\u8282\uff09\uff0c\u6b64\u65f6\u53ef\u4ee5\u5728 \\(\\log n\\) \u8f6e\u5faa\u73af\u5185\u67e5\u627e\u4efb\u610f\u7ed3\u70b9\u3002

\u5982\u679c\u6211\u4eec\u52a8\u6001\u5730\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u53ef\u80fd\u5bfc\u81f4\u4e8c\u53c9\u6811\u9000\u5316\u4e3a\u94fe\u8868\uff0c\u6b64\u65f6\u5404\u79cd\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u9000\u5316\u4e4b \\(O(n)\\) \u3002

Note

\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5982\u4f55\u4fdd\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5e73\u8861\uff0c\u4e5f\u662f\u4e00\u4e2a\u9700\u8981\u91cd\u8981\u8003\u8651\u7684\u95ee\u9898\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5e73\u8861\u4e0e\u9000\u5316

"},{"location":"chapter_tree/binary_search_tree/#734","title":"7.3.4. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u5e38\u89c1\u5e94\u7528","text":"
  • \u7cfb\u7edf\u4e2d\u7684\u591a\u7ea7\u7d22\u5f15\uff0c\u9ad8\u6548\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u3002
  • \u5404\u79cd\u641c\u7d22\u7b97\u6cd5\u7684\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u3002
  • \u5b58\u50a8\u6570\u636e\u6d41\uff0c\u4fdd\u6301\u5176\u5df2\u6392\u5e8f\u3002
"},{"location":"chapter_tree/binary_tree/","title":"7.1. \u00a0 \u4e8c\u53c9\u6811","text":"

\u300c\u4e8c\u53c9\u6811 Binary Tree\u300d\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u7740\u7956\u5148\u4e0e\u540e\u4ee3\u4e4b\u95f4\u7684\u6d3e\u751f\u5173\u7cfb\uff0c\u4f53\u73b0\u7740\u201c\u4e00\u5206\u4e3a\u4e8c\u201d\u7684\u5206\u6cbb\u903b\u8f91\u3002\u7c7b\u4f3c\u4e8e\u94fe\u8868\uff0c\u4e8c\u53c9\u6811\u4e5f\u662f\u4ee5\u7ed3\u70b9\u4e3a\u5355\u4f4d\u5b58\u50a8\u7684\uff0c\u7ed3\u70b9\u5305\u542b\u300c\u503c\u300d\u548c\u4e24\u4e2a\u300c\u6307\u9488\u300d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nint val;         // \u7ed3\u70b9\u503c\nTreeNode left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) { val = x; }\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct TreeNode {\nint val;          // \u7ed3\u70b9\u503c\nTreeNode *left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode *right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n};\n
\"\"\" \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b \"\"\"\nclass TreeNode:\ndef __init__(self, val: int):\nself.val: int = val                   # \u7ed3\u70b9\u503c\nself.left: Optional[TreeNode] = None  # \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nself.right: Optional[TreeNode] = None # \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype TreeNode struct {\nVal   int\nLeft  *TreeNode\nRight *TreeNode\n}\n/* \u7ed3\u70b9\u521d\u59cb\u5316\u65b9\u6cd5 */\nfunc NewTreeNode(v int) *TreeNode {\nreturn &TreeNode{\nLeft:  nil,\nRight: nil,\nVal:   v,\n}\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nfunction TreeNode(val, left, right) {\nthis.val = (val === undefined ? 0 : val); // \u7ed3\u70b9\u503c\nthis.left = (left === undefined ? null : left); // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nthis.right = (right === undefined ? null : right); // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nval: number;\nleft: TreeNode | null;\nright: TreeNode | null;\nconstructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.left = left === undefined ? null : left; // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nthis.right = right === undefined ? null : right; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n}\n}\n
\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nint val;          // \u7ed3\u70b9\u503c\nTreeNode? left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode? right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) { val = x; }\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar left: TreeNode? // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nvar right: TreeNode? // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\ninit(x: Int) {\nval = x\n}\n}\n
\n

\u7ed3\u70b9\u7684\u4e24\u4e2a\u6307\u9488\u5206\u522b\u6307\u5411\u300c\u5de6\u5b50\u7ed3\u70b9 Left Child Node\u300d\u548c\u300c\u53f3\u5b50\u7ed3\u70b9 Right Child Node\u300d\uff0c\u5e76\u4e14\u79f0\u8be5\u7ed3\u70b9\u4e3a\u4e24\u4e2a\u5b50\u7ed3\u70b9\u7684\u300c\u7236\u7ed3\u70b9 Parent Node\u300d\u3002\u7ed9\u5b9a\u4e8c\u53c9\u6811\u67d0\u7ed3\u70b9\uff0c\u5c06\u5de6\u5b50\u7ed3\u70b9\u4ee5\u4e0b\u7684\u6811\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u300c\u5de6\u5b50\u6811 Left Subtree\u300d\uff0c\u53f3\u5b50\u6811\u540c\u7406\u3002

\u9664\u4e86\u53f6\u7ed3\u70b9\u5916\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u90fd\u6709\u5b50\u7ed3\u70b9\u548c\u5b50\u6811\u3002\u4f8b\u5982\uff0c\u82e5\u5c06\u4e0b\u56fe\u7684\u300c\u7ed3\u70b9 2\u300d\u770b\u4f5c\u7236\u7ed3\u70b9\uff0c\u90a3\u4e48\u5176\u5de6\u5b50\u7ed3\u70b9\u548c\u53f3\u5b50\u7ed3\u70b9\u5206\u522b\u4e3a\u300c\u7ed3\u70b9 4\u300d\u548c\u300c\u7ed3\u70b9 5\u300d\uff0c\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u5206\u522b\u4e3a\u300c\u7ed3\u70b9 4 \u53ca\u5176\u4ee5\u4e0b\u7ed3\u70b9\u5f62\u6210\u7684\u6811\u300d\u548c\u300c\u7ed3\u70b9 5 \u53ca\u5176\u4ee5\u4e0b\u7ed3\u70b9\u5f62\u6210\u7684\u6811\u300d\u3002

Fig. \u7236\u7ed3\u70b9\u3001\u5b50\u7ed3\u70b9\u3001\u5b50\u6811

"},{"location":"chapter_tree/binary_tree/#711","title":"7.1.1. \u00a0 \u4e8c\u53c9\u6811\u5e38\u89c1\u672f\u8bed","text":"

\u4e8c\u53c9\u6811\u7684\u672f\u8bed\u8f83\u591a\uff0c\u5efa\u8bae\u5c3d\u91cf\u7406\u89e3\u5e76\u8bb0\u4f4f\u3002\u540e\u7eed\u53ef\u80fd\u9057\u5fd8\uff0c\u53ef\u4ee5\u5728\u9700\u8981\u4f7f\u7528\u65f6\u56de\u6765\u67e5\u770b\u786e\u8ba4\u3002

  • \u300c\u6839\u7ed3\u70b9 Root Node\u300d\uff1a\u4e8c\u53c9\u6811\u6700\u9876\u5c42\u7684\u7ed3\u70b9\uff0c\u5176\u6ca1\u6709\u7236\u7ed3\u70b9\uff1b
  • \u300c\u53f6\u7ed3\u70b9 Leaf Node\u300d\uff1a\u6ca1\u6709\u5b50\u7ed3\u70b9\u7684\u7ed3\u70b9\uff0c\u5176\u4e24\u4e2a\u6307\u9488\u90fd\u6307\u5411 \\(\\text{null}\\) \uff1b
  • \u7ed3\u70b9\u6240\u5904\u300c\u5c42 Level\u300d\uff1a\u4ece\u9876\u81f3\u5e95\u4f9d\u6b21\u589e\u52a0\uff0c\u6839\u7ed3\u70b9\u6240\u5904\u5c42\u4e3a 1 \uff1b
  • \u7ed3\u70b9\u300c\u5ea6 Degree\u300d\uff1a\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf\u3002\u4e8c\u53c9\u6811\u4e2d\uff0c\u5ea6\u7684\u8303\u56f4\u662f 0, 1, 2 \uff1b
  • \u300c\u8fb9 Edge\u300d\uff1a\u8fde\u63a5\u4e24\u4e2a\u7ed3\u70b9\u7684\u8fb9\uff0c\u5373\u7ed3\u70b9\u6307\u9488\uff1b
  • \u4e8c\u53c9\u6811\u300c\u9ad8\u5ea6\u300d\uff1a\u4e8c\u53c9\u6811\u4e2d\u6839\u7ed3\u70b9\u5230\u6700\u8fdc\u53f6\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b
  • \u7ed3\u70b9\u300c\u6df1\u5ea6 Depth\u300d \uff1a\u6839\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b
  • \u7ed3\u70b9\u300c\u9ad8\u5ea6 Height\u300d\uff1a\u6700\u8fdc\u53f6\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b

Fig. \u4e8c\u53c9\u6811\u7684\u5e38\u7528\u672f\u8bed

\u9ad8\u5ea6\u4e0e\u6df1\u5ea6\u7684\u5b9a\u4e49

\u503c\u5f97\u6ce8\u610f\uff0c\u6211\u4eec\u901a\u5e38\u5c06\u300c\u9ad8\u5ea6\u300d\u548c\u300c\u6df1\u5ea6\u300d\u5b9a\u4e49\u4e3a\u201c\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\u201d\uff0c\u800c\u6709\u4e9b\u9898\u76ee\u6216\u6559\u6750\u4f1a\u5c06\u5176\u5b9a\u4e49\u4e3a\u201c\u8d70\u8fc7\u7ed3\u70b9\u7684\u6570\u91cf\u201d\uff0c\u6b64\u65f6\u9ad8\u5ea6\u6216\u6df1\u5ea6\u90fd\u9700\u8981 + 1 \u3002

"},{"location":"chapter_tree/binary_tree/#712","title":"7.1.2. \u00a0 \u4e8c\u53c9\u6811\u57fa\u672c\u64cd\u4f5c","text":"

\u521d\u59cb\u5316\u4e8c\u53c9\u6811\u3002\u4e0e\u94fe\u8868\u7c7b\u4f3c\uff0c\u5148\u521d\u59cb\u5316\u7ed3\u70b9\uff0c\u518d\u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree.java
// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode n1 = new TreeNode(1);\nTreeNode n2 = new TreeNode(2);\nTreeNode n3 = new TreeNode(3);\nTreeNode n4 = new TreeNode(4);\nTreeNode n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.cpp
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode* n1 = new TreeNode(1);\nTreeNode* n2 = new TreeNode(2);\nTreeNode* n3 = new TreeNode(3);\nTreeNode* n4 = new TreeNode(4);\nTreeNode* n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1->left = n2;\nn1->right = n3;\nn2->left = n4;\nn2->right = n5;\n
binary_tree.py
\"\"\" \u521d\u59cb\u5316\u4e8c\u53c9\u6811 \"\"\"\n# \u521d\u59cb\u5316\u7ed3\u70b9\nn1 = TreeNode(val=1)\nn2 = TreeNode(val=2)\nn3 = TreeNode(val=3)\nn4 = TreeNode(val=4)\nn5 = TreeNode(val=5)\n# \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2\nn1.right = n3\nn2.left = n4\nn2.right = n5\n
binary_tree.go
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nn1 := NewTreeNode(1)\nn2 := NewTreeNode(2)\nn3 := NewTreeNode(3)\nn4 := NewTreeNode(4)\nn5 := NewTreeNode(5)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.Left = n2\nn1.Right = n3\nn2.Left = n4\nn2.Right = n5\n
binary_tree.js
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = new TreeNode(1),\nn2 = new TreeNode(2),\nn3 = new TreeNode(3),\nn4 = new TreeNode(4),\nn5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.ts
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = new TreeNode(1),\nn2 = new TreeNode(2),\nn3 = new TreeNode(3),\nn4 = new TreeNode(4),\nn5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.c
\n
binary_tree.cs
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode n1 = new TreeNode(1);\nTreeNode n2 = new TreeNode(2);\nTreeNode n3 = new TreeNode(3);\nTreeNode n4 = new TreeNode(4);\nTreeNode n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.swift
// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = TreeNode(x: 1)\nlet n2 = TreeNode(x: 2)\nlet n3 = TreeNode(x: 3)\nlet n4 = TreeNode(x: 4)\nlet n5 = TreeNode(x: 5)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2\nn1.right = n3\nn2.left = n4\nn2.right = n5\n
binary_tree.zig
\n

\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u3002\u4e0e\u94fe\u8868\u7c7b\u4f3c\uff0c\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u90fd\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u6307\u9488\u5b9e\u73b0\u3002

Fig. \u5728\u4e8c\u53c9\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree.java
TreeNode P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.cpp
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nTreeNode* P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1->left = P;\nP->left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1->left = n2;\n
binary_tree.py
\"\"\" \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 \"\"\"\np = TreeNode(0)\n# \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = p\np.left = n2\n# \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2\n
binary_tree.go
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\np := NewTreeNode(0)\nn1.Left = p\np.Left = n2\n// \u5220\u9664\u7ed3\u70b9 P\nn1.Left = n2\n
binary_tree.js
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nlet P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.ts
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nconst P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.c
\n
binary_tree.cs
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nTreeNode P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.swift
let P = TreeNode(x: 0)\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P\nP.left = n2\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2\n
binary_tree.zig
\n

Note

\u63d2\u5165\u7ed3\u70b9\u4f1a\u6539\u53d8\u4e8c\u53c9\u6811\u7684\u539f\u6709\u903b\u8f91\u7ed3\u6784\uff0c\u5220\u9664\u7ed3\u70b9\u5f80\u5f80\u610f\u5473\u7740\u5220\u9664\u4e86\u8be5\u7ed3\u70b9\u7684\u6240\u6709\u5b50\u6811\u3002\u56e0\u6b64\uff0c\u4e8c\u53c9\u6811\u4e2d\u7684\u63d2\u5165\u4e0e\u5220\u9664\u4e00\u822c\u90fd\u662f\u7531\u4e00\u5957\u64cd\u4f5c\u914d\u5408\u5b8c\u6210\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5b9e\u73b0\u6709\u610f\u4e49\u7684\u64cd\u4f5c\u3002

"},{"location":"chapter_tree/binary_tree/#713","title":"7.1.3. \u00a0 \u5e38\u89c1\u4e8c\u53c9\u6811\u7c7b\u578b","text":""},{"location":"chapter_tree/binary_tree/#_1","title":"\u5b8c\u7f8e\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811 Perfect Binary Tree\u300d\u7684\u6240\u6709\u5c42\u7684\u7ed3\u70b9\u90fd\u88ab\u5b8c\u5168\u586b\u6ee1\u3002\u5728\u5b8c\u7f8e\u4e8c\u53c9\u6811\u4e2d\uff0c\u6240\u6709\u7ed3\u70b9\u7684\u5ea6 = 2 \uff1b\u82e5\u6811\u9ad8\u5ea6 \\(= h\\) \uff0c\u5219\u7ed3\u70b9\u603b\u6570 \\(= 2^{h+1} - 1\\) \uff0c\u5448\u6807\u51c6\u7684\u6307\u6570\u7ea7\u5173\u7cfb\uff0c\u53cd\u6620\u7740\u81ea\u7136\u754c\u4e2d\u5e38\u89c1\u7684\u7ec6\u80de\u5206\u88c2\u3002

Tip

\u5728\u4e2d\u6587\u793e\u533a\u4e2d\uff0c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u5e38\u88ab\u79f0\u4e3a\u300c\u6ee1\u4e8c\u53c9\u6811\u300d\uff0c\u8bf7\u6ce8\u610f\u4e0e\u5b8c\u6ee1\u4e8c\u53c9\u6811\u533a\u5206\u3002

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_2","title":"\u5b8c\u5168\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u5168\u4e8c\u53c9\u6811 Complete Binary Tree\u300d\u53ea\u6709\u6700\u5e95\u5c42\u7684\u7ed3\u70b9\u672a\u88ab\u586b\u6ee1\uff0c\u4e14\u6700\u5e95\u5c42\u7ed3\u70b9\u5c3d\u91cf\u9760\u5de6\u586b\u5145\u3002

\u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u7528\u6570\u7ec4\u6765\u8868\u793a\u3002\u5982\u679c\u6309\u7167\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u987a\u5e8f\u6765\u5b58\u50a8\uff0c\u90a3\u4e48\u7a7a\u7ed3\u70b9 null \u4e00\u5b9a\u5168\u90e8\u51fa\u73b0\u5728\u5e8f\u5217\u7684\u5c3e\u90e8\uff0c\u56e0\u6b64\u6211\u4eec\u5c31\u53ef\u4ee5\u4e0d\u7528\u5b58\u50a8\u8fd9\u4e9b null \u4e86\u3002

Fig. \u5b8c\u5168\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_3","title":"\u5b8c\u6ee1\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u6ee1\u4e8c\u53c9\u6811 Full Binary Tree\u300d\u9664\u4e86\u53f6\u7ed3\u70b9\u4e4b\u5916\uff0c\u5176\u4f59\u6240\u6709\u7ed3\u70b9\u90fd\u6709\u4e24\u4e2a\u5b50\u7ed3\u70b9\u3002

Fig. \u5b8c\u6ee1\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_4","title":"\u5e73\u8861\u4e8c\u53c9\u6811","text":"

\u300c\u5e73\u8861\u4e8c\u53c9\u6811 Balanced Binary Tree\u300d\u4e2d\u4efb\u610f\u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u4e4b\u5dee\u7684\u7edd\u5bf9\u503c \\(\\leq 1\\) \u3002

Fig. \u5e73\u8861\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#714","title":"7.1.4. \u00a0 \u4e8c\u53c9\u6811\u7684\u9000\u5316","text":"

\u5f53\u4e8c\u53c9\u6811\u7684\u6bcf\u5c42\u7684\u7ed3\u70b9\u90fd\u88ab\u586b\u6ee1\u65f6\uff0c\u8fbe\u5230\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff1b\u800c\u5f53\u6240\u6709\u7ed3\u70b9\u90fd\u504f\u5411\u4e00\u8fb9\u65f6\uff0c\u4e8c\u53c9\u6811\u9000\u5316\u4e3a\u300c\u94fe\u8868\u300d\u3002

  • \u5b8c\u7f8e\u4e8c\u53c9\u6811\u662f\u4e00\u4e2a\u4e8c\u53c9\u6811\u7684\u201c\u6700\u4f73\u72b6\u6001\u201d\uff0c\u53ef\u4ee5\u5b8c\u5168\u53d1\u6325\u51fa\u4e8c\u53c9\u6811\u201c\u5206\u6cbb\u201d\u7684\u4f18\u52bf\uff1b
  • \u94fe\u8868\u5219\u662f\u53e6\u4e00\u4e2a\u6781\u7aef\uff0c\u5404\u9879\u64cd\u4f5c\u90fd\u53d8\u4e3a\u7ebf\u6027\u64cd\u4f5c\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u9000\u5316\u81f3 \\(O(n)\\) \uff1b

Fig. \u4e8c\u53c9\u6811\u7684\u6700\u4f73\u4e0e\u6700\u4e8c\u53c9\u6811\u7684\u6700\u4f73\u548c\u6700\u5dee\u7ed3\u6784\u5dee\u60c5\u51b5

\u5982\u4e0b\u8868\u6240\u793a\uff0c\u5728\u6700\u4f73\u548c\u6700\u5dee\u7ed3\u6784\u4e0b\uff0c\u4e8c\u53c9\u6811\u7684\u53f6\u7ed3\u70b9\u6570\u91cf\u3001\u7ed3\u70b9\u603b\u6570\u3001\u9ad8\u5ea6\u7b49\u8fbe\u5230\u6781\u5927\u6216\u6781\u5c0f\u503c\u3002

\u5b8c\u7f8e\u4e8c\u53c9\u6811 \u94fe\u8868 \u7b2c \\(i\\) \u5c42\u7684\u7ed3\u70b9\u6570\u91cf \\(2^{i-1}\\) \\(1\\) \u6811\u7684\u9ad8\u5ea6\u4e3a \\(h\\) \u65f6\u7684\u53f6\u7ed3\u70b9\u6570\u91cf \\(2^h\\) \\(1\\) \u6811\u7684\u9ad8\u5ea6\u4e3a \\(h\\) \u65f6\u7684\u7ed3\u70b9\u603b\u6570 \\(2^{h+1} - 1\\) \\(h + 1\\) \u6811\u7684\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \u65f6\u7684\u9ad8\u5ea6 \\(\\log_2 (n+1) - 1\\) \\(n - 1\\)"},{"location":"chapter_tree/binary_tree/#715","title":"7.1.5. \u00a0 \u4e8c\u53c9\u6811\u8868\u793a\u65b9\u5f0f *","text":"

\u6211\u4eec\u4e00\u822c\u4f7f\u7528\u4e8c\u53c9\u6811\u7684\u300c\u94fe\u8868\u8868\u793a\u300d\uff0c\u5373\u5b58\u50a8\u5355\u4f4d\u4e3a\u7ed3\u70b9 TreeNode \uff0c\u7ed3\u70b9\u4e4b\u95f4\u901a\u8fc7\u6307\u9488\uff08\u5f15\u7528\uff09\u76f8\u8fde\u63a5\u3002\u672c\u6587\u524d\u8ff0\u793a\u4f8b\u4ee3\u7801\u5c55\u793a\u4e86\u4e8c\u53c9\u6811\u5728\u94fe\u8868\u8868\u793a\u4e0b\u7684\u5404\u9879\u57fa\u672c\u64cd\u4f5c\u3002

\u90a3\u80fd\u5426\u53ef\u4ee5\u7528\u300c\u6570\u7ec4\u8868\u793a\u300d\u4e8c\u53c9\u6811\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\u3002\u5148\u6765\u5206\u6790\u4e00\u4e2a\u7b80\u5355\u6848\u4f8b\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff0c\u5c06\u7ed3\u70b9\u6309\u7167\u5c42\u5e8f\u904d\u5386\u7684\u987a\u5e8f\u7f16\u53f7\uff08\u4ece 0 \u5f00\u59cb\uff09\uff0c\u90a3\u4e48\u53ef\u4ee5\u63a8\u5bfc\u5f97\u51fa\u7236\u7ed3\u70b9\u7d22\u5f15\u4e0e\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e4b\u95f4\u7684\u300c\u6620\u5c04\u516c\u5f0f\u300d\uff1a\u8bbe\u7ed3\u70b9\u7684\u7d22\u5f15\u4e3a \\(i\\) \uff0c\u5219\u8be5\u7ed3\u70b9\u7684\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 1\\) \u3001\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 2\\) \u3002

\u672c\u8d28\u4e0a\uff0c\u6620\u5c04\u516c\u5f0f\u7684\u4f5c\u7528\u5c31\u662f\u94fe\u8868\u4e2d\u7684\u6307\u9488\u3002\u5bf9\u4e8e\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u4e2d\u7684\u4efb\u610f\u7ed3\u70b9\uff0c\u6211\u4eec\u90fd\u53ef\u4ee5\u4f7f\u7528\u6620\u5c04\u516c\u5f0f\u6765\u8bbf\u95ee\u5b50\u7ed3\u70b9\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\uff08\u5373\u6570\u7ec4\uff09\u6765\u8868\u793a\u5b8c\u7f8e\u4e8c\u53c9\u6811\u3002

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u7136\u800c\uff0c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u53ea\u662f\u4e2a\u4f8b\uff0c\u4e8c\u53c9\u6811\u4e2d\u95f4\u5c42\u5f80\u5f80\u5b58\u5728\u8bb8\u591a\u7a7a\u7ed3\u70b9\uff08\u5373 null \uff09\uff0c\u800c\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u5e76\u4e0d\u5305\u542b\u8fd9\u4e9b\u7a7a\u7ed3\u70b9\uff0c\u5e76\u4e14\u6211\u4eec\u65e0\u6cd5\u5355\u51ed\u5e8f\u5217\u6765\u731c\u6d4b\u7a7a\u7ed3\u70b9\u7684\u6570\u91cf\u548c\u5206\u5e03\u4f4d\u7f6e\uff0c\u5373\u7406\u8bba\u4e0a\u5b58\u5728\u8bb8\u591a\u79cd\u4e8c\u53c9\u6811\u90fd\u7b26\u5408\u8be5\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u3002\u663e\u7136\uff0c\u8fd9\u79cd\u60c5\u51b5\u65e0\u6cd5\u4f7f\u7528\u6570\u7ec4\u6765\u5b58\u50a8\u4e8c\u53c9\u6811\u3002

Fig. \u7ed9\u5b9a\u6570\u7ec4\u5bf9\u5e94\u591a\u79cd\u4e8c\u53c9\u6811\u53ef\u80fd\u6027

\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8003\u8651\u6309\u7167\u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u5f62\u5f0f\u6765\u8868\u793a\u6240\u6709\u4e8c\u53c9\u6811\uff0c\u5373\u5728\u5e8f\u5217\u4e2d\u4f7f\u7528\u7279\u6b8a\u7b26\u53f7\u6765\u663e\u5f0f\u5730\u8868\u793a\u201c\u7a7a\u4f4d\u201d\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8fd9\u6837\u5904\u7406\u540e\uff0c\u5e8f\u5217\uff08\u6570\u7ec4\uff09\u5c31\u53ef\u4ee5\u552f\u4e00\u8868\u793a\u4e8c\u53c9\u6811\u4e86\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 int \u7684\u5305\u88c5\u7c7b Integer \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 null \u6765\u6807\u8bb0\u7a7a\u4f4d\nInteger[] tree = { 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 };\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4e3a\u4e86\u7b26\u5408\u6570\u636e\u7c7b\u578b\u4e3a int \uff0c\u4f7f\u7528 int \u6700\u5927\u503c\u6807\u8bb0\u7a7a\u4f4d\n// \u8be5\u65b9\u6cd5\u7684\u4f7f\u7528\u524d\u63d0\u662f\u6ca1\u6709\u7ed3\u70b9\u7684\u503c = INT_MAX\nvector<int> tree = { 1, 2, 3, 4, INT_MAX, 6, 7, 8, 9, INT_MAX, INT_MAX, 12, INT_MAX, INT_MAX, 15 };\n
\"\"\" \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a \"\"\"\n# \u76f4\u63a5\u4f7f\u7528 None \u6765\u8868\u793a\u7a7a\u4f4d\ntree = [1, 2, 3, 4, None, 6, 7, 8, 9, None, None, 12, None, None, 15]\n
\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u76f4\u63a5\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u4f4d\nlet tree = [1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15];\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u76f4\u63a5\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u4f4d\nlet tree: (number | null)[] = [1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15];\n
\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 int? \u53ef\u7a7a\u7c7b\u578b \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 null \u6765\u6807\u8bb0\u7a7a\u4f4d\nint?[] tree = { 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 };\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 Int? \u53ef\u7a7a\u7c7b\u578b \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 nil \u6765\u6807\u8bb0\u7a7a\u4f4d\nlet tree: [Int?] = [1, 2, 3, 4, nil, 6, 7, 8, 9, nil, nil, 12, nil, nil, 15]\n
\n

Fig. \u4efb\u610f\u7c7b\u578b\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u56de\u987e\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u7684\u5b9a\u4e49\uff0c\u5176\u53ea\u6709\u6700\u5e95\u5c42\u6709\u7a7a\u7ed3\u70b9\uff0c\u5e76\u4e14\u6700\u5e95\u5c42\u7684\u7ed3\u70b9\u5c3d\u91cf\u9760\u5de6\uff0c\u56e0\u800c\u6240\u6709\u7a7a\u7ed3\u70b9\u90fd\u4e00\u5b9a\u51fa\u73b0\u5728\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u672b\u5c3e\u3002\u56e0\u4e3a\u6211\u4eec\u5148\u9a8c\u5730\u786e\u5b9a\u4e86\u7a7a\u4f4d\u7684\u4f4d\u7f6e\uff0c\u6240\u4ee5\u5728\u4f7f\u7528\u6570\u7ec4\u8868\u793a\u5b8c\u5168\u4e8c\u53c9\u6811\u65f6\uff0c\u53ef\u4ee5\u7701\u7565\u5b58\u50a8\u201c\u7a7a\u4f4d\u201d\u3002\u56e0\u6b64\uff0c\u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u4f7f\u7528\u6570\u7ec4\u6765\u8868\u793a\u3002

Fig. \u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u6570\u7ec4\u8868\u793a\u6709\u4e24\u4e2a\u4f18\u70b9\uff1a \u4e00\u662f\u4e0d\u9700\u8981\u5b58\u50a8\u6307\u9488\uff0c\u8282\u7701\u7a7a\u95f4\uff1b\u4e8c\u662f\u53ef\u4ee5\u968f\u673a\u8bbf\u95ee\u7ed3\u70b9\u3002\u7136\u800c\uff0c\u5f53\u4e8c\u53c9\u6811\u4e2d\u7684\u201c\u7a7a\u4f4d\u201d\u5f88\u591a\u65f6\uff0c\u6570\u7ec4\u4e2d\u53ea\u5305\u542b\u5f88\u5c11\u7ed3\u70b9\u7684\u6570\u636e\uff0c\u7a7a\u95f4\u5229\u7528\u7387\u5f88\u4f4e\u3002

"},{"location":"chapter_tree/binary_tree_traversal/","title":"7.2. \u00a0 \u4e8c\u53c9\u6811\u904d\u5386","text":"

\u4ece\u7269\u7406\u7ed3\u6784\u89d2\u5ea6\u770b\uff0c\u6811\u662f\u4e00\u79cd\u57fa\u4e8e\u94fe\u8868\u7684\u6570\u636e\u7ed3\u6784\uff0c\u56e0\u6b64\u904d\u5386\u65b9\u5f0f\u4e5f\u662f\u901a\u8fc7\u6307\u9488\uff08\u5373\u5f15\u7528\uff09\u9010\u4e2a\u904d\u5386\u7ed3\u70b9\u3002\u540c\u65f6\uff0c\u6811\u8fd8\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u8fd9\u5bfc\u81f4\u904d\u5386\u6811\u6bd4\u904d\u5386\u94fe\u8868\u66f4\u52a0\u590d\u6742\uff0c\u9700\u8981\u4f7f\u7528\u641c\u7d22\u7b97\u6cd5\u6765\u5b9e\u73b0\u3002

\u5e38\u89c1\u7684\u4e8c\u53c9\u6811\u904d\u5386\u65b9\u5f0f\u6709\u5c42\u5e8f\u904d\u5386\u3001\u524d\u5e8f\u904d\u5386\u3001\u4e2d\u5e8f\u904d\u5386\u3001\u540e\u5e8f\u904d\u5386\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#721","title":"7.2.1. \u00a0 \u5c42\u5e8f\u904d\u5386","text":"

\u300c\u5c42\u5e8f\u904d\u5386 Level-Order Traversal\u300d\u4ece\u9876\u81f3\u5e95\u3001\u4e00\u5c42\u4e00\u5c42\u5730\u904d\u5386\u4e8c\u53c9\u6811\uff0c\u5e76\u5728\u6bcf\u5c42\u4e2d\u6309\u7167\u4ece\u5de6\u5230\u53f3\u7684\u987a\u5e8f\u8bbf\u95ee\u7ed3\u70b9\u3002

\u5c42\u5e8f\u904d\u5386\u672c\u8d28\u4e0a\u662f\u300c\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22 Breadth-First Traversal\u300d\uff0c\u5176\u4f53\u73b0\u7740\u4e00\u79cd\u201c\u4e00\u5708\u4e00\u5708\u5411\u5916\u201d\u7684\u5c42\u8fdb\u904d\u5386\u65b9\u5f0f\u3002

Fig. \u4e8c\u53c9\u6811\u7684\u5c42\u5e8f\u904d\u5386

"},{"location":"chapter_tree/binary_tree_traversal/#_1","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u4e00\u822c\u501f\u52a9\u300c\u961f\u5217\u300d\u6765\u5b9e\u73b0\u3002\u961f\u5217\u7684\u89c4\u5219\u662f\u201c\u5148\u8fdb\u5148\u51fa\u201d\uff0c\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7684\u89c4\u5219\u662f \u201d\u4e00\u5c42\u5c42\u5e73\u63a8\u201c \uff0c\u4e24\u8005\u80cc\u540e\u7684\u601d\u60f3\u662f\u4e00\u81f4\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree_bfs.java
/* \u5c42\u5e8f\u904d\u5386 */\nList<Integer> levelOrder(TreeNode root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nQueue<TreeNode> queue = new LinkedList<>() {{ add(root); }};\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nList<Integer> list = new ArrayList<>();\nwhile (!queue.isEmpty()) {\nTreeNode node = queue.poll();  // \u961f\u5217\u51fa\u961f\nlist.add(node.val);            // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null)\nqueue.offer(node.left);    // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right != null)\nqueue.offer(node.right);   // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.cpp
/* \u5c42\u5e8f\u904d\u5386 */\nvector<int> levelOrder(TreeNode* root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue<TreeNode*> queue;\nqueue.push(root);\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvector<int> vec;\nwhile (!queue.empty()) {\nTreeNode* node = queue.front();\nqueue.pop();                 // \u961f\u5217\u51fa\u961f\nvec.push_back(node->val);    // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node->left != nullptr)\nqueue.push(node->left);  // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node->right != nullptr)\nqueue.push(node->right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn vec;\n}\n
binary_tree_bfs.py
def level_order(root: Optional[TreeNode]) -> List[int]:\n\"\"\" \u5c42\u5e8f\u904d\u5386 \"\"\"\n# \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue: Deque[TreeNode] = collections.deque()\nqueue.append(root)\n# \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nres: List[int] = []\nwhile queue:\nnode: TreeNode = queue.popleft() # \u961f\u5217\u51fa\u961f\nres.append(node.val)             # \u4fdd\u5b58\u7ed3\u70b9\u503c\nif node.left is not None:\nqueue.append(node.left)      # \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif node.right is not None:\nqueue.append(node.right)     # \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\nreturn res\n
binary_tree_bfs.go
/* \u5c42\u5e8f\u904d\u5386 */\nfunc levelOrder(root *TreeNode) []int {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue := list.New()\nqueue.PushBack(root)\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5207\u7247\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nnums := make([]int, 0)\nfor queue.Len() > 0 {\n// poll\nnode := queue.Remove(queue.Front()).(*TreeNode)\n// \u4fdd\u5b58\u7ed3\u70b9\u503c\nnums = append(nums, node.Val)\nif node.Left != nil {\n// \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nqueue.PushBack(node.Left)\n}\nif node.Right != nil {\n// \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\nqueue.PushBack(node.Right)\n}\n}\nreturn nums\n}\n
binary_tree_bfs.js
/* \u5c42\u5e8f\u904d\u5386 */\nfunction levelOrder(root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst queue = [root];\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nconst list = [];\nwhile (queue.length) {\nlet node = queue.shift();   // \u961f\u5217\u51fa\u961f\nlist.push(node.val);        // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left)\nqueue.push(node.left);  // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right)\nqueue.push(node.right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.ts
/* \u5c42\u5e8f\u904d\u5386 */\nfunction levelOrder(root: TreeNode | null): number[] {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst queue = [root];\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nconst list: number[] = [];\nwhile (queue.length) {\nlet node = queue.shift() as TreeNode; // \u961f\u5217\u51fa\u961f\nlist.push(node.val); // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left) {\nqueue.push(node.left); // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif (node.right) {\nqueue.push(node.right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\n}\nreturn list;\n}\n
binary_tree_bfs.c
[class]{}-[func]{levelOrder}\n
binary_tree_bfs.cs
/* \u5c42\u5e8f\u904d\u5386 */\nList<int> levelOrder(TreeNode root)\n{\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nQueue<TreeNode> queue = new();\nqueue.Enqueue(root);\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nList<int> list = new();\nwhile (queue.Count != 0)\n{\nTreeNode node = queue.Dequeue(); // \u961f\u5217\u51fa\u961f\nlist.Add(node.val);              // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null)\nqueue.Enqueue(node.left);    // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right != null)\nqueue.Enqueue(node.right);   // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.swift
/* \u5c42\u5e8f\u904d\u5386 */\nfunc levelOrder(root: TreeNode) -> [Int] {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nvar queue: [TreeNode] = [root]\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvar list: [Int] = []\nwhile !queue.isEmpty {\nlet node = queue.removeFirst() // \u961f\u5217\u51fa\u961f\nlist.append(node.val) // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif let left = node.left {\nqueue.append(left) // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif let right = node.right {\nqueue.append(right) // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\n}\nreturn list\n}\n
binary_tree_bfs.zig
// \u5c42\u5e8f\u904d\u5386\nfn levelOrder(comptime T: type, mem_allocator: std.mem.Allocator, root: *inc.TreeNode(T)) !std.ArrayList(T) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst L = std.TailQueue(*inc.TreeNode(T));\nvar queue = L{};\nvar root_node = try mem_allocator.create(L.Node);\nroot_node.data = root;\nqueue.append(root_node); // \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvar list = std.ArrayList(T).init(std.heap.page_allocator);\nwhile (queue.len > 0) {\nvar queue_node = queue.popFirst().?;    // \u961f\u5217\u51fa\u961f\nvar node = queue_node.data;\ntry list.append(node.val);              // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null) {\nvar tmp_node = try mem_allocator.create(L.Node);\ntmp_node.data = node.left.?;\nqueue.append(tmp_node);             // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif (node.right != null) {\nvar tmp_node = try mem_allocator.create(L.Node);\ntmp_node.data = node.right.?;\nqueue.append(tmp_node);             // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}        }\nreturn list;\n}\n
"},{"location":"chapter_tree/binary_tree_traversal/#_2","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u6240\u6709\u7ed3\u70b9\u88ab\u8bbf\u95ee\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d \\(n\\) \u4e3a\u7ed3\u70b9\u6570\u91cf\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a\u5f53\u4e3a\u6ee1\u4e8c\u53c9\u6811\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u904d\u5386\u5230\u6700\u5e95\u5c42\u524d\uff0c\u961f\u5217\u4e2d\u6700\u591a\u540c\u65f6\u5b58\u5728 \\(\\frac{n + 1}{2}\\) \u4e2a\u7ed3\u70b9\uff0c\u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#722","title":"7.2.2. \u00a0 \u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386","text":"

\u76f8\u5bf9\u5730\uff0c\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386\u7686\u5c5e\u4e8e\u300c\u6df1\u5ea6\u4f18\u5148\u904d\u5386 Depth-First Traversal\u300d\uff0c\u5176\u4f53\u73b0\u7740\u4e00\u79cd\u201c\u5148\u8d70\u5230\u5c3d\u5934\uff0c\u518d\u56de\u5934\u7ee7\u7eed\u201d\u7684\u56de\u6eaf\u904d\u5386\u65b9\u5f0f\u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5de6\u4fa7\u662f\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u7684\u793a\u610f\u56fe\uff0c\u53f3\u4e0a\u65b9\u662f\u5bf9\u5e94\u7684\u9012\u5f52\u5b9e\u73b0\u4ee3\u7801\u3002\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u5c31\u50cf\u662f\u7ed5\u7740\u6574\u4e2a\u4e8c\u53c9\u6811\u7684\u5916\u56f4\u201c\u8d70\u201d\u4e00\u5708\uff0c\u8d70\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5728\u6bcf\u4e2a\u7ed3\u70b9\u90fd\u4f1a\u9047\u5230\u4e09\u4e2a\u4f4d\u7f6e\uff0c\u5206\u522b\u5bf9\u5e94\u524d\u5e8f\u904d\u5386\u3001\u4e2d\u5e8f\u904d\u5386\u3001\u540e\u5e8f\u904d\u5386\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386

\u4f4d\u7f6e \u542b\u4e49 \u6b64\u5904\u8bbf\u95ee\u7ed3\u70b9\u65f6\u5bf9\u5e94 \u6a59\u8272\u5706\u5708\u5904 \u521a\u8fdb\u5165\u6b64\u7ed3\u70b9\uff0c\u5373\u5c06\u8bbf\u95ee\u8be5\u7ed3\u70b9\u7684\u5de6\u5b50\u6811 \u524d\u5e8f\u904d\u5386 Pre-Order Traversal \u84dd\u8272\u5706\u5708\u5904 \u5df2\u8bbf\u95ee\u5b8c\u5de6\u5b50\u6811\uff0c\u5373\u5c06\u8bbf\u95ee\u53f3\u5b50\u6811 \u4e2d\u5e8f\u904d\u5386 In-Order Traversal \u7d2b\u8272\u5706\u5708\u5904 \u5df2\u8bbf\u95ee\u5b8c\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\uff0c\u5373\u5c06\u8fd4\u56de \u540e\u5e8f\u904d\u5386 Post-Order Traversal"},{"location":"chapter_tree/binary_tree_traversal/#_3","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree_dfs.java
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.add(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.add(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.add(root.val);\n}\n
binary_tree_dfs.cpp
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nvec.push_back(root->val);\npreOrder(root->left);\npreOrder(root->right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root->left);\nvec.push_back(root->val);\ninOrder(root->right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root->left);\npostOrder(root->right);\nvec.push_back(root->val);\n}\n
binary_tree_dfs.py
def pre_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u524d\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nres.append(root.val)\npre_order(root=root.left)\npre_order(root=root.right)\ndef in_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u4e2d\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\nin_order(root=root.left)\nres.append(root.val)\nin_order(root=root.right)\ndef post_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u540e\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npost_order(root=root.left)\npost_order(root=root.right)\nres.append(root.val)\n
binary_tree_dfs.go
/* \u524d\u5e8f\u904d\u5386 */\nfunc preOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nnums = append(nums, node.Val)\npreOrder(node.Left)\npreOrder(node.Right)\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunc inOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(node.Left)\nnums = append(nums, node.Val)\ninOrder(node.Right)\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunc postOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(node.Left)\npostOrder(node.Right)\nnums = append(nums, node.Val)\n}\n
binary_tree_dfs.js
/* \u524d\u5e8f\u904d\u5386 */\nfunction preOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.push(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunction inOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.push(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunction postOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.push(root.val);\n}\n
binary_tree_dfs.ts
/* \u524d\u5e8f\u904d\u5386 */\nfunction preOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.push(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunction inOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.push(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunction postOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.push(root.val);\n}\n
binary_tree_dfs.c
[class]{}-[func]{preOrder}\n[class]{}-[func]{inOrder}\n[class]{}-[func]{postOrder}\n
binary_tree_dfs.cs
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.Add(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.Add(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.Add(root.val);\n}\n
binary_tree_dfs.swift
/* \u524d\u5e8f\u904d\u5386 */\nfunc preOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.append(root.val)\npreOrder(root: root.left)\npreOrder(root: root.right)\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunc inOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root: root.left)\nlist.append(root.val)\ninOrder(root: root.right)\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunc postOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root: root.left)\npostOrder(root: root.right)\nlist.append(root.val)\n}\n
binary_tree_dfs.zig
// \u524d\u5e8f\u904d\u5386\nfn preOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\ntry list.append(root.?.val);\ntry preOrder(T, root.?.left);\ntry preOrder(T, root.?.right);\n}\n// \u4e2d\u5e8f\u904d\u5386\nfn inOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ntry inOrder(T, root.?.left);\ntry list.append(root.?.val);\ntry inOrder(T, root.?.right);\n}\n// \u540e\u5e8f\u904d\u5386\nfn postOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\ntry postOrder(T, root.?.left);\ntry postOrder(T, root.?.right);\ntry list.append(root.?.val);\n}\n

Note

\u4f7f\u7528\u5faa\u73af\u4e00\u6837\u53ef\u4ee5\u5b9e\u73b0\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386\uff0c\u4f46\u4ee3\u7801\u76f8\u5bf9\u7e41\u7410\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#_4","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u6240\u6709\u7ed3\u70b9\u88ab\u8bbf\u95ee\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d \\(n\\) \u4e3a\u7ed3\u70b9\u6570\u91cf\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a\u5f53\u6811\u9000\u5316\u4e3a\u94fe\u8868\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u9012\u5f52\u6df1\u5ea6\u8fbe\u5230 \\(n\\) \uff0c\u7cfb\u7edf\u4f7f\u7528 \\(O(n)\\) \u6808\u5e27\u7a7a\u95f4\u3002

"},{"location":"chapter_tree/summary/","title":"7.5. \u00a0 \u5c0f\u7ed3","text":""},{"location":"chapter_tree/summary/#_1","title":"\u4e8c\u53c9\u6811","text":"
  • \u4e8c\u53c9\u6811\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u7740\u201c\u4e00\u5206\u4e3a\u4e8c\u201d\u7684\u5206\u6cbb\u903b\u8f91\u3002\u4e8c\u53c9\u6811\u7684\u7ed3\u70b9\u5305\u542b\u300c\u503c\u300d\u548c\u4e24\u4e2a\u300c\u6307\u9488\u300d\uff0c\u5206\u522b\u6307\u5411\u5de6\u5b50\u7ed3\u70b9\u548c\u53f3\u5b50\u7ed3\u70b9\u3002
  • \u9009\u5b9a\u4e8c\u53c9\u6811\u4e2d\u67d0\u7ed3\u70b9\uff0c\u5c06\u5176\u5de6\uff08\u53f3\uff09\u5b50\u7ed3\u70b9\u4ee5\u4e0b\u5f62\u6210\u7684\u6811\u79f0\u4e3a\u5de6\uff08\u53f3\uff09\u5b50\u6811\u3002
  • \u4e8c\u53c9\u6811\u7684\u672f\u8bed\u8f83\u591a\uff0c\u5305\u62ec\u6839\u7ed3\u70b9\u3001\u53f6\u7ed3\u70b9\u3001\u5c42\u3001\u5ea6\u3001\u8fb9\u3001\u9ad8\u5ea6\u3001\u6df1\u5ea6\u7b49\u3002
  • \u4e8c\u53c9\u6811\u7684\u521d\u59cb\u5316\u3001\u7ed3\u70b9\u63d2\u5165\u3001\u7ed3\u70b9\u5220\u9664\u64cd\u4f5c\u4e0e\u94fe\u8868\u7684\u64cd\u4f5c\u65b9\u6cd5\u7c7b\u4f3c\u3002
  • \u5e38\u89c1\u7684\u4e8c\u53c9\u6811\u7c7b\u578b\u5305\u62ec\u5b8c\u7f8e\u4e8c\u53c9\u6811\u3001\u5b8c\u5168\u4e8c\u53c9\u6811\u3001\u5b8c\u6ee1\u4e8c\u53c9\u6811\u3001\u5e73\u8861\u4e8c\u53c9\u6811\u3002\u5b8c\u7f8e\u4e8c\u53c9\u6811\u662f\u7406\u60f3\u72b6\u6001\uff0c\u94fe\u8868\u5219\u662f\u9000\u5316\u540e\u7684\u6700\u5dee\u72b6\u6001\u3002
  • \u4e8c\u53c9\u6811\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u8868\u793a\uff0c\u5177\u4f53\u505a\u6cd5\u662f\u5c06\u7ed3\u70b9\u503c\u548c\u7a7a\u4f4d\u6309\u7167\u5c42\u5e8f\u904d\u5386\u7684\u987a\u5e8f\u6392\u5217\uff0c\u5e76\u57fa\u4e8e\u7236\u7ed3\u70b9\u548c\u5b50\u7ed3\u70b9\u4e4b\u95f4\u7684\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u5b9e\u73b0\u6307\u9488\u3002
"},{"location":"chapter_tree/summary/#_2","title":"\u4e8c\u53c9\u6811\u904d\u5386","text":"
  • \u4e8c\u53c9\u6811\u5c42\u5e8f\u904d\u5386\u662f\u4e00\u79cd\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22\uff0c\u4f53\u73b0\u7740\u201c\u4e00\u5708\u4e00\u5708\u5411\u5916\u201d\u7684\u5c42\u8fdb\u5f0f\u904d\u5386\u65b9\u5f0f\uff0c\u901a\u5e38\u501f\u52a9\u961f\u5217\u6765\u5b9e\u73b0\u3002
  • \u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386\u662f\u6df1\u5ea6\u4f18\u5148\u641c\u7d22\uff0c\u4f53\u73b0\u7740\u201c\u8d70\u5230\u5934\u3001\u518d\u56de\u5934\u7ee7\u7eed\u201d\u7684\u56de\u6eaf\u904d\u5386\u65b9\u5f0f\uff0c\u901a\u5e38\u4f7f\u7528\u9012\u5f52\u5b9e\u73b0\u3002
"},{"location":"chapter_tree/summary/#_3","title":"\u4e8c\u53c9\u641c\u7d22\u6811","text":"
  • \u4e8c\u53c9\u641c\u7d22\u6811\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u5143\u7d20\u67e5\u627e\u6570\u636e\u7ed3\u6784\uff0c\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(\\log n)\\) \u3002\u4e8c\u53c9\u641c\u7d22\u6811\u9000\u5316\u4e3a\u94fe\u8868\u540e\uff0c\u5404\u9879\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \uff0c\u56e0\u6b64\u5982\u4f55\u907f\u514d\u9000\u5316\u662f\u975e\u5e38\u91cd\u8981\u7684\u8bfe\u9898\u3002
  • AVL \u6811\u53c8\u79f0\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u5176\u901a\u8fc7\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u5f97\u5728\u4e0d\u65ad\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u4ecd\u7136\u53ef\u4ee5\u4fdd\u6301\u4e8c\u53c9\u6811\u7684\u5e73\u8861\uff08\u4e0d\u9000\u5316\uff09\u3002
  • AVL \u6811\u7684\u65cb\u8f6c\u64cd\u4f5c\u5206\u4e3a\u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u3001\u5148\u5de6\u65cb\u540e\u53f3\u65cb\u3002\u5728\u63d2\u5165\u6216\u5220\u9664\u7ed3\u70b9\u540e\uff0cAVL \u6811\u4f1a\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6811\u6062\u590d\u5e73\u8861\u3002
"}]} \ No newline at end of file +{"config":{"lang":["ja"],"separator":"[\\s\\-\uff0c\u3002]+","pipeline":["stemmer"]},"docs":[{"location":"","title":"Home","text":"

\u300a Hello \u7b97\u6cd5 \u300b

\u52a8\u753b\u56fe\u89e3\u3001\u80fd\u8fd0\u884c\u3001\u53ef\u63d0\u95ee\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5feb\u901f\u5165\u95e8\u6559\u7a0b

@Krahets

\u63a8\u8350\u8bed

Quote

\u201c\u4e00\u672c\u901a\u4fd7\u6613\u61c2\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5165\u95e8\u4e66\uff0c\u5f15\u5bfc\u8bfb\u8005\u624b\u8111\u5e76\u7528\u5730\u5b66\u4e60\uff0c\u5f3a\u70c8\u63a8\u8350\u7b97\u6cd5\u521d\u5b66\u8005\u9605\u8bfb\u3002\u201d

\u2014\u2014 \u9093\u4fca\u8f89\uff0c\u6e05\u534e\u5927\u5b66\u8ba1\u7b97\u673a\u7cfb\u6559\u6388

Quote

\u201c\u5982\u679c\u6211\u5f53\u5e74\u5b66\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u65f6\u5019\u6709\u300aHello \u7b97\u6cd5\u300b\uff0c\u5b66\u8d77\u6765\u5e94\u8be5\u4f1a\u7b80\u5355 10 \u500d\uff01\u201d

\u2014\u2014 \u674e\u6c90\uff0c\u4e9a\u9a6c\u900a\u8d44\u6df1\u9996\u5e2d\u79d1\u5b66\u5bb6

\u300c\u5168\u4e66\u52a8\u753b\u56fe\u89e3\u300d

\u5185\u5bb9\u6e05\u6670\u6613\u61c2\u3001\u5b66\u4e60\u66f2\u7ebf\u5e73\u6ed1\u7535\u8111\u3001\u5e73\u677f\u3001\u624b\u673a\u5168\u7ec8\u7aef\u9605\u8bfb

\"A picture is worth a thousand words.\"

\u201c\u4e00\u56fe\u80dc\u5343\u8a00\u201d

\u300c\u4ee3\u7801\u4e00\u952e\u8fd0\u884c\u300d

\u63d0\u4f9b\u5404\u4e2a\u7b97\u6cd5\u4e0e\u6570\u636e\u7ed3\u6784\u7684\u7b80\u6d01\u5b9e\u73b0\u4e0e\u6d4b\u8bd5\u6837\u4f8b\uff0c\u7686\u53ef\u76f4\u63a5\u8fd0\u884c\u652f\u6301 Java, C++, Python, Go, JS, TS, C#, Swift, Zig \u7b49\u8bed\u8a00

\"Talk is cheap. Show me the code.\"

\u201c\u5c11\u5439\u725b\uff0c\u770b\u4ee3\u7801\u201d

\u300c\u53ef\u8ba8\u8bba\u4e0e\u63d0\u95ee\u300d

\u9f13\u52b1\u5c0f\u4f19\u4f34\u4eec\u4e92\u5e2e\u4e92\u52a9\u3001\u5171\u540c\u6210\u957f\u63d0\u95ee\u4e0e\u8bc4\u8bba\u4e00\u822c\u80fd\u5728\u4e24\u65e5\u5185\u5f97\u5230\u56de\u590d

\u201c\u8ffd\u98ce\u8d76\u6708\u83ab\u505c\u7559\uff0c\u5e73\u829c\u5c3d\u5904\u662f\u6625\u5c71\u201d

\u4e00\u8d77\u52a0\u6cb9\uff01

\u5e8f

\u4e24\u5e74\u524d\uff0c\u6211\u5728\u529b\u6263\u4e0a\u5206\u4eab\u4e86\u300a\u5251\u6307 Offer\u300b\u7cfb\u5217\u9898\u89e3\uff0c\u53d7\u5230\u4e86\u5f88\u591a\u5c0f\u4f19\u4f34\u7684\u559c\u7231\u4e0e\u652f\u6301\u3002\u5728\u6b64\u671f\u95f4\uff0c\u6211\u4e5f\u56de\u590d\u4e86\u8bb8\u591a\u8bfb\u8005\u7684\u8bc4\u8bba\u95ee\u9898\uff0c\u9047\u5230\u6700\u591a\u7684\u95ee\u9898\u662f\u201c\u5982\u4f55\u5165\u95e8\u5b66\u4e60\u7b97\u6cd5\u201d\u3002\u6211\u6e10\u6e10\u4e5f\u5bf9\u8fd9\u4e2a\u95ee\u9898\u597d\u5947\u4e86\u8d77\u6765\u3002

\u4e24\u773c\u4e00\u62b9\u9ed1\u5730\u5237\u9898\u5e94\u8be5\u662f\u6700\u53d7\u6b22\u8fce\u7684\u65b9\u5f0f\uff0c\u7b80\u5355\u7c97\u66b4\u4e14\u6709\u6548\u3002\u7136\u800c\uff0c\u5237\u9898\u5c31\u5982\u540c\u73a9\u201c\u626b\u96f7\u201d\u6e38\u620f\uff0c\u81ea\u5b66\u80fd\u529b\u5f3a\u7684\u540c\u5b66\u80fd\u591f\u987a\u5229\u5730\u5c06\u5730\u96f7\u9010\u4e2a\u6392\u6389\uff0c\u800c\u57fa\u7840\u4e0d\u8db3\u7684\u540c\u5b66\u5f88\u53ef\u80fd\u88ab\u70b8\u7684\u6ee1\u5934\u662f\u5305\uff0c\u5e76\u5728\u53d7\u632b\u4e2d\u6b65\u6b65\u9000\u7f29\u3002\u901a\u8bfb\u6559\u6750\u4e66\u7c4d\u4e5f\u662f\u5e38\u7528\u65b9\u6cd5\uff0c\u4f46\u5bf9\u4e8e\u9762\u5411\u6c42\u804c\u7684\u540c\u5b66\u6765\u8bf4\uff0c\u6bd5\u4e1a\u5b63\u3001\u6295\u9012\u7b80\u5386\u3001\u5e94\u4ed8\u7b14\u9762\u8bd5\u5df2\u7ecf\u5360\u7528\u5927\u90e8\u5206\u7cbe\u529b\uff0c\u539a\u91cd\u7684\u4e66\u672c\u4e5f\u56e0\u6b64\u6210\u4e3a\u5de8\u5927\u7684\u6311\u6218\u3002

\u5982\u679c\u4f60\u4e5f\u6709\u4e0a\u8ff0\u70e6\u607c\uff0c\u90a3\u4e48\u5f88\u5e78\u8fd0\u8fd9\u672c\u4e66\u627e\u5230\u4e86\u4f60\u3002\u672c\u4e66\u662f\u6211\u5bf9\u4e8e\u8be5\u95ee\u9898\u7ed9\u51fa\u7684\u7b54\u6848\uff0c\u867d\u7136\u4e0d\u4e00\u5b9a\u6b63\u786e\uff0c\u4f46\u81f3\u5c11\u4ee3\u8868\u4e00\u6b21\u79ef\u6781\u7684\u5c1d\u8bd5\u3002\u8fd9\u672c\u4e66\u867d\u7136\u4e0d\u8db3\u4ee5\u8ba9\u4f60\u76f4\u63a5\u62ff\u5230 Offer \uff0c\u4f46\u4f1a\u5f15\u5bfc\u4f60\u63a2\u7d22\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u201c\u77e5\u8bc6\u5730\u56fe\u201d\uff0c\u5e26\u4f60\u4e86\u89e3\u4e0d\u540c\u201c\u5730\u96f7\u201d\u7684\u5f62\u72b6\u5927\u5c0f\u548c\u5206\u5e03\u4f4d\u7f6e\uff0c\u8ba9\u4f60\u638c\u63e1\u5404\u79cd\u201c\u6392\u96f7\u65b9\u6cd5\u201d\u3002\u6709\u4e86\u8fd9\u4e9b\u672c\u9886\uff0c\u76f8\u4fe1\u4f60\u53ef\u4ee5\u66f4\u52a0\u5f97\u5fc3\u5e94\u624b\u5730\u5237\u9898\u4e0e\u9605\u8bfb\u6587\u732e\uff0c\u9010\u6b65\u642d\u5efa\u8d77\u5b8c\u6574\u7684\u77e5\u8bc6\u4f53\u7cfb\u3002

\u4f5c\u8005\u7b80\u4ecb

\u9773\u5b87\u680b (Krahets)\uff0c\u5927\u5382\u9ad8\u7ea7\u7b97\u6cd5\u5de5\u7a0b\u5e08\uff0c\u4e0a\u6d77\u4ea4\u901a\u5927\u5b66\u7855\u58eb\u3002\u529b\u6263\uff08LeetCode\uff09\u5168\u7f51\u9605\u8bfb\u91cf\u6700\u9ad8\u535a\u4e3b\uff0c\u5176 LeetBook\u300a\u56fe\u89e3\u7b97\u6cd5\u6570\u636e\u7ed3\u6784\u300b\u5df2\u88ab\u8ba2\u9605 22 \u4e07\u672c\u3002

\u81f4\u8c22

\u672c\u4e66\u5728\u5f00\u6e90\u793e\u533a\u7684\u7fa4\u7b56\u7fa4\u529b\u4e0b\u9010\u6b65\u6210\u957f\uff0c\u611f\u8c22\u6bcf\u4e00\u4f4d\u64b0\u7a3f\u4eba\uff0c\u662f\u4ed6\u4eec\u7684\u65e0\u79c1\u5949\u732e\u8ba9\u8fd9\u672c\u4e66\u53d8\u5f97\u66f4\u597d\uff0c\u4ed6\u4eec\u662f\uff08\u6309\u7167 GitHub \u81ea\u52a8\u751f\u6210\u7684\u987a\u5e8f\uff09\uff1a

\u672c\u4e66\u7684\u4ee3\u7801\u5ba1\u9605\u5de5\u4f5c\u7531 justin\u2010tse, krahets, nuomi1, Reanon, sjinzh \u5b8c\u6210\uff0c\u611f\u8c22\u4ed6\u4eec\u7684\u8f9b\u52e4\u4ed8\u51fa\uff01

justin-tseJS / TS krahetsJava / Python nuomi1Swift ReanonGo / C sjinzhRust / Zig"},{"location":"chapter_appendix/contribution/","title":"12.2. \u00a0 \u4e00\u8d77\u53c2\u4e0e\u521b\u4f5c","text":"

\u5f00\u6e90\u7684\u9b45\u529b

\u7eb8\u8d28\u4e66\u7c4d\u7684\u4e24\u6b21\u5370\u5237\u7684\u95f4\u9694\u65f6\u95f4\u5f80\u5f80\u9700\u8981\u6570\u5e74\uff0c\u5185\u5bb9\u66f4\u65b0\u975e\u5e38\u4e0d\u65b9\u4fbf\u3002\u4f46\u5728\u672c\u5f00\u6e90 HTML \u4e66\u4e2d\uff0c\u5185\u5bb9\u66f4\u8fed\u7684\u65f6\u95f4\u88ab\u7f29\u77ed\u81f3\u6570\u65e5\u751a\u81f3\u51e0\u4e2a\u5c0f\u65f6\u3002

\u7531\u4e8e\u4f5c\u8005\u6c34\u5e73\u6709\u9650\uff0c\u4e66\u4e2d\u5185\u5bb9\u96be\u514d\u758f\u6f0f\u8c2c\u8bef\uff0c\u8bf7\u60a8\u8c05\u89e3\u3002\u5982\u679c\u53d1\u73b0\u7b14\u8bef\u3001\u65e0\u6548\u94fe\u63a5\u3001\u5185\u5bb9\u7f3a\u5931\u3001\u6587\u5b57\u6b67\u4e49\u3001\u89e3\u91ca\u4e0d\u6e05\u6670\u3001\u884c\u6587\u7ed3\u6784\u4e0d\u5408\u7406\u7b49\u95ee\u9898\uff0c\u8bf7\u60a8\u5e2e\u5fd9\u4fee\u6b63\uff0c\u4ee5\u5e2e\u52a9\u5176\u4ed6\u8bfb\u8005\u83b7\u53d6\u66f4\u4f18\u8d28\u7684\u5b66\u4e60\u5185\u5bb9\u3002\u6240\u6709\u64b0\u7a3f\u4eba\u5c06\u88ab\u5c55\u793a\u5728\u4ed3\u5e93\u4e0e\u7f51\u7ad9\u4e3b\u9875\uff0c\u4ee5\u611f\u8c22\u4ed6\u4eec\u5bf9\u5f00\u6e90\u793e\u533a\u7684\u65e0\u79c1\u5949\u732e\uff01

"},{"location":"chapter_appendix/contribution/#1221","title":"12.2.1. \u00a0 \u5185\u5bb9\u5fae\u8c03","text":"

\u6bcf\u4e2a\u9875\u9762\u7684\u53f3\u4e0a\u89d2\u90fd\u6709\u4e00\u4e2a\u300c\u7f16\u8f91\u300d\u56fe\u6807\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u4fee\u6539\u6587\u5b57\u6216\u4ee3\u7801\uff1a

  1. \u70b9\u51fb\u7f16\u8f91\u6309\u94ae\uff0c\u5982\u679c\u9047\u5230\u63d0\u793a\u201c\u9700\u8981 Fork \u6b64\u4ed3\u5e93\u201d\uff0c\u8bf7\u901a\u8fc7\uff1b
  2. \u4fee\u6539 Markdown \u6e90\u6587\u4ef6\u5185\u5bb9\uff0c\u5e76\u68c0\u67e5\u5185\u5bb9\u6b63\u786e\u6027\uff0c\u5c3d\u91cf\u4fdd\u6301\u6392\u7248\u683c\u5f0f\u7edf\u4e00\uff1b
  3. \u5728\u9875\u9762\u5e95\u90e8\u586b\u5199\u66f4\u6539\u8bf4\u660e\uff0c\u7136\u540e\u5355\u51fb\u201cPropose file change\u201d\u6309\u94ae\uff1b\u9875\u9762\u8df3\u8f6c\u540e\uff0c\u70b9\u51fb\u201cCreate pull request\u201d\u6309\u94ae\u53d1\u8d77\u62c9\u53d6\u8bf7\u6c42\u5373\u53ef\u3002

Fig. \u9875\u9762\u7f16\u8f91\u6309\u952e

\u56fe\u7247\u65e0\u6cd5\u76f4\u63a5\u4fee\u6539\uff0c\u9700\u8981\u901a\u8fc7\u65b0\u5efa Issue \u6216\u8bc4\u8bba\u7559\u8a00\u6765\u63cf\u8ff0\u56fe\u7247\u95ee\u9898\uff0c\u6211\u4f1a\u7b2c\u4e00\u65f6\u95f4\u91cd\u65b0\u753b\u56fe\u5e76\u66ff\u6362\u56fe\u7247\u3002

"},{"location":"chapter_appendix/contribution/#1222","title":"12.2.2. \u00a0 \u5185\u5bb9\u521b\u4f5c","text":"

\u5982\u679c\u60a8\u60f3\u8981\u53c2\u4e0e\u672c\u5f00\u6e90\u9879\u76ee\uff0c\u5305\u62ec\u7ffb\u8bd1\u4ee3\u7801\u81f3\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u3001\u62d3\u5c55\u6587\u7ae0\u5185\u5bb9\u7b49\uff0c\u90a3\u4e48\u9700\u8981\u5b9e\u65bd Pull Request \u5de5\u4f5c\u6d41\u7a0b\uff1a

  1. \u767b\u5f55 GitHub \uff0c\u5e76 Fork \u672c\u4ed3\u5e93 \u81f3\u4e2a\u4eba\u8d26\u53f7\uff1b
  2. \u8fdb\u5165 Fork \u4ed3\u5e93\u7f51\u9875\uff0c\u4f7f\u7528 git clone \u514b\u9686\u8be5\u4ed3\u5e93\u81f3\u672c\u5730\uff1b
  3. \u5728\u672c\u5730\u8fdb\u884c\u5185\u5bb9\u521b\u4f5c\uff0c\u5e76\u901a\u8fc7\u8fd0\u884c\u6d4b\u8bd5\u6765\u9a8c\u8bc1\u4ee3\u7801\u6b63\u786e\u6027\uff1b
  4. \u5c06\u672c\u5730\u66f4\u6539 Commit \uff0c\u5e76 Push \u81f3\u8fdc\u7a0b\u4ed3\u5e93\uff1b
  5. \u5237\u65b0\u4ed3\u5e93\u7f51\u9875\uff0c\u70b9\u51fb\u201cCreate pull request\u201d\u6309\u94ae\u53d1\u8d77\u62c9\u53d6\u8bf7\u6c42\u5373\u53ef\uff1b
"},{"location":"chapter_appendix/contribution/#1223-docker","title":"12.2.3. \u00a0 Docker \u90e8\u7f72","text":"

\u4f60\u53ef\u4ee5\u4f7f\u7528 Docker \u6765\u90e8\u7f72\u672c\u9879\u76ee\u3002\u7a0d\u7b49\u7247\u523b\uff0c\u5373\u53ef\u4f7f\u7528\u6d4f\u89c8\u5668\u6253\u5f00 http://localhost:8000 \u8bbf\u95ee\u672c\u9879\u76ee\u3002

git clone https://github.com/krahets/hello-algo.git\ncd hello-algo\ndocker-compose up -d\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u5220\u9664\u90e8\u7f72\u3002

docker-compose down\n
"},{"location":"chapter_appendix/installation/","title":"12.1. \u00a0 \u7f16\u7a0b\u73af\u5883\u5b89\u88c5","text":""},{"location":"chapter_appendix/installation/#1211-vscode","title":"12.1.1. \u00a0 \u5b89\u88c5 VSCode","text":"

\u672c\u4e66\u63a8\u8350\u4f7f\u7528\u5f00\u6e90\u8f7b\u91cf\u7684 VSCode \u4f5c\u4e3a\u672c\u5730 IDE \uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5 VSCode \u3002

"},{"location":"chapter_appendix/installation/#1212-java","title":"12.1.2. \u00a0 Java \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 OpenJDK\uff08\u7248\u672c\u9700\u6ee1\u8db3 > JDK 9\uff09\u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 java \uff0c\u5b89\u88c5 Java Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1213-cc","title":"12.1.3. \u00a0 C/C++ \u73af\u5883","text":"
  1. Windows \u7cfb\u7edf\u9700\u8981\u5b89\u88c5 MinGW\uff08\u914d\u7f6e\u6559\u7a0b\uff09\uff0cMacOS \u81ea\u5e26 Clang \u65e0\u9700\u5b89\u88c5\u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 c++ \uff0c\u5b89\u88c5 C/C++ Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1214-python","title":"12.1.4. \u00a0 Python \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Miniconda3 \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 python \uff0c\u5b89\u88c5 Python Extension Pack \u3002
"},{"location":"chapter_appendix/installation/#1215-go","title":"12.1.5. \u00a0 Go \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 go \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 go \uff0c\u5b89\u88c5 Go \u3002
  3. \u5feb\u6377\u952e Ctrl + Shift + P \u547c\u51fa\u547d\u4ee4\u680f\uff0c\u8f93\u5165 go \uff0c\u9009\u62e9 Go: Install/Update Tools \uff0c\u5168\u90e8\u52fe\u9009\u5e76\u5b89\u88c5\u5373\u53ef\u3002
"},{"location":"chapter_appendix/installation/#1216-javascript","title":"12.1.6. \u00a0 JavaScript \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 node.js \u3002
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 javascript \uff0c\u5b89\u88c5 JavaScript (ES6) code snippets \u3002
"},{"location":"chapter_appendix/installation/#1217-c","title":"12.1.7. \u00a0 C# \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 .Net 6.0 \uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 c# \uff0c\u5b89\u88c5 c# \u3002
"},{"location":"chapter_appendix/installation/#1218-swift","title":"12.1.8. \u00a0 Swift \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Swift\uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 swift\uff0c\u5b89\u88c5 Swift for Visual Studio Code\u3002
"},{"location":"chapter_appendix/installation/#1219-rust","title":"12.1.9. \u00a0 Rust \u73af\u5883","text":"
  1. \u4e0b\u8f7d\u5e76\u5b89\u88c5 Rust\uff1b
  2. \u5728 VSCode \u7684\u63d2\u4ef6\u5e02\u573a\u4e2d\u641c\u7d22 rust\uff0c\u5b89\u88c5 rust-analyzer\u3002
"},{"location":"chapter_array_and_linkedlist/array/","title":"4.1. \u00a0 \u6570\u7ec4","text":"

\u300c\u6570\u7ec4 Array\u300d\u662f\u4e00\u79cd\u5c06 \u76f8\u540c\u7c7b\u578b\u5143\u7d20 \u5b58\u50a8\u5728 \u8fde\u7eed\u5185\u5b58\u7a7a\u95f4 \u7684\u6570\u636e\u7ed3\u6784\uff0c\u5c06\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u4f4d\u7f6e\u79f0\u4e3a\u5143\u7d20\u7684\u300c\u7d22\u5f15 Index\u300d\u3002

Fig. \u6570\u7ec4\u5b9a\u4e49\u4e0e\u5b58\u50a8\u65b9\u5f0f

Note

\u89c2\u5bdf\u4e0a\u56fe\uff0c\u6211\u4eec\u53d1\u73b0 \u6570\u7ec4\u9996\u5143\u7d20\u7684\u7d22\u5f15\u4e3a \\(0\\) \u3002\u4f60\u53ef\u80fd\u4f1a\u60f3\uff0c\u8fd9\u5e76\u4e0d\u7b26\u5408\u65e5\u5e38\u4e60\u60ef\uff0c\u9996\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\u4e3a\u4ec0\u4e48\u4e0d\u662f \\(1\\) \u5462\uff0c\u8fd9\u4e0d\u662f\u66f4\u52a0\u81ea\u7136\u5417\uff1f\u6211\u8ba4\u540c\u4f60\u7684\u60f3\u6cd5\uff0c\u4f46\u8bf7\u5148\u8bb0\u4f4f\u8fd9\u4e2a\u8bbe\u5b9a\uff0c\u540e\u9762\u8bb2\u5185\u5b58\u5730\u5740\u8ba1\u7b97\u65f6\uff0c\u6211\u4f1a\u5c1d\u8bd5\u89e3\u7b54\u8fd9\u4e2a\u95ee\u9898\u3002

\u6570\u7ec4\u521d\u59cb\u5316\u3002\u4e00\u822c\u4f1a\u7528\u5230\u65e0\u521d\u59cb\u503c\u3001\u7ed9\u5b9a\u521d\u59cb\u503c\u4e24\u79cd\u5199\u6cd5\uff0c\u53ef\u6839\u636e\u9700\u6c42\u9009\u53d6\u3002\u5728\u4e0d\u7ed9\u5b9a\u521d\u59cb\u503c\u7684\u60c5\u51b5\u4e0b\uff0c\u4e00\u822c\u6240\u6709\u5143\u7d20\u4f1a\u88ab\u521d\u59cb\u5316\u4e3a\u9ed8\u8ba4\u503c \\(0\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nint[] arr = new int[5]; // { 0, 0, 0, 0, 0 }\nint[] nums = { 1, 3, 2, 5, 4 };\n
array.cpp
/* \u521d\u59cb\u5316\u6570\u7ec4 */\n// \u5b58\u50a8\u5728\u6808\u4e0a\nint arr[5];\nint nums[5] { 1, 3, 2, 5, 4 };\n// \u5b58\u50a8\u5728\u5806\u4e0a\nint* arr1 = new int[5];\nint* nums1 = new int[5] { 1, 3, 2, 5, 4 };\n
array.py
\"\"\" \u521d\u59cb\u5316\u6570\u7ec4 \"\"\"\narr: List[int] = [0] * 5  # [ 0, 0, 0, 0, 0 ]\nnums: List[int] = [1, 3, 2, 5, 4]  \n
array.go
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nvar arr [5]int\n// \u5728 Go \u4e2d\uff0c\u6307\u5b9a\u957f\u5ea6\u65f6\uff08[5]int\uff09\u4e3a\u6570\u7ec4\uff0c\u4e0d\u6307\u5b9a\u957f\u5ea6\u65f6\uff08[]int\uff09\u4e3a\u5207\u7247\n// \u7531\u4e8e Go \u7684\u6570\u7ec4\u88ab\u8bbe\u8ba1\u4e3a\u5728\u7f16\u8bd1\u671f\u786e\u5b9a\u957f\u5ea6\uff0c\u56e0\u6b64\u53ea\u80fd\u4f7f\u7528\u5e38\u91cf\u6765\u6307\u5b9a\u957f\u5ea6\n// \u4e3a\u4e86\u65b9\u4fbf\u5b9e\u73b0\u6269\u5bb9 extend() \u65b9\u6cd5\uff0c\u4ee5\u4e0b\u5c06\u5207\u7247\uff08Slice\uff09\u770b\u4f5c\u6570\u7ec4\uff08Array\uff09\nnums := []int{1, 3, 2, 5, 4}\n
array.js
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nvar arr = new Array(5).fill(0);\nvar nums = [1, 3, 2, 5, 4];\n
array.ts
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nlet arr: number[] = new Array(5).fill(0);\nlet nums: number[] = [1, 3, 2, 5, 4];\n
array.c
int arr[5] = { 0 }; // { 0, 0, 0, 0, 0 }\nint nums[5] = { 1, 3, 2, 5, 4 };\n
array.cs
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nint[] arr = new int[5]; // { 0, 0, 0, 0, 0 }\nint[] nums = { 1, 3, 2, 5, 4 };\n
array.swift
/* \u521d\u59cb\u5316\u6570\u7ec4 */\nlet arr = Array(repeating: 0, count: 5) // [0, 0, 0, 0, 0]\nlet nums = [1, 3, 2, 5, 4]\n
array.zig
// \u521d\u59cb\u5316\u6570\u7ec4\nvar arr = [_]i32{0} ** 5; // { 0, 0, 0, 0, 0 }\nvar nums = [_]i32{ 1, 3, 2, 5, 4 };\n
"},{"location":"chapter_array_and_linkedlist/array/#411","title":"4.1.1. \u00a0 \u6570\u7ec4\u4f18\u70b9","text":"

\u5728\u6570\u7ec4\u4e2d\u8bbf\u95ee\u5143\u7d20\u975e\u5e38\u9ad8\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u5728\u6570\u7ec4\u4e2d\uff0c\u8ba1\u7b97\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\u975e\u5e38\u5bb9\u6613\u3002\u7ed9\u5b9a\u6570\u7ec4\u9996\u4e2a\u5143\u7d20\u7684\u5730\u5740\u3001\u548c\u4e00\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u5229\u7528\u4ee5\u4e0b\u516c\u5f0f\u53ef\u4ee5\u76f4\u63a5\u8ba1\u7b97\u5f97\u5230\u8be5\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\uff0c\u4ece\u800c\u76f4\u63a5\u8bbf\u95ee\u6b64\u5143\u7d20\u3002

Fig. \u6570\u7ec4\u5143\u7d20\u7684\u5185\u5b58\u5730\u5740\u8ba1\u7b97

# \u5143\u7d20\u5185\u5b58\u5730\u5740 = \u6570\u7ec4\u5185\u5b58\u5730\u5740 + \u5143\u7d20\u957f\u5ea6 * \u5143\u7d20\u7d22\u5f15\nelementAddr = firtstElementAddr + elementLength * elementIndex\n

\u4e3a\u4ec0\u4e48\u6570\u7ec4\u5143\u7d20\u7d22\u5f15\u4ece 0 \u5f00\u59cb\u7f16\u53f7\uff1f \u6839\u636e\u5730\u5740\u8ba1\u7b97\u516c\u5f0f\uff0c\u7d22\u5f15\u672c\u8d28\u4e0a\u8868\u793a\u7684\u662f\u5185\u5b58\u5730\u5740\u504f\u79fb\u91cf\uff0c\u9996\u4e2a\u5143\u7d20\u7684\u5730\u5740\u504f\u79fb\u91cf\u662f \\(0\\) \uff0c\u90a3\u4e48\u7d22\u5f15\u662f \\(0\\) \u4e5f\u5c31\u5f88\u81ea\u7136\u4e86\u3002

\u8bbf\u95ee\u5143\u7d20\u7684\u9ad8\u6548\u6027\u5e26\u6765\u4e86\u8bb8\u591a\u4fbf\u5229\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u5185\u968f\u673a\u83b7\u53d6\u4e00\u4e2a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int[] nums) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = ThreadLocalRandom.current().\nnextInt(0, nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.cpp
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int* nums, int size) {\n// \u5728\u533a\u95f4 [0, size) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = rand() % size;\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.py
def random_access(nums: List[int]) -> int:\n\"\"\" \u968f\u673a\u8bbf\u95ee\u5143\u7d20 \"\"\"\n# \u5728\u533a\u95f4 [0, len(nums)-1] \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nrandom_index = random.randint(0, len(nums) - 1)\n# \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nrandom_num = nums[random_index]\nreturn random_num\n
array.go
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunc randomAccess(nums []int) (randomNum int) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nrandomIndex := rand.Intn(len(nums))\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nrandomNum = nums[randomIndex]\nreturn\n}\n
array.js
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunction randomAccess(nums) {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nconst random_index = Math.floor(Math.random() * nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nconst random_num = nums[random_index];\nreturn random_num;\n}\n
array.ts
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunction randomAccess(nums: number[]): number {\n// \u5728\u533a\u95f4 [0, nums.length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nconst random_index = Math.floor(Math.random() * nums.length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nconst random_num = nums[random_index];\nreturn random_num;\n}\n
array.c
[class]{}-[func]{randomAccess}\n
array.cs
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nint randomAccess(int[] nums)\n{\nRandom random = new();\n// \u5728\u533a\u95f4 [0, nums.Length) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nint randomIndex = random.Next(nums.Length);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nint randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
array.swift
/* \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20 */\nfunc randomAccess(nums: [Int]) -> Int {\n// \u5728\u533a\u95f4 [0, nums.count) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6570\u5b57\nlet randomIndex = nums.indices.randomElement()!\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nlet randomNum = nums[randomIndex]\nreturn randomNum\n}\n
array.zig
// \u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5143\u7d20\nfn randomAccess(nums: []i32) i32 {\n// \u5728\u533a\u95f4 [0, nums.len) \u4e2d\u968f\u673a\u62bd\u53d6\u4e00\u4e2a\u6574\u6570\nvar randomIndex = std.crypto.random.intRangeLessThan(usize, 0, nums.len);\n// \u83b7\u53d6\u5e76\u8fd4\u56de\u968f\u673a\u5143\u7d20\nvar randomNum = nums[randomIndex];\nreturn randomNum;\n}\n
"},{"location":"chapter_array_and_linkedlist/array/#412","title":"4.1.2. \u00a0 \u6570\u7ec4\u7f3a\u70b9","text":"

\u6570\u7ec4\u5728\u521d\u59cb\u5316\u540e\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u7531\u4e8e\u7cfb\u7edf\u65e0\u6cd5\u4fdd\u8bc1\u6570\u7ec4\u4e4b\u540e\u7684\u5185\u5b58\u7a7a\u95f4\u662f\u53ef\u7528\u7684\uff0c\u56e0\u6b64\u6570\u7ec4\u957f\u5ea6\u65e0\u6cd5\u6269\u5c55\u3002\u800c\u82e5\u5e0c\u671b\u6269\u5bb9\u6570\u7ec4\uff0c\u5219\u9700\u65b0\u5efa\u4e00\u4e2a\u6570\u7ec4\uff0c\u7136\u540e\u628a\u539f\u6570\u7ec4\u5143\u7d20\u4f9d\u6b21\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\uff0c\u5728\u6570\u7ec4\u5f88\u5927\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd9\u662f\u975e\u5e38\u8017\u65f6\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint[] extend(int[] nums, int enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint[] res = new int[nums.length + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.cpp
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint* extend(int* nums, int size, int enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint* res = new int[size + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < size; i++) {\nres[i] = nums[i];\n}\n// \u91ca\u653e\u5185\u5b58\ndelete[] nums;\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.py
def extend(nums: List[int], enlarge: int) -> List[int]:\n\"\"\" \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 \"\"\"\n# \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nres = [0] * (len(nums) + enlarge)\n# \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i in range(len(nums)):\nres[i] = nums[i]\n# \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n
array.go
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nfunc extend(nums []int, enlarge int) []int {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nres := make([]int, len(nums)+enlarge)\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i, num := range nums {\nres[i] = num\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n}\n
array.js
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\n// \u8bf7\u6ce8\u610f\uff0cJavaScript \u7684 Array \u662f\u52a8\u6001\u6570\u7ec4\uff0c\u53ef\u4ee5\u76f4\u63a5\u6269\u5c55\n// \u4e3a\u4e86\u65b9\u4fbf\u5b66\u4e60\uff0c\u672c\u51fd\u6570\u5c06 Array \u770b\u4f5c\u662f\u957f\u5ea6\u4e0d\u53ef\u53d8\u7684\u6570\u7ec4\nfunction extend(nums, enlarge) {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nconst res = new Array(nums.length + enlarge).fill(0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.ts
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\n// \u8bf7\u6ce8\u610f\uff0cTypeScript \u7684 Array \u662f\u52a8\u6001\u6570\u7ec4\uff0c\u53ef\u4ee5\u76f4\u63a5\u6269\u5c55\n// \u4e3a\u4e86\u65b9\u4fbf\u5b66\u4e60\uff0c\u672c\u51fd\u6570\u5c06 Array \u770b\u4f5c\u662f\u957f\u5ea6\u4e0d\u53ef\u53d8\u7684\u6570\u7ec4\nfunction extend(nums: number[], enlarge: number): number[] {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nconst res = new Array(nums.length + enlarge).fill(0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.c
[class]{}-[func]{extend}\n
array.cs
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nint[] extend(int[] nums, int enlarge)\n{\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nint[] res = new int[nums.Length + enlarge];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\nres[i] = nums[i];\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n
array.swift
/* \u6269\u5c55\u6570\u7ec4\u957f\u5ea6 */\nfunc extend(nums: [Int], enlarge: Int) -> [Int] {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nvar res = Array(repeating: 0, count: nums.count + enlarge)\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor i in nums.indices {\nres[i] = nums[i]\n}\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res\n}\n
array.zig
// \u6269\u5c55\u6570\u7ec4\u957f\u5ea6\nfn extend(mem_allocator: std.mem.Allocator, nums: []i32, enlarge: usize) ![]i32 {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u6269\u5c55\u957f\u5ea6\u540e\u7684\u6570\u7ec4\nvar res = try mem_allocator.alloc(i32, nums.len + enlarge);\nstd.mem.set(i32, res, 0);\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nstd.mem.copy(i32, res, nums);\n// \u8fd4\u56de\u6269\u5c55\u540e\u7684\u65b0\u6570\u7ec4\nreturn res;\n}\n

\u6570\u7ec4\u4e2d\u63d2\u5165\u6216\u5220\u9664\u5143\u7d20\u6548\u7387\u4f4e\u4e0b\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u5728\u6570\u7ec4\u4e2d\u95f4\u63d2\u5165\u4e00\u4e2a\u5143\u7d20\uff0c\u7531\u4e8e\u6570\u7ec4\u5143\u7d20\u5728\u5185\u5b58\u4e2d\u662f\u201c\u7d27\u6328\u7740\u7684\u201d\uff0c\u5b83\u4eec\u4e4b\u95f4\u6ca1\u6709\u7a7a\u95f4\u518d\u653e\u4efb\u4f55\u6570\u636e\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u4e0d\u5f97\u4e0d\u5c06\u6b64\u7d22\u5f15\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u7136\u540e\u518d\u628a\u5143\u7d20\u8d4b\u503c\u7ed9\u8be5\u7d22\u5f15\u3002

Fig. \u6570\u7ec4\u63d2\u5165\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#Swift array.java
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int[] nums, int num, int index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.cpp
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int* nums, int size, int num, int index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = size - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.py
def insert(nums: List[int], num: int, index: int) -> None:\n\"\"\" \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num \"\"\"\n# \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i in range(len(nums) - 1, index, -1):\nnums[i] = nums[i - 1]\n# \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n
array.go
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunc insert(nums []int, num int, index int) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i := len(nums) - 1; i > index; i-- {\nnums[i] = nums[i-1]\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n}\n
array.js
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunction insert(nums, num, index) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.ts
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunction insert(nums: number[], num: number, index: number): void {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let i = nums.length - 1; i > index; i--) {\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.c
[class]{}-[func]{insert}\n
array.cs
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nvoid insert(int[] nums, int num, int index)\n{\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int i = nums.Length - 1; i > index; i--)\n{\nnums[i] = nums[i - 1];\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num;\n}\n
array.swift
/* \u5728\u6570\u7ec4\u7684\u7d22\u5f15 index \u5904\u63d2\u5165\u5143\u7d20 num */\nfunc insert(nums: inout [Int], num: Int, index: Int) {\n// \u628a\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor i in sequence(first: nums.count - 1, next: { $0 > index + 1 ? $0 - 1 : nil }) {\nnums[i] = nums[i - 1]\n}\n// \u5c06 num \u8d4b\u7ed9 index \u5904\u5143\u7d20\nnums[index] = num\n}\n

\u5220\u9664\u5143\u7d20\u4e5f\u662f\u7c7b\u4f3c\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u5220\u9664\u7d22\u5f15 \\(i\\) \u5904\u7684\u5143\u7d20\uff0c\u5219\u9700\u8981\u628a\u7d22\u5f15 \\(i\\) \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5220\u9664\u5143\u7d20\u540e\uff0c\u539f\u5148\u672b\u5c3e\u7684\u5143\u7d20\u53d8\u5f97\u201c\u65e0\u610f\u4e49\u201d\u4e86\uff0c\u6211\u4eec\u65e0\u9700\u7279\u610f\u53bb\u4fee\u6539\u5b83\u3002

Fig. \u6570\u7ec4\u5220\u9664\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int[] nums, int index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.cpp
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int* nums, int size, int index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < size - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.py
def remove(nums: List[int], index: int) -> None:\n\"\"\" \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 \"\"\"\n# \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i in range(index, len(nums) - 1):\nnums[i] = nums[i + 1]\n
array.go
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunc remove(nums []int, index int) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i := index; i < len(nums)-1; i++ {\nnums[i] = nums[i+1]\n}\n}\n
array.js
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunction remove(nums, index) {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.ts
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunction remove(nums: number[], index: number): void {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let i = index; i < nums.length - 1; i++) {\nnums[i] = nums[i + 1];\n}\n}\n
array.c
[class]{}-[func]{removeItem}\n
array.cs
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nvoid remove(int[] nums, int index)\n{\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int i = index; i < nums.Length - 1; i++)\n{\nnums[i] = nums[i + 1];\n}\n}\n
array.swift
/* \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20 */\nfunc remove(nums: inout [Int], index: Int) {\nlet count = nums.count\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor i in sequence(first: index, next: { $0 < count - 1 - 1 ? $0 + 1 : nil }) {\nnums[i] = nums[i + 1]\n}\n}\n
array.zig
// \u5220\u9664\u7d22\u5f15 index \u5904\u5143\u7d20\nfn remove(nums: []i32, index: usize) void {\n// \u628a\u7d22\u5f15 index \u4e4b\u540e\u7684\u6240\u6709\u5143\u7d20\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nvar i = index;\nwhile (i < nums.len - 1) : (i += 1) {\nnums[i] = nums[i + 1];\n}\n}\n

\u603b\u7ed3\u6765\u770b\uff0c\u6570\u7ec4\u7684\u63d2\u5165\u4e0e\u5220\u9664\u64cd\u4f5c\u6709\u4ee5\u4e0b\u7f3a\u70b9\uff1a

  • \u65f6\u95f4\u590d\u6742\u5ea6\u9ad8\uff1a\u6570\u7ec4\u7684\u63d2\u5165\u548c\u5220\u9664\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u4e3a \\(O(N)\\) \uff0c\u5176\u4e2d \\(N\\) \u4e3a\u6570\u7ec4\u957f\u5ea6\u3002
  • \u4e22\u5931\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u7684\u957f\u5ea6\u4e0d\u53ef\u53d8\uff0c\u56e0\u6b64\u5728\u63d2\u5165\u5143\u7d20\u540e\uff0c\u8d85\u51fa\u6570\u7ec4\u957f\u5ea6\u8303\u56f4\u7684\u5143\u7d20\u4f1a\u88ab\u4e22\u5931\u3002
  • \u5185\u5b58\u6d6a\u8d39\uff1a\u6211\u4eec\u4e00\u822c\u4f1a\u521d\u59cb\u5316\u4e00\u4e2a\u6bd4\u8f83\u957f\u7684\u6570\u7ec4\uff0c\u53ea\u7528\u524d\u9762\u4e00\u90e8\u5206\uff0c\u8fd9\u6837\u5728\u63d2\u5165\u6570\u636e\u65f6\uff0c\u4e22\u5931\u7684\u672b\u5c3e\u5143\u7d20\u90fd\u662f\u6211\u4eec\u4e0d\u5173\u5fc3\u7684\uff0c\u4f46\u8fd9\u6837\u505a\u540c\u65f6\u4e5f\u4f1a\u9020\u6210\u5185\u5b58\u7a7a\u95f4\u7684\u6d6a\u8d39\u3002
"},{"location":"chapter_array_and_linkedlist/array/#413","title":"4.1.3. \u00a0 \u6570\u7ec4\u5e38\u7528\u64cd\u4f5c","text":"

\u6570\u7ec4\u904d\u5386\u3002\u4ee5\u4e0b\u4ecb\u7ecd\u4e24\u79cd\u5e38\u7528\u7684\u904d\u5386\u65b9\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int[] nums) {\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (int num : nums) {\ncount++;\n}\n}\n
array.cpp
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int* nums, int size) {\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < size; i++) {\ncount++;\n}\n}\n
array.py
def traverse(nums: List[int]) -> None:\n\"\"\" \u904d\u5386\u6570\u7ec4 \"\"\"\ncount = 0\n# \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor i in range(len(nums)):\ncount += 1\n# \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor num in nums:\ncount += 1\n
array.go
/* \u904d\u5386\u6570\u7ec4 */\nfunc traverse(nums []int) {\ncount := 0\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor i := 0; i < len(nums); i++ {\ncount++\n}\ncount = 0\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor range nums {\ncount++\n}\n}\n
array.js
/* \u904d\u5386\u6570\u7ec4 */\nfunction traverse(nums) {\nlet count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (let num of nums) {\ncount += 1;\n}\n}\n
array.ts
/* \u904d\u5386\u6570\u7ec4 */\nfunction traverse(nums: number[]): void {\nlet count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (let num of nums) {\ncount += 1;\n}\n}\n
array.c
[class]{}-[func]{traverse}\n
array.cs
/* \u904d\u5386\u6570\u7ec4 */\nvoid traverse(int[] nums)\n{\nint count = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\ncount++;\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nforeach (int num in nums)\n{\ncount++;\n}\n}\n
array.swift
/* \u904d\u5386\u6570\u7ec4 */\nfunc traverse(nums: [Int]) {\nvar count = 0\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nfor _ in nums.indices {\ncount += 1\n}\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor _ in nums {\ncount += 1\n}\n}\n
array.zig
// \u904d\u5386\u6570\u7ec4\nfn traverse(nums: []i32) void {\nvar count: i32 = 0;\n// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u6570\u7ec4\nvar i: i32 = 0;\nwhile (i < nums.len) : (i += 1) {\ncount += 1;\n}\ncount = 0;\n// \u76f4\u63a5\u904d\u5386\u6570\u7ec4\nfor (nums) |_| {\ncount += 1;\n}\n}\n

\u6570\u7ec4\u67e5\u627e\u3002\u901a\u8fc7\u904d\u5386\u6570\u7ec4\uff0c\u67e5\u627e\u6570\u7ec4\u5185\u7684\u6307\u5b9a\u5143\u7d20\uff0c\u5e76\u8f93\u51fa\u5bf9\u5e94\u7d22\u5f15\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array.java
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int[] nums, int target) {\nfor (int i = 0; i < nums.length; i++) {\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.cpp
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int* nums, int size, int target) {\nfor (int i = 0; i < size; i++) {\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.py
def find(nums: List[int], target: int) -> int:\n\"\"\" \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 \"\"\"\nfor i in range(len(nums)):\nif nums[i] == target:\nreturn i\nreturn -1\n
array.go
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunc find(nums []int, target int) (index int) {\nindex = -1\nfor i := 0; i < len(nums); i++ {\nif nums[i] == target {\nindex = i\nbreak\n}\n}\nreturn\n}\n
array.js
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunction find(nums, target) {\nfor (let i = 0; i < nums.length; i++) {\nif (nums[i] == target) return i;\n}\nreturn -1;\n}\n
array.ts
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunction find(nums: number[], target: number): number {\nfor (let i = 0; i < nums.length; i++) {\nif (nums[i] === target) {\nreturn i;\n}\n}\nreturn -1;\n}\n
array.c
[class]{}-[func]{find}\n
array.cs
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nint find(int[] nums, int target)\n{\nfor (int i = 0; i < nums.Length; i++)\n{\nif (nums[i] == target)\nreturn i;\n}\nreturn -1;\n}\n
array.swift
/* \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20 */\nfunc find(nums: [Int], target: Int) -> Int {\nfor i in nums.indices {\nif nums[i] == target {\nreturn i\n}\n}\nreturn -1\n}\n
array.zig
// \u5728\u6570\u7ec4\u4e2d\u67e5\u627e\u6307\u5b9a\u5143\u7d20\nfn find(nums: []i32, target: i32) i32 {\nfor (nums) |num, i| {\nif (num == target) return @intCast(i32, i);\n}\nreturn -1;\n}\n
"},{"location":"chapter_array_and_linkedlist/array/#414","title":"4.1.4. \u00a0 \u6570\u7ec4\u5178\u578b\u5e94\u7528","text":"

\u968f\u673a\u8bbf\u95ee\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u968f\u673a\u62bd\u53d6\u4e00\u4e9b\u6837\u672c\uff0c\u90a3\u4e48\u53ef\u4ee5\u7528\u6570\u7ec4\u5b58\u50a8\uff0c\u5e76\u751f\u6210\u4e00\u4e2a\u968f\u673a\u5e8f\u5217\uff0c\u6839\u636e\u7d22\u5f15\u5b9e\u73b0\u6837\u672c\u7684\u968f\u673a\u62bd\u53d6\u3002

\u4e8c\u5206\u67e5\u627e\u3002\u4f8b\u5982\u524d\u6587\u67e5\u5b57\u5178\u7684\u4f8b\u5b50\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u5178\u4e2d\u7684\u6240\u6709\u5b57\u6309\u7167\u62fc\u97f3\u987a\u5e8f\u5b58\u50a8\u5728\u6570\u7ec4\u4e2d\uff0c\u7136\u540e\u4f7f\u7528\u4e0e\u65e5\u5e38\u67e5\u7eb8\u8d28\u5b57\u5178\u76f8\u540c\u7684\u201c\u7ffb\u5f00\u4e2d\u95f4\uff0c\u6392\u9664\u4e00\u534a\u201d\u7684\u65b9\u5f0f\uff0c\u6765\u5b9e\u73b0\u4e00\u4e2a\u67e5\u7535\u5b50\u5b57\u5178\u7684\u7b97\u6cd5\u3002

\u6df1\u5ea6\u5b66\u4e60\u3002\u795e\u7ecf\u7f51\u7edc\u4e2d\u5927\u91cf\u4f7f\u7528\u4e86\u5411\u91cf\u3001\u77e9\u9635\u3001\u5f20\u91cf\u4e4b\u95f4\u7684\u7ebf\u6027\u4ee3\u6570\u8fd0\u7b97\uff0c\u8fd9\u4e9b\u6570\u636e\u90fd\u662f\u4ee5\u6570\u7ec4\u7684\u5f62\u5f0f\u6784\u5efa\u7684\u3002\u6570\u7ec4\u662f\u795e\u7ecf\u7f51\u7edc\u7f16\u7a0b\u4e2d\u6700\u5e38\u4f7f\u7528\u7684\u6570\u636e\u7ed3\u6784\u3002

"},{"location":"chapter_array_and_linkedlist/linked_list/","title":"4.2. \u00a0 \u94fe\u8868","text":"

\u5f15\u8a00

\u5185\u5b58\u7a7a\u95f4\u662f\u6240\u6709\u7a0b\u5e8f\u7684\u516c\u5171\u8d44\u6e90\uff0c\u6392\u9664\u5df2\u5360\u7528\u7684\u5185\u5b58\uff0c\u7a7a\u95f2\u5185\u5b58\u5f80\u5f80\u662f\u6563\u843d\u5728\u5185\u5b58\u5404\u5904\u7684\u3002\u6211\u4eec\u77e5\u9053\uff0c\u5b58\u50a8\u6570\u7ec4\u9700\u8981\u5185\u5b58\u7a7a\u95f4\u8fde\u7eed\uff0c\u5f53\u6211\u4eec\u9700\u8981\u7533\u8bf7\u4e00\u4e2a\u5f88\u5927\u7684\u6570\u7ec4\u65f6\uff0c\u7cfb\u7edf\u4e0d\u4e00\u5b9a\u5b58\u5728\u8fd9\u4e48\u5927\u7684\u8fde\u7eed\u5185\u5b58\u7a7a\u95f4\u3002\u800c\u94fe\u8868\u5219\u66f4\u52a0\u7075\u6d3b\uff0c\u4e0d\u9700\u8981\u5185\u5b58\u662f\u8fde\u7eed\u7684\uff0c\u53ea\u8981\u5269\u4f59\u5185\u5b58\u7a7a\u95f4\u5927\u5c0f\u591f\u7528\u5373\u53ef\u3002

\u300c\u94fe\u8868 Linked List\u300d\u662f\u4e00\u79cd\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u5355\u72ec\u7684\u5bf9\u8c61\uff0c\u5404\u4e2a\u5143\u7d20\uff08\u4e00\u822c\u79f0\u4e3a\u7ed3\u70b9\uff09\u4e4b\u95f4\u901a\u8fc7\u6307\u9488\u8fde\u63a5\u3002\u7531\u4e8e\u7ed3\u70b9\u4e2d\u8bb0\u5f55\u4e86\u8fde\u63a5\u5173\u7cfb\uff0c\u56e0\u6b64\u94fe\u8868\u7684\u5b58\u50a8\u65b9\u5f0f\u76f8\u6bd4\u4e8e\u6570\u7ec4\u66f4\u52a0\u7075\u6d3b\uff0c\u7cfb\u7edf\u4e0d\u5fc5\u4fdd\u8bc1\u5185\u5b58\u5730\u5740\u7684\u8fde\u7eed\u6027\u3002

\u94fe\u8868\u7684\u300c\u7ed3\u70b9 Node\u300d\u5305\u542b\u4e24\u9879\u6570\u636e\uff0c\u4e00\u662f\u7ed3\u70b9\u300c\u503c Value\u300d\uff0c\u4e8c\u662f\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u300c\u6307\u9488 Pointer\u300d\uff08\u6216\u79f0\u300c\u5f15\u7528 Reference\u300d\uff09\u3002

Fig. \u94fe\u8868\u5b9a\u4e49\u4e0e\u5b58\u50a8\u65b9\u5f0f

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) { val = x; }  // \u6784\u9020\u51fd\u6570\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;         // \u7ed3\u70b9\u503c\nListNode *next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) : val(x), next(nullptr) {}  // \u6784\u9020\u51fd\u6570\n};\n
\"\"\" \u94fe\u8868\u7ed3\u70b9\u7c7b \"\"\" \nclass ListNode:\ndef __init__(self, val: int):\nself.val: int = val                  # \u7ed3\u70b9\u503c\nself.next: Optional[ListNode] = None # \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype ListNode struct {\nVal  int       // \u7ed3\u70b9\u503c\nNext *ListNode // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n// NewListNode \u6784\u9020\u51fd\u6570\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u94fe\u8868\nfunc NewListNode(val int) *ListNode {\nreturn &ListNode{\nVal:  val,\nNext: nil,\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval;\nnext;\nconstructor(val, next) {\nthis.val = (val === undefined ? 0 : val);       // \u7ed3\u70b9\u503c\nthis.next = (next === undefined ? null : next); // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval: number;\nnext: ListNode | null;\nconstructor(val?: number, next?: ListNode | null) {\nthis.val = val === undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next === undefined ? null : next;  // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;               // \u7ed3\u70b9\u503c\nstruct ListNode *next; // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n};\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode\n{\nint val;         // \u7ed3\u70b9\u503c\nListNode next;   // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\nListNode(int x) => val = x;  //\u6784\u9020\u51fd\u6570\n}\n
/* \u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\ninit(x: Int) { // \u6784\u9020\u51fd\u6570\nval = x\n}\n}\n
// \u94fe\u8868\u7ed3\u70b9\u7c7b\npub fn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = 0, // \u7ed3\u70b9\u503c\nnext: ?*Self = null, // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n// \u6784\u9020\u51fd\u6570\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\n}\n};\n}\n

\u5c3e\u7ed3\u70b9\u6307\u5411\u4ec0\u4e48\uff1f \u6211\u4eec\u4e00\u822c\u5c06\u94fe\u8868\u7684\u6700\u540e\u4e00\u4e2a\u7ed3\u70b9\u79f0\u4e3a\u300c\u5c3e\u7ed3\u70b9\u300d\uff0c\u5176\u6307\u5411\u7684\u662f\u300c\u7a7a\u300d\uff0c\u5728 Java / C++ / Python \u4e2d\u5206\u522b\u8bb0\u4e3a null / nullptr / None \u3002\u5728\u4e0d\u5f15\u8d77\u6b67\u4e49\u4e0b\uff0c\u672c\u4e66\u90fd\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u3002

\u94fe\u8868\u521d\u59cb\u5316\u65b9\u6cd5\u3002\u5efa\u7acb\u94fe\u8868\u5206\u4e3a\u4e24\u6b65\uff0c\u7b2c\u4e00\u6b65\u662f\u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\u5bf9\u8c61\uff0c\u7b2c\u4e8c\u6b65\u662f\u6784\u5efa\u5f15\u7528\u6307\u5411\u5173\u7cfb\u3002\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u4ee5\u4ece\u94fe\u8868\u7684\u9996\u4e2a\u7ed3\u70b9\uff08\u5373\u5934\u7ed3\u70b9\uff09\u51fa\u53d1\uff0c\u8bbf\u95ee\u5176\u4f59\u6240\u6709\u7684\u7ed3\u70b9\u3002

Tip

\u6211\u4eec\u901a\u5e38\u5c06\u5934\u7ed3\u70b9\u5f53\u4f5c\u94fe\u8868\u7684\u4ee3\u79f0\uff0c\u4f8b\u5982\u5934\u7ed3\u70b9 head \u548c\u94fe\u8868 head \u5b9e\u9645\u4e0a\u662f\u540c\u4e49\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode n0 = new ListNode(1);\nListNode n1 = new ListNode(3);\nListNode n2 = new ListNode(2);\nListNode n3 = new ListNode(5);\nListNode n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.cpp
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode* n0 = new ListNode(1);\nListNode* n1 = new ListNode(3);\nListNode* n2 = new ListNode(2);\nListNode* n3 = new ListNode(5);\nListNode* n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0->next = n1;\nn1->next = n2;\nn2->next = n3;\nn3->next = n4;\n
linked_list.py
\"\"\" \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 \"\"\"\n# \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nn0 = ListNode(1)\nn1 = ListNode(3)\nn2 = ListNode(2)\nn3 = ListNode(5)\nn4 = ListNode(4)\n# \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1\nn1.next = n2\nn2.next = n3\nn3.next = n4\n
linked_list.go
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nn0 := NewListNode(1)\nn1 := NewListNode(3)\nn2 := NewListNode(2)\nn3 := NewListNode(5)\nn4 := NewListNode(4)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.Next = n1\nn1.Next = n2\nn2.Next = n3\nn3.Next = n4\n
linked_list.js
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nconst n0 = new ListNode(1);\nconst n1 = new ListNode(3);\nconst n2 = new ListNode(2);\nconst n3 = new ListNode(5);\nconst n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.ts
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nconst n0 = new ListNode(1);\nconst n1 = new ListNode(3);\nconst n2 = new ListNode(2);\nconst n3 = new ListNode(5);\nconst n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.c
\n
linked_list.cs
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nListNode n0 = new ListNode(1);\nListNode n1 = new ListNode(3);\nListNode n2 = new ListNode(2);\nListNode n3 = new ListNode(5);\nListNode n4 = new ListNode(4);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1;\nn1.next = n2;\nn2.next = n3;\nn3.next = n4;\n
linked_list.swift
/* \u521d\u59cb\u5316\u94fe\u8868 1 -> 3 -> 2 -> 5 -> 4 */\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9\nlet n0 = ListNode(x: 1)\nlet n1 = ListNode(x: 3)\nlet n2 = ListNode(x: 2)\nlet n3 = ListNode(x: 5)\nlet n4 = ListNode(x: 4)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = n1\nn1.next = n2\nn2.next = n3\nn3.next = n4\n
linked_list.zig
// \u521d\u59cb\u5316\u94fe\u8868\n// \u521d\u59cb\u5316\u5404\u4e2a\u7ed3\u70b9 \nvar n0 = inc.ListNode(i32){.val = 1};\nvar n1 = inc.ListNode(i32){.val = 3};\nvar n2 = inc.ListNode(i32){.val = 2};\nvar n3 = inc.ListNode(i32){.val = 5};\nvar n4 = inc.ListNode(i32){.val = 4};\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\nn0.next = &n1;\nn1.next = &n2;\nn2.next = &n3;\nn3.next = &n4;\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#421","title":"4.2.1. \u00a0 \u94fe\u8868\u4f18\u70b9","text":"

\u5728\u94fe\u8868\u4e2d\uff0c\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u7684\u64cd\u4f5c\u6548\u7387\u9ad8\u3002\u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u5728\u94fe\u8868\u4e2d\u95f4\u7684\u4e24\u4e2a\u7ed3\u70b9 A , B \u4e4b\u95f4\u63d2\u5165\u4e00\u4e2a\u65b0\u7ed3\u70b9 P \uff0c\u6211\u4eec\u53ea\u9700\u8981\u6539\u53d8\u4e24\u4e2a\u7ed3\u70b9\u6307\u9488\u5373\u53ef\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u76f8\u6bd4\u6570\u7ec4\u7684\u63d2\u5165\u64cd\u4f5c\u9ad8\u6548\u5f88\u591a\u3002

Fig. \u94fe\u8868\u63d2\u5165\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode n0, ListNode P) {\nListNode n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.cpp
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode* n0, ListNode* P) {\nListNode* n1 = n0->next;\nP->next = n1;\nn0->next = P;\n}\n
linked_list.py
def insert(n0: ListNode, P: ListNode) -> None:\n\"\"\" \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P \"\"\"\nn1 = n0.next\nP.next = n1\nn0.next = P\n
linked_list.go
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunc insertNode(n0 *ListNode, P *ListNode) {\nn1 := n0.Next\nP.Next = n1\nn0.Next = P\n}\n
linked_list.js
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunction insert(n0, P) {\nconst n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.ts
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunction insert(n0: ListNode, P: ListNode): void {\nconst n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.c
[class]{}-[func]{insertNode}\n
linked_list.cs
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nvoid insert(ListNode n0, ListNode P)\n{\nListNode? n1 = n0.next;\nP.next = n1;\nn0.next = P;\n}\n
linked_list.swift
/* \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P */\nfunc insert(n0: ListNode, P: ListNode) {\nlet n1 = n0.next\nP.next = n1\nn0.next = P\n}\n
linked_list.zig
// \u5728\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u63d2\u5165\u7ed3\u70b9 P\nfn insert(n0: ?*inc.ListNode(i32), P: ?*inc.ListNode(i32)) void {\nvar n1 = n0.?.next;\nP.?.next = n1;\nn0.?.next = P;\n}\n

\u5728\u94fe\u8868\u4e2d\u5220\u9664\u7ed3\u70b9\u4e5f\u5f88\u65b9\u4fbf\uff0c\u53ea\u9700\u8981\u6539\u53d8\u4e00\u4e2a\u7ed3\u70b9\u6307\u9488\u5373\u53ef\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u867d\u7136\u5728\u5b8c\u6210\u5220\u9664\u540e\u7ed3\u70b9 P \u4ecd\u7136\u6307\u5411 n1 \uff0c\u4f46\u5b9e\u9645\u4e0a P \u5df2\u7ecf\u4e0d\u5c5e\u4e8e\u6b64\u94fe\u8868\u4e86\uff0c\u56e0\u4e3a\u904d\u5386\u6b64\u94fe\u8868\u662f\u65e0\u6cd5\u8bbf\u95ee\u5230 P \u7684\u3002

Fig. \u94fe\u8868\u5220\u9664\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode n0) {\nif (n0.next == null)\nreturn;\n// n0 -> P -> n1\nListNode P = n0.next;\nListNode n1 = P.next;\nn0.next = n1;\n}\n
linked_list.cpp
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode* n0) {\nif (n0->next == nullptr)\nreturn;\n// n0 -> P -> n1\nListNode* P = n0->next;\nListNode* n1 = P->next;\nn0->next = n1;\n// \u91ca\u653e\u5185\u5b58\ndelete P;\n}\n
linked_list.py
def remove(n0: ListNode) -> None:\n\"\"\" \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 \"\"\"\nif not n0.next:\nreturn\n# n0 -> P -> n1\nP = n0.next\nn1 = P.next\nn0.next = n1\n
linked_list.go
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc removeNode(n0 *ListNode) {\nif n0.Next == nil {\nreturn\n}\n// n0 -> P -> n1\nP := n0.Next\nn1 := P.Next\nn0.Next = n1\n}\n
linked_list.js
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction remove(n0) {\nif (!n0.next)\nreturn;\n// n0 -> P -> n1\nconst P = n0.next;\nconst n1 = P.next;\nn0.next = n1;\n}\n
linked_list.ts
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction remove(n0: ListNode): void {\nif (!n0.next) {\nreturn;\n}\n// n0 -> P -> n1\nconst P = n0.next;\nconst n1 = P.next;\nn0.next = n1;\n}\n
linked_list.c
[class]{}-[func]{removeNode}\n
linked_list.cs
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nvoid remove(ListNode n0)\n{\nif (n0.next == null)\nreturn;\n// n0 -> P -> n1\nListNode P = n0.next;\nListNode? n1 = P.next;\nn0.next = n1;\n}\n
linked_list.swift
/* \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc remove(n0: ListNode) {\nif n0.next == nil {\nreturn\n}\n// n0 -> P -> n1\nlet P = n0.next\nlet n1 = P?.next\nn0.next = n1\nP?.next = nil\n}\n
linked_list.zig
// \u5220\u9664\u94fe\u8868\u7684\u7ed3\u70b9 n0 \u4e4b\u540e\u7684\u9996\u4e2a\u7ed3\u70b9\nfn remove(n0: ?*inc.ListNode(i32)) void {\nif (n0.?.next == null) return;\n// n0 -> P -> n1\nvar P = n0.?.next;\nvar n1 = P.?.next;\nn0.?.next = n1;\n}\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#422","title":"4.2.2. \u00a0 \u94fe\u8868\u7f3a\u70b9","text":"

\u94fe\u8868\u8bbf\u95ee\u7ed3\u70b9\u6548\u7387\u4f4e\u3002\u4e0a\u8282\u63d0\u5230\uff0c\u6570\u7ec4\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u4e0b\u8bbf\u95ee\u4efb\u610f\u5143\u7d20\uff0c\u4f46\u94fe\u8868\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u4efb\u610f\u7ed3\u70b9\u3002\u8fd9\u662f\u56e0\u4e3a\u8ba1\u7b97\u673a\u9700\u8981\u4ece\u5934\u7ed3\u70b9\u51fa\u53d1\uff0c\u4e00\u4e2a\u4e00\u4e2a\u5730\u5411\u540e\u904d\u5386\u5230\u76ee\u6807\u7ed3\u70b9\u3002\u4f8b\u5982\uff0c\u5018\u82e5\u60f3\u8981\u8bbf\u95ee\u94fe\u8868\u7d22\u5f15\u4e3a index \uff08\u5373\u7b2c index + 1 \u4e2a\uff09\u7684\u7ed3\u70b9\uff0c\u90a3\u4e48\u9700\u8981 index \u6b21\u8bbf\u95ee\u64cd\u4f5c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode access(ListNode head, int index) {\nfor (int i = 0; i < index; i++) {\nif (head == null)\nreturn null;\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.cpp
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode* access(ListNode* head, int index) {\nfor (int i = 0; i < index; i++) {\nif (head == nullptr)\nreturn nullptr;\nhead = head->next;\n}\nreturn head;\n}\n
linked_list.py
def access(head: ListNode, index: int) -> Optional[ListNode]:\n\"\"\" \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 \"\"\"\nfor _ in range(index):\nif not head:\nreturn None\nhead = head.next\nreturn head\n
linked_list.go
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunc access(head *ListNode, index int) *ListNode {\nfor i := 0; i < index; i++ {\nif head == nil {\nreturn nil\n}\nhead = head.Next\n}\nreturn head\n}\n
linked_list.js
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunction access(head, index) {\nfor (let i = 0; i < index; i++) {\nif (!head) {\nreturn null;\n}\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.ts
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunction access(head: ListNode | null, index: number): ListNode | null {\nfor (let i = 0; i < index; i++) {\nif (!head) {\nreturn null;\n}\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.c
[class]{}-[func]{access}\n
linked_list.cs
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nListNode? access(ListNode head, int index)\n{\nfor (int i = 0; i < index; i++)\n{\nif (head == null)\nreturn null;\nhead = head.next;\n}\nreturn head;\n}\n
linked_list.swift
/* \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9 */\nfunc access(head: ListNode, index: Int) -> ListNode? {\nvar head: ListNode? = head\nfor _ in 0 ..< index {\nif head == nil {\nreturn nil\n}\nhead = head?.next\n}\nreturn head\n}\n
linked_list.zig
// \u8bbf\u95ee\u94fe\u8868\u4e2d\u7d22\u5f15\u4e3a index \u7684\u7ed3\u70b9\nfn access(node: ?*inc.ListNode(i32), index: i32) ?*inc.ListNode(i32) {\nvar head = node;\nvar i: i32 = 0;\nwhile (i < index) : (i += 1) {\nhead = head.?.next;\nif (head == null) return null;\n}\nreturn head;\n}\n

\u94fe\u8868\u7684\u5185\u5b58\u5360\u7528\u591a\u3002\u94fe\u8868\u4ee5\u7ed3\u70b9\u4e3a\u5355\u4f4d\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u9664\u4e86\u4fdd\u5b58\u503c\u5916\uff0c\u8fd8\u9700\u989d\u5916\u4fdd\u5b58\u6307\u9488\uff08\u5f15\u7528\uff09\u3002\u8fd9\u610f\u5473\u7740\u540c\u6837\u6570\u636e\u91cf\u4e0b\uff0c\u94fe\u8868\u6bd4\u6570\u7ec4\u9700\u8981\u5360\u7528\u66f4\u591a\u5185\u5b58\u7a7a\u95f4\u3002

"},{"location":"chapter_array_and_linkedlist/linked_list/#423","title":"4.2.3. \u00a0 \u94fe\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u904d\u5386\u94fe\u8868\u67e5\u627e\u3002\u904d\u5386\u94fe\u8868\uff0c\u67e5\u627e\u94fe\u8868\u5185\u503c\u4e3a target \u7684\u7ed3\u70b9\uff0c\u8f93\u51fa\u7ed3\u70b9\u5728\u94fe\u8868\u4e2d\u7684\u7d22\u5f15\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linked_list.java
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode head, int target) {\nint index = 0;\nwhile (head != null) {\nif (head.val == target)\nreturn index;\nhead = head.next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.cpp
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode* head, int target) {\nint index = 0;\nwhile (head != nullptr) {\nif (head->val == target)\nreturn index;\nhead = head->next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.py
def find(head: ListNode, target: int) -> int:\n\"\"\" \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 \"\"\"\nindex = 0\nwhile head:\nif head.val == target:\nreturn index\nhead = head.next\nindex += 1\nreturn -1\n
linked_list.go
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc findNode(head *ListNode, target int) int {\nindex := 0\nfor head != nil {\nif head.Val == target {\nreturn index\n}\nhead = head.Next\nindex++\n}\nreturn -1\n}\n
linked_list.js
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction find(head, target) {\nlet index = 0;\nwhile (head !== null) {\nif (head.val === target) {\nreturn index;\n}\nhead = head.next;\nindex += 1;\n}\nreturn -1;\n}\n
linked_list.ts
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunction find(head: ListNode | null, target: number): number {\nlet index = 0;\nwhile (head !== null) {\nif (head.val === target) {\nreturn index;\n}\nhead = head.next;\nindex += 1;\n}\nreturn -1;\n}\n
linked_list.c
[class]{}-[func]{findNode}\n
linked_list.cs
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nint find(ListNode head, int target)\n{\nint index = 0;\nwhile (head != null)\n{\nif (head.val == target)\nreturn index;\nhead = head.next;\nindex++;\n}\nreturn -1;\n}\n
linked_list.swift
/* \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9 */\nfunc find(head: ListNode, target: Int) -> Int {\nvar head: ListNode? = head\nvar index = 0\nwhile head != nil {\nif head?.val == target {\nreturn index\n}\nhead = head?.next\nindex += 1\n}\nreturn -1\n}\n
linked_list.zig
// \u5728\u94fe\u8868\u4e2d\u67e5\u627e\u503c\u4e3a target \u7684\u9996\u4e2a\u7ed3\u70b9\nfn find(node: ?*inc.ListNode(i32), target: i32) i32 {\nvar head = node;\nvar index: i32 = 0;\nwhile (head != null) {\nif (head.?.val == target) return index;\nhead = head.?.next;\nindex += 1;\n}\nreturn -1;\n}\n
"},{"location":"chapter_array_and_linkedlist/linked_list/#424","title":"4.2.4. \u00a0 \u5e38\u89c1\u94fe\u8868\u7c7b\u578b","text":"

\u5355\u5411\u94fe\u8868\u3002\u5373\u4e0a\u8ff0\u4ecb\u7ecd\u7684\u666e\u901a\u94fe\u8868\u3002\u5355\u5411\u94fe\u8868\u7684\u7ed3\u70b9\u6709\u300c\u503c\u300d\u548c\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u300c\u6307\u9488\uff08\u5f15\u7528\uff09\u300d\u4e24\u9879\u6570\u636e\u3002\u6211\u4eec\u5c06\u9996\u4e2a\u7ed3\u70b9\u79f0\u4e3a\u5934\u7ed3\u70b9\uff0c\u5c3e\u7ed3\u70b9\u6307\u5411 null \u3002

\u73af\u5f62\u94fe\u8868\u3002\u5982\u679c\u6211\u4eec\u4ee4\u5355\u5411\u94fe\u8868\u7684\u5c3e\u7ed3\u70b9\u6307\u5411\u5934\u7ed3\u70b9\uff08\u5373\u9996\u5c3e\u76f8\u63a5\uff09\uff0c\u5219\u5f97\u5230\u4e00\u4e2a\u73af\u5f62\u94fe\u8868\u3002\u5728\u73af\u5f62\u94fe\u8868\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u4efb\u610f\u7ed3\u70b9\u770b\u4f5c\u662f\u5934\u7ed3\u70b9\u3002

\u53cc\u5411\u94fe\u8868\u3002\u5355\u5411\u94fe\u8868\u4ec5\u8bb0\u5f55\u4e86\u4e00\u4e2a\u65b9\u5411\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\uff0c\u5728\u53cc\u5411\u94fe\u8868\u7684\u7ed3\u70b9\u5b9a\u4e49\u4e2d\uff0c\u540c\u65f6\u6709\u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\uff08\u540e\u7ee7\u7ed3\u70b9\uff09\u548c\u4e0a\u4e00\u7ed3\u70b9\uff08\u524d\u9a71\u7ed3\u70b9\uff09\u7684\u300c\u6307\u9488\uff08\u5f15\u7528\uff09\u300d\u3002\u53cc\u5411\u94fe\u8868\u76f8\u5bf9\u4e8e\u5355\u5411\u94fe\u8868\u66f4\u52a0\u7075\u6d3b\uff0c\u5373\u53ef\u4ee5\u671d\u4e24\u4e2a\u65b9\u5411\u904d\u5386\u94fe\u8868\uff0c\u4f46\u4e5f\u9700\u8981\u5360\u7528\u66f4\u591a\u7684\u5185\u5b58\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) { val = x; }  // \u6784\u9020\u51fd\u6570\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct ListNode {\nint val;         // \u7ed3\u70b9\u503c\nListNode *next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode *prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) : val(x), next(nullptr), prev(nullptr) {}  // \u6784\u9020\u51fd\u6570\n};\n
\"\"\" \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b \"\"\" \nclass ListNode:\ndef __init__(self, val: int):\nself.val: int = val                   # \u7ed3\u70b9\u503c\nself.next: Optional[ListNode] = None  # \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nself.prev: Optional[ListNode] = None  # \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype DoublyListNode struct {\nVal  int             // \u7ed3\u70b9\u503c\nNext *DoublyListNode // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nPrev *DoublyListNode // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n// NewDoublyListNode \u521d\u59cb\u5316\nfunc NewDoublyListNode(val int) *DoublyListNode {\nreturn &DoublyListNode{\nVal:  val,\nNext: nil,\nPrev: nil,\n}\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval;\nnext;\nprev;\nconstructor(val, next) {\nthis.val = val  ===  undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next  ===  undefined ? null : next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nthis.prev = prev  ===  undefined ? null : prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nval: number;\nnext: ListNode | null;\nprev: ListNode | null;\nconstructor(val?: number, next?: ListNode | null, prev?: ListNode | null) {\nthis.val = val  ===  undefined ? 0 : val;        // \u7ed3\u70b9\u503c\nthis.next = next  ===  undefined ? null : next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nthis.prev = prev  ===  undefined ? null : prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n}\n}\n
\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nint val;        // \u7ed3\u70b9\u503c\nListNode next;  // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode prev;  // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nListNode(int x) => val = x;  // \u6784\u9020\u51fd\u6570\n}\n
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nvar prev: ListNode? // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\ninit(x: Int) { // \u6784\u9020\u51fd\u6570\nval = x\n}\n}\n
// \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\u7c7b\npub fn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = 0, // \u7ed3\u70b9\u503c\nnext: ?*Self = null, // \u6307\u5411\u540e\u7ee7\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\nprev: ?*Self = null, // \u6307\u5411\u524d\u9a71\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n// \u6784\u9020\u51fd\u6570\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\nself.prev = null;\n}\n};\n}\n

Fig. \u5e38\u89c1\u94fe\u8868\u79cd\u7c7b

"},{"location":"chapter_array_and_linkedlist/list/","title":"4.3. \u00a0 \u5217\u8868","text":"

\u7531\u4e8e\u957f\u5ea6\u4e0d\u53ef\u53d8\uff0c\u6570\u7ec4\u7684\u5b9e\u7528\u6027\u5927\u5927\u964d\u4f4e\u3002\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e8b\u5148\u5e76\u4e0d\u77e5\u9053\u4f1a\u8f93\u5165\u591a\u5c11\u6570\u636e\uff0c\u8fd9\u5c31\u4e3a\u6570\u7ec4\u957f\u5ea6\u7684\u9009\u62e9\u5e26\u6765\u4e86\u5f88\u5927\u56f0\u96be\u3002\u957f\u5ea6\u9009\u5c0f\u4e86\uff0c\u9700\u8981\u5728\u6dfb\u52a0\u6570\u636e\u4e2d\u9891\u7e41\u5730\u6269\u5bb9\u6570\u7ec4\uff1b\u957f\u5ea6\u9009\u5927\u4e86\uff0c\u53c8\u9020\u6210\u5185\u5b58\u7a7a\u95f4\u7684\u6d6a\u8d39\u3002

\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bde\u751f\u4e86\u4e00\u79cd\u88ab\u79f0\u4e3a\u300c\u5217\u8868 List\u300d\u7684\u6570\u636e\u7ed3\u6784\u3002\u5217\u8868\u53ef\u4ee5\u88ab\u7406\u89e3\u4e3a\u957f\u5ea6\u53ef\u53d8\u7684\u6570\u7ec4\uff0c\u56e0\u6b64\u4e5f\u5e38\u88ab\u79f0\u4e3a\u300c\u52a8\u6001\u6570\u7ec4 Dynamic Array\u300d\u3002\u5217\u8868\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\uff0c\u7ee7\u627f\u4e86\u6570\u7ec4\u7684\u4f18\u70b9\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u5728\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u5b9e\u65f6\u6269\u5bb9\u3002\u5728\u5217\u8868\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u7531\u5730\u6dfb\u52a0\u5143\u7d20\uff0c\u800c\u4e0d\u7528\u62c5\u5fc3\u8d85\u8fc7\u5bb9\u91cf\u9650\u5236\u3002

"},{"location":"chapter_array_and_linkedlist/list/#431","title":"4.3.1. \u00a0 \u5217\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u521d\u59cb\u5316\u5217\u8868\u3002\u6211\u4eec\u901a\u5e38\u4f1a\u4f7f\u7528\u5230\u201c\u65e0\u521d\u59cb\u503c\u201d\u548c\u201c\u6709\u521d\u59cb\u503c\u201d\u7684\u4e24\u79cd\u521d\u59cb\u5316\u65b9\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nList<Integer> list1 = new ArrayList<>();\n// \u6709\u521d\u59cb\u503c\uff08\u6ce8\u610f\u6570\u7ec4\u7684\u5143\u7d20\u7c7b\u578b\u9700\u4e3a int[] \u7684\u5305\u88c5\u7c7b Integer[]\uff09\nInteger[] numbers = new Integer[] { 1, 3, 2, 5, 4 };\nList<Integer> list = new ArrayList<>(Arrays.asList(numbers));\n
list.cpp
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u9700\u6ce8\u610f\uff0cC++ \u4e2d vector \u5373\u662f\u672c\u6587\u63cf\u8ff0\u7684 list\n// \u65e0\u521d\u59cb\u503c\nvector<int> list1;\n// \u6709\u521d\u59cb\u503c\nvector<int> list = { 1, 3, 2, 5, 4 };\n
list.py
\"\"\" \u521d\u59cb\u5316\u5217\u8868 \"\"\"\n# \u65e0\u521d\u59cb\u503c\nlist1: List[int] = []\n# \u6709\u521d\u59cb\u503c\nlist: List[int] = [1, 3, 2, 5, 4]\n
list_test.go
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nlist1 := []int\n// \u6709\u521d\u59cb\u503c\nlist := []int{1, 3, 2, 5, 4}\n
list.js
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nconst list1 = [];\n// \u6709\u521d\u59cb\u503c\nconst list = [1, 3, 2, 5, 4];\n
list.ts
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nconst list1: number[] = [];\n// \u6709\u521d\u59cb\u503c\nconst list: number[] = [1, 3, 2, 5, 4];\n
list.c
\n
list.cs
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nList<int> list1 = new ();\n// \u6709\u521d\u59cb\u503c\nint[] numbers = new int[] { 1, 3, 2, 5, 4 };\nList<int> list = numbers.ToList();\n
list.swift
/* \u521d\u59cb\u5316\u5217\u8868 */\n// \u65e0\u521d\u59cb\u503c\nlet list1: [Int] = []\n// \u6709\u521d\u59cb\u503c\nvar list = [1, 3, 2, 5, 4]\n
list.zig
// \u521d\u59cb\u5316\u5217\u8868\nvar list = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer list.deinit();\ntry list.appendSlice(&[_]i32{ 1, 3, 2, 5, 4 });\n

\u8bbf\u95ee\u4e0e\u66f4\u65b0\u5143\u7d20\u3002\u5217\u8868\u7684\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u662f\u6570\u7ec4\uff0c\u56e0\u6b64\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u5185\u8bbf\u95ee\u4e0e\u66f4\u65b0\u5143\u7d20\uff0c\u6548\u7387\u5f88\u9ad8\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list.get(1);  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist.set(1, 0);  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.cpp
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.py
\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\nnum: int = list[1]  # \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n\"\"\" \u66f4\u65b0\u5143\u7d20 \"\"\"\nlist[1] = 0    # \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list_test.go
/* \u8bbf\u95ee\u5143\u7d20 */\nnum := list[1]  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0     // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.js
/* \u8bbf\u95ee\u5143\u7d20 */\nconst num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.ts
/* \u8bbf\u95ee\u5143\u7d20 */\nconst num: number = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.c
\n
list.cs
/* \u8bbf\u95ee\u5143\u7d20 */\nint num = list[1];  // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0;  // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.swift
/* \u8bbf\u95ee\u5143\u7d20 */\nlet num = list[1] // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n/* \u66f4\u65b0\u5143\u7d20 */\nlist[1] = 0 // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0\n
list.zig
// \u8bbf\u95ee\u5143\u7d20\nvar num = list.items[1]; // \u8bbf\u95ee\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\n// \u66f4\u65b0\u5143\u7d20\nlist.items[1] = 0; // \u5c06\u7d22\u5f15 1 \u5904\u7684\u5143\u7d20\u66f4\u65b0\u4e3a 0  \n

\u5728\u5217\u8868\u4e2d\u6dfb\u52a0\u3001\u63d2\u5165\u3001\u5220\u9664\u5143\u7d20\u3002\u76f8\u5bf9\u4e8e\u6570\u7ec4\uff0c\u5217\u8868\u53ef\u4ee5\u81ea\u7531\u5730\u6dfb\u52a0\u4e0e\u5220\u9664\u5143\u7d20\u3002\u5728\u5217\u8868\u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u4f46\u662f\u63d2\u5165\u4e0e\u5220\u9664\u5143\u7d20\u7684\u6548\u7387\u4ecd\u4e0e\u6570\u7ec4\u4e00\u6837\u4f4e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u6e05\u7a7a\u5217\u8868 */\nlist.clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.add(1);\nlist.add(3);\nlist.add(2);\nlist.add(5);\nlist.add(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.add(3, 6);  // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.remove(3);  // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.cpp
/* \u6e05\u7a7a\u5217\u8868 */\nlist.clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push_back(1);\nlist.push_back(3);\nlist.push_back(2);\nlist.push_back(5);\nlist.push_back(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.insert(list.begin() + 3, 6);  // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.erase(list.begin() + 3);      // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.py
\"\"\" \u6e05\u7a7a\u5217\u8868 \"\"\"\nlist.clear()\n\"\"\" \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 \"\"\"\nlist.append(1)\nlist.append(3)\nlist.append(2)\nlist.append(5)\nlist.append(4)\n\"\"\" \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 \"\"\"\nlist.insert(3, 6)  # \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n\"\"\" \u5220\u9664\u5143\u7d20 \"\"\"\nlist.pop(3)        # \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list_test.go
/* \u6e05\u7a7a\u5217\u8868 */\nlist = nil\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist = append(list, 1)\nlist = append(list, 3)\nlist = append(list, 2)\nlist = append(list, 5)\nlist = append(list, 4)\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist = append(list[:3], append([]int{6}, list[3:]...)...) // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist = append(list[:3], list[4:]...) // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.js
/* \u6e05\u7a7a\u5217\u8868 */\nlist.length = 0;\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push(1);\nlist.push(3);\nlist.push(2);\nlist.push(5);\nlist.push(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.splice(3, 0, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.splice(3, 1);\n
list.ts
/* \u6e05\u7a7a\u5217\u8868 */\nlist.length = 0;\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.push(1);\nlist.push(3);\nlist.push(2);\nlist.push(5);\nlist.push(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.splice(3, 0, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.splice(3, 1);\n
list.c
\n
list.cs
/* \u6e05\u7a7a\u5217\u8868 */\nlist.Clear();\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.Add(1);\nlist.Add(3);\nlist.Add(2);\nlist.Add(5);\nlist.Add(4);\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.Insert(3, 6);\n/* \u5220\u9664\u5143\u7d20 */\nlist.RemoveAt(3);\n
list.swift
/* \u6e05\u7a7a\u5217\u8868 */\nlist.removeAll()\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nlist.append(1)\nlist.append(3)\nlist.append(2)\nlist.append(5)\nlist.append(4)\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nlist.insert(6, at: 3) // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n/* \u5220\u9664\u5143\u7d20 */\nlist.remove(at: 3) // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n
list.zig
// \u6e05\u7a7a\u5217\u8868\nlist.clearRetainingCapacity();\n// \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\ntry list.append(1);\ntry list.append(3);\ntry list.append(2);\ntry list.append(5);\ntry list.append(4);\n// \u4e2d\u95f4\u63d2\u5165\u5143\u7d20\ntry list.insert(3, 6); // \u5728\u7d22\u5f15 3 \u5904\u63d2\u5165\u6570\u5b57 6\n// \u5220\u9664\u5143\u7d20\n_ = list.orderedRemove(3); // \u5220\u9664\u7d22\u5f15 3 \u5904\u7684\u5143\u7d20\n

\u904d\u5386\u5217\u8868\u3002\u4e0e\u6570\u7ec4\u4e00\u6837\uff0c\u5217\u8868\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u904d\u5386\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 for-each \u76f4\u63a5\u904d\u5386\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.size(); i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (int n : list) {\ncount++;\n}\n
list.cpp
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.size(); i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (int n : list) {\ncount++;\n}\n
list.py
\"\"\" \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 \"\"\"\ncount: int = 0\nfor i in range(len(list)):\ncount += 1\n\"\"\" \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 \"\"\"\ncount: int = 0\nfor n in list:\ncount += 1\n
list_test.go
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\ncount := 0\nfor i := 0; i < len(list); i++ {\ncount++\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0\nfor range list {\ncount++\n}\n
list.js
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nlet count = 0;\nfor (let i = 0; i < list.length; i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (const n of list) {\ncount++;\n}\n
list.ts
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nlet count = 0;\nfor (let i = 0; i < list.length; i++) {\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nfor (const n of list) {\ncount++;\n}\n
list.c
\n
list.cs
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nint count = 0;\nfor (int i = 0; i < list.Count(); i++)\n{\ncount++;\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0;\nforeach (int n in list)\n{\ncount++;\n}\n
list.swift
/* \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868 */\nvar count = 0\nfor _ in list.indices {\ncount += 1\n}\n/* \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20 */\ncount = 0\nfor _ in list {\ncount += 1\n}\n
list.zig
// \u901a\u8fc7\u7d22\u5f15\u904d\u5386\u5217\u8868\nvar count: i32 = 0;\nvar i: i32 = 0;\nwhile (i < list.items.len) : (i += 1) {\ncount += 1;\n}\n// \u76f4\u63a5\u904d\u5386\u5217\u8868\u5143\u7d20\ncount = 0;\nfor (list.items) |_| {\ncount += 1;\n}\n

\u62fc\u63a5\u4e24\u4e2a\u5217\u8868\u3002\u518d\u521b\u5efa\u4e00\u4e2a\u65b0\u5217\u8868 list1 \uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u4e2d\u4e00\u4e2a\u5217\u8868\u62fc\u63a5\u5230\u53e6\u4e00\u4e2a\u7684\u5c3e\u90e8\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nList<Integer> list1 = new ArrayList<>(Arrays.asList(new Integer[] { 6, 8, 7, 10, 9 }));\nlist.addAll(list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.cpp
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nvector<int> list1 = { 6, 8, 7, 10, 9 };\n// \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\nlist.insert(list.end(), list1.begin(), list1.end());\n
list.py
\"\"\" \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 \"\"\"\nlist1: List[int] = [6, 8, 7, 10, 9]\nlist += list1  # \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list_test.go
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nlist1 := []int{6, 8, 7, 10, 9}\nlist = append(list, list1...)  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.js
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nconst list1 = [6, 8, 7, 10, 9];\nlist.push(...list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.ts
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nconst list1: number[] = [6, 8, 7, 10, 9];\nlist.push(...list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.c
\n
list.cs
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nList<int> list1 = new() { 6, 8, 7, 10, 9 };\nlist.AddRange(list1);  // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.swift
/* \u62fc\u63a5\u4e24\u4e2a\u5217\u8868 */\nlet list1 = [6, 8, 7, 10, 9]\nlist.append(contentsOf: list1) // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n
list.zig
// \u62fc\u63a5\u4e24\u4e2a\u5217\u8868\nvar list1 = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer list1.deinit();\ntry list1.appendSlice(&[_]i32{ 6, 8, 7, 10, 9 });\ntry list.insertSlice(list.items.len, list1.items); // \u5c06\u5217\u8868 list1 \u62fc\u63a5\u5230 list \u4e4b\u540e\n

\u6392\u5e8f\u5217\u8868\u3002\u6392\u5e8f\u4e5f\u662f\u5e38\u7528\u7684\u65b9\u6cd5\u4e4b\u4e00\uff0c\u5b8c\u6210\u5217\u8868\u6392\u5e8f\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528\u5728\u6570\u7ec4\u7c7b\u7b97\u6cd5\u9898\u4e2d\u7ecf\u5e38\u8003\u5bdf\u7684\u300c\u4e8c\u5206\u67e5\u627e\u300d\u548c\u300c\u53cc\u6307\u9488\u300d\u7b97\u6cd5\u4e86\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig list.java
/* \u6392\u5e8f\u5217\u8868 */\nCollections.sort(list);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.cpp
/* \u6392\u5e8f\u5217\u8868 */\nsort(list.begin(), list.end());  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.py
\"\"\" \u6392\u5e8f\u5217\u8868 \"\"\"\nlist.sort()  # \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list_test.go
/* \u6392\u5e8f\u5217\u8868 */\nsort.Ints(list)  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.js
/* \u6392\u5e8f\u5217\u8868 */  list.sort((a, b) => a - b);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.ts
/* \u6392\u5e8f\u5217\u8868 */\nlist.sort((a, b) => a - b);  // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.c
\n
list.cs
/* \u6392\u5e8f\u5217\u8868 */\nlist.Sort(); // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.swift
/* \u6392\u5e8f\u5217\u8868 */\nlist.sort() // \u6392\u5e8f\u540e\uff0c\u5217\u8868\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\n
list.zig
// \u6392\u5e8f\u5217\u8868\nstd.sort.sort(i32, list.items, {}, comptime std.sort.asc(i32));\n
"},{"location":"chapter_array_and_linkedlist/list/#432","title":"4.3.2. \u00a0 \u5217\u8868\u7b80\u6613\u5b9e\u73b0 *","text":"

\u4e3a\u4e86\u5e2e\u52a9\u52a0\u6df1\u5bf9\u5217\u8868\u7684\u7406\u89e3\uff0c\u6211\u4eec\u5728\u6b64\u63d0\u4f9b\u4e00\u4e2a\u5217\u8868\u7684\u7b80\u6613\u7248\u672c\u7684\u5b9e\u73b0\u3002\u9700\u8981\u5173\u6ce8\u4e09\u4e2a\u6838\u5fc3\u70b9\uff1a

  • \u521d\u59cb\u5bb9\u91cf\uff1a\u9009\u53d6\u4e00\u4e2a\u5408\u7406\u7684\u6570\u7ec4\u7684\u521d\u59cb\u5bb9\u91cf initialCapacity \u3002\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9009\u62e9 10 \u4f5c\u4e3a\u521d\u59cb\u5bb9\u91cf\u3002
  • \u6570\u91cf\u8bb0\u5f55\uff1a\u9700\u8981\u58f0\u660e\u4e00\u4e2a\u53d8\u91cf size \uff0c\u7528\u6765\u8bb0\u5f55\u5217\u8868\u5f53\u524d\u6709\u591a\u5c11\u4e2a\u5143\u7d20\uff0c\u5e76\u968f\u7740\u5143\u7d20\u63d2\u5165\u4e0e\u5220\u9664\u5b9e\u65f6\u66f4\u65b0\u3002\u6839\u636e\u6b64\u53d8\u91cf\uff0c\u53ef\u4ee5\u5b9a\u4f4d\u5217\u8868\u7684\u5c3e\u90e8\uff0c\u4ee5\u53ca\u5224\u65ad\u662f\u5426\u9700\u8981\u6269\u5bb9\u3002
  • \u6269\u5bb9\u673a\u5236\uff1a\u63d2\u5165\u5143\u7d20\u6709\u53ef\u80fd\u5bfc\u81f4\u8d85\u51fa\u5217\u8868\u5bb9\u91cf\uff0c\u6b64\u65f6\u9700\u8981\u6269\u5bb9\u5217\u8868\uff0c\u65b9\u6cd5\u662f\u5efa\u7acb\u4e00\u4e2a\u66f4\u5927\u7684\u6570\u7ec4\u6765\u66ff\u6362\u5f53\u524d\u6570\u7ec4\u3002\u9700\u8981\u7ed9\u5b9a\u4e00\u4e2a\u6269\u5bb9\u500d\u6570 extendRatio \uff0c\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u89c4\u5b9a\u6bcf\u6b21\u5c06\u6570\u7ec4\u6269\u5bb9\u81f3\u4e4b\u524d\u7684 2 \u500d\u3002

\u672c\u793a\u4f8b\u662f\u4e3a\u4e86\u5e2e\u52a9\u8bfb\u8005\u5bf9\u5982\u4f55\u5b9e\u73b0\u5217\u8868\u4ea7\u751f\u76f4\u89c2\u7684\u8ba4\u8bc6\u3002\u5b9e\u9645\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u5217\u8868\u7684\u5b9e\u73b0\u8fdc\u6bd4\u4ee5\u4e0b\u4ee3\u7801\u590d\u6742\u4e14\u6807\u51c6\uff0c\u611f\u5174\u8da3\u7684\u8bfb\u8005\u53ef\u4ee5\u67e5\u9605\u6e90\u7801\u5b66\u4e60\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_list.java
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate int[] nums;           // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate int capacity = 10;    // \u5217\u8868\u5bb9\u91cf\nprivate int size = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate int extendRatio = 2;  // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\npublic MyList() {\nnums = new int[capacity];\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic int size() {\nreturn size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic int capacity() {\nreturn capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic int get(int index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic void set(int index, int num) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic void add(int num) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size == capacity())\nextendCapacity();\nnums[size] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic void insert(int index, int num) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size == capacity())\nextendCapacity();\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = size - 1; j >= index; j--) {\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic int remove(int index) {\nif (index < 0 || index >= size)\nthrow new IndexOutOfBoundsException(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < size - 1; j++) {\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nsize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic void extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nnums = Arrays.copyOf(nums, capacity() * extendRatio);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\ncapacity = nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic int[] toArray() {\nint size = size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] nums = new int[size];\nfor (int i = 0; i < size; i++) {\nnums[i] = get(i);\n}\nreturn nums;\n}\n}\n
my_list.cpp
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate:\nint* nums;                // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nint numsCapacity = 10;    // \u5217\u8868\u5bb9\u91cf\nint numsSize = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nint extendRatio = 2;      // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nMyList() {\nnums = new int[numsCapacity];\n}\n/* \u6790\u6784\u65b9\u6cd5 */\n~MyList() {\ndelete[] nums;\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nint size() {\nreturn numsSize;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nint capacity() {\nreturn numsCapacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nint get(int index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nvoid set(int index, int num) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nvoid add(int num) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size() == capacity())\nextendCapacity();\nnums[size()] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nvoid insert(int index, int num) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (size() == capacity())\nextendCapacity();\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = size() - 1; j >= index; j--) {\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\nint remove(int index) {\nif (index < 0 || index >= size())\nthrow out_of_range(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < size() - 1; j++) {\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\nvoid extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nint newCapacity = capacity() * extendRatio;\nint* tmp = nums;\nnums = new int[newCapacity];\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nfor (int i = 0; i < size(); i++) {\nnums[i] = tmp[i];\n}\n// \u91ca\u653e\u5185\u5b58\ndelete[] tmp;\nnumsCapacity = newCapacity;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a Vector \u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> vec(size());\nfor (int i = 0; i < size(); i++) {\nvec[i] = nums[i];\n}\nreturn vec;\n}\n};\n
my_list.py
class MyList:\n\"\"\" \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__capacity: int = 10                       # \u5217\u8868\u5bb9\u91cf\nself.__nums: List[int] = [0] * self.__capacity  # \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nself.__size: int = 0                            # \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nself.__extend_ratio: int = 2                    # \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09 \"\"\"\nreturn self.__size\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u5217\u8868\u5bb9\u91cf \"\"\"\nreturn self.__capacity\ndef get(self, index: int) -> int:\n\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\n# \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nreturn self.__nums[index]\ndef set(self, num: int, index: int) -> None:\n\"\"\" \u66f4\u65b0\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nself.__nums[index] = num\ndef add(self, num: int) -> None:\n\"\"\" \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 \"\"\"\n# \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif self.size() == self.capacity():\nself.extend_capacity()\nself.__nums[self.__size] = num\nself.__size += 1\ndef insert(self, num: int, index: int) -> None:\n\"\"\" \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\n# \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif self.__size == self.capacity():\nself.extend_capacity()\n# \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j in range(self.__size - 1, index - 1, -1):\nself.__nums[j + 1] = self.__nums[j]\nself.__nums[index] = num\n# \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.__size += 1\ndef remove(self, index: int) -> int:\n\"\"\" \u5220\u9664\u5143\u7d20 \"\"\"\nassert index >= 0 and index < self.__size, \"\u7d22\u5f15\u8d8a\u754c\"\nnum = self.__nums[index]\n# \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j in range(index, self.__size - 1):\nself.__nums[j] = self.__nums[j + 1]\n# \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.__size -= 1\n# \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\ndef extend_capacity(self) -> None:\n\"\"\" \u5217\u8868\u6269\u5bb9 \"\"\"\n# \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a self.__size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nself.__nums = self.__nums + [0] * self.capacity() * (self.__extend_ratio - 1)\n# \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nself.__capacity = len(self.__nums)\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6709\u6548\u957f\u5ea6\u7684\u5217\u8868 \"\"\"\nreturn self.__nums[:self.__size]\n
my_list.go
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\ntype myList struct {\nnumsCapacity int\nnums         []int\nnumsSize     int\nextendRatio  int\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newMyList() *myList {\nreturn &myList{\nnumsCapacity: 10,              // \u5217\u8868\u5bb9\u91cf\nnums:         make([]int, 10), // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nnumsSize:     0,               // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nextendRatio:  2,               // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n}\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09 */\nfunc (l *myList) size() int {\nreturn l.numsSize\n}\n/*  \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nfunc (l *myList) capacity() int {\nreturn l.numsCapacity\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nfunc (l *myList) get(index int) int {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nreturn l.nums[index]\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nfunc (l *myList) set(num, index int) {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nl.nums[index] = num\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nfunc (l *myList) add(num int) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif l.numsSize == l.numsCapacity {\nl.extendCapacity()\n}\nl.nums[l.numsSize] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize++\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nfunc (l *myList) insert(num, index int) {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif l.numsSize == l.numsCapacity {\nl.extendCapacity()\n}\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j := l.numsSize - 1; j >= index; j-- {\nl.nums[j+1] = l.nums[j]\n}\nl.nums[index] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize++\n}\n/* \u5220\u9664\u5143\u7d20 */\nfunc (l *myList) remove(index int) int {\nif index < 0 || index >= l.numsSize {\npanic(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nnum := l.nums[index]\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j := index; j < l.numsSize-1; j++ {\nl.nums[j] = l.nums[j+1]\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nl.numsSize--\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\n}\n/* \u5217\u8868\u6269\u5bb9 */\nfunc (l *myList) extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a self.__size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nl.nums = append(l.nums, make([]int, l.numsCapacity*(l.extendRatio-1))...)\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nl.numsCapacity = len(l.nums)\n}\n/* \u8fd4\u56de\u6709\u6548\u957f\u5ea6\u7684\u5217\u8868 */\nfunc (l *myList) toArray() []int {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nreturn l.nums[:l.numsSize]\n}\n
my_list.js
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\n#nums = new Array(); // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\n#capacity = 10; // \u5217\u8868\u5bb9\u91cf\n#size = 0; // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\n#extendRatio = 2; // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor() {\nthis.#nums = new Array(this.#capacity);\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nsize() {\nreturn this.#size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\ncapacity() {\nreturn this.#capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nget(index) {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nreturn this.#nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nset(index, num) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nthis.#nums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nadd(num) {\n// \u5982\u679c\u957f\u5ea6\u7b49\u4e8e\u5bb9\u91cf\uff0c\u5219\u9700\u8981\u6269\u5bb9\nif (this.#size === this.#capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u65b0\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u5c3e\u90e8\nthis.#nums[this.#size] = num;\nthis.#size++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\ninsert(index, num) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (this.#size === this.#capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let j = this.#size - 1; j >= index; j--) {\nthis.#nums[j + 1] = this.#nums[j];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.#nums[index] = num;\nthis.#size++;\n}\n/* \u5220\u9664\u5143\u7d20 */\nremove(index) {\nif (index < 0 || index >= this.#size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nlet num = this.#nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let j = index; j < this.#size - 1; j++) {\nthis.#nums[j] = this.#nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.#size--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\nextendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nthis.#nums = this.#nums.concat(\nnew Array(this.capacity() * (this.#extendRatio - 1))\n);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nthis.#capacity = this.#nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\ntoArray() {\nlet size = this.size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst nums = new Array(size);\nfor (let i = 0; i < size; i++) {\nnums[i] = this.get(i);\n}\nreturn nums;\n}\n}\n
my_list.ts
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate nums: Array<number>; // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate _capacity: number = 10; // \u5217\u8868\u5bb9\u91cf\nprivate _size: number = 0; // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate extendRatio: number = 2; // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor() {\nthis.nums = new Array(this._capacity);\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic size(): number {\nreturn this._size;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic capacity(): number {\nreturn this._capacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic get(index: number): number {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nreturn this.nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic set(index: number, num: number): void {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nthis.nums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic add(num: number): void {\n// \u5982\u679c\u957f\u5ea6\u7b49\u4e8e\u5bb9\u91cf\uff0c\u5219\u9700\u8981\u6269\u5bb9\nif (this._size === this._capacity)\nthis.extendCapacity();\n// \u5c06\u65b0\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u5c3e\u90e8\nthis.nums[this._size] = num;\nthis._size++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic insert(index: number, num: number): void {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (this._size === this._capacity) {\nthis.extendCapacity();\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (let j = this._size - 1; j >= index; j--) {\nthis.nums[j + 1] = this.nums[j];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis.nums[index] = num;\nthis._size++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic remove(index: number): number {\nif (index < 0 || index >= this._size)\nthrow new Error('\u7d22\u5f15\u8d8a\u754c');\nlet num = this.nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (let j = index; j < this._size - 1; j++) {\nthis.nums[j] = this.nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nthis._size--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic extendCapacity(): void {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nthis.nums = this.nums.concat(\nnew Array(this.capacity() * (this.extendRatio - 1))\n);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nthis._capacity = this.nums.length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic toArray(): number[] {\nlet size = this.size();\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst nums = new Array(size);\nfor (let i = 0; i < size; i++) {\nnums[i] = this.get(i);\n}\nreturn nums;\n}\n}\n
my_list.c
[class]{myList}-[func]{}\n
my_list.cs
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList\n{\nprivate int[] nums;           // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate int numsCapacity = 10;    // \u5217\u8868\u5bb9\u91cf\nprivate int numsSize = 0;         // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate int extendRatio = 2;  // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\npublic MyList()\n{\nnums = new int[numsCapacity];\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\npublic int size()\n{\nreturn numsSize;\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\npublic int capacity()\n{\nreturn numsCapacity;\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\npublic int get(int index)\n{\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn nums[index];\n}\n/* \u66f4\u65b0\u5143\u7d20 */\npublic void set(int index, int num)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nnums[index] = num;\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\npublic void add(int num)\n{\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (numsSize == numsCapacity)\nextendCapacity();\nnums[numsSize] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\npublic void insert(int index, int num)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (numsSize == numsCapacity)\nextendCapacity();\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor (int j = numsSize - 1; j >= index; j--)\n{\nnums[j + 1] = nums[j];\n}\nnums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize++;\n}\n/* \u5220\u9664\u5143\u7d20 */\npublic int remove(int index)\n{\nif (index < 0 || index >= numsSize)\nthrow new IndexOutOfRangeException(\"\u7d22\u5f15\u8d8a\u754c\");\nint num = nums[index];\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor (int j = index; j < numsSize - 1; j++)\n{\nnums[j] = nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nnumsSize--;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n/* \u5217\u8868\u6269\u5bb9 */\npublic void extendCapacity()\n{\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a numsCapacity * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nSystem.Array.Resize(ref nums, numsCapacity * extendRatio);\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nnumsCapacity = nums.Length;\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\npublic int[] toArray()\n{\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] nums = new int[numsSize];\nfor (int i = 0; i < numsSize; i++)\n{\nnums[i] = get(i);\n}\nreturn nums;\n}\n}\n
my_list.swift
/* \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0 */\nclass MyList {\nprivate var nums: [Int] // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nprivate var _capacity = 10 // \u5217\u8868\u5bb9\u91cf\nprivate var _size = 0 // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nprivate let extendRatio = 2 // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\n/* \u6784\u9020\u65b9\u6cd5 */\ninit() {\nnums = Array(repeating: 0, count: _capacity)\n}\n/* \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09*/\nfunc size() -> Int {\n_size\n}\n/* \u83b7\u53d6\u5217\u8868\u5bb9\u91cf */\nfunc capacity() -> Int {\n_capacity\n}\n/* \u8bbf\u95ee\u5143\u7d20 */\nfunc get(index: Int) -> Int {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u9519\u8bef\uff0c\u4e0b\u540c\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nreturn nums[index]\n}\n/* \u66f4\u65b0\u5143\u7d20 */\nfunc set(index: Int, num: Int) {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nnums[index] = num\n}\n/* \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20 */\nfunc add(num: Int) {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif _size == _capacity {\nextendCapacity()\n}\nnums[_size] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size += 1\n}\n/* \u4e2d\u95f4\u63d2\u5165\u5143\u7d20 */\nfunc insert(index: Int, num: Int) {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif _size == _capacity {\nextendCapacity()\n}\n// \u5c06\u7d22\u5f15 index \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfor j in sequence(first: _size - 1, next: { $0 >= index + 1 ? $0 - 1 : nil }) {\nnums[j + 1] = nums[j]\n}\nnums[index] = num\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size += 1\n}\n/* \u5220\u9664\u5143\u7d20 */\n@discardableResult\nfunc remove(index: Int) -> Int {\nif index < 0 || index >= _size {\nfatalError(\"\u7d22\u5f15\u8d8a\u754c\")\n}\nlet num = nums[index]\n// \u5c06\u7d22\u5f15 index \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nfor j in index ..< (_size - 1) {\nnums[j] = nums[j + 1]\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\n_size -= 1\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num\n}\n/* \u5217\u8868\u6269\u5bb9 */\nfunc extendCapacity() {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nnums = nums + Array(repeating: 0, count: _capacity * (extendRatio - 1))\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\n_capacity = nums.count\n}\n/* \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4 */\nfunc toArray() -> [Int] {\nvar nums = Array(repeating: 0, count: _size)\nfor i in 0 ..< _size {\nnums[i] = get(index: i)\n}\nreturn nums\n}\n}\n
my_list.zig
// \u5217\u8868\u7c7b\u7b80\u6613\u5b9e\u73b0\nfn MyList(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nnums: []T = undefined,                        // \u6570\u7ec4\uff08\u5b58\u50a8\u5217\u8868\u5143\u7d20\uff09\nnumsCapacity: usize = 10,                     // \u5217\u8868\u5bb9\u91cf\nnumSize: usize = 0,                           // \u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\nextendRatio: usize = 2,                       // \u6bcf\u6b21\u5217\u8868\u6269\u5bb9\u7684\u500d\u6570\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined, // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u5217\u8868\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.nums = try self.mem_allocator.alloc(T, self.numsCapacity);\nstd.mem.set(T, self.nums, @as(T, 0));\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u5217\u8868\u957f\u5ea6\uff08\u5373\u5f53\u524d\u5143\u7d20\u6570\u91cf\uff09\npub fn size(self: *Self) usize {\nreturn self.numSize;\n}\n// \u83b7\u53d6\u5217\u8868\u5bb9\u91cf\npub fn capacity(self: *Self) usize {\nreturn self.numsCapacity;\n}\n// \u8bbf\u95ee\u5143\u7d20\npub fn get(self: *Self, index: usize) T {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nreturn self.nums[index];\n}  // \u66f4\u65b0\u5143\u7d20\npub fn set(self: *Self, index: usize, num: T) void {\n// \u7d22\u5f15\u5982\u679c\u8d8a\u754c\u5219\u629b\u51fa\u5f02\u5e38\uff0c\u4e0b\u540c\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nself.nums[index] = num;\n}  // \u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\npub fn add(self: *Self, num: T) !void {\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (self.size() == self.capacity()) try self.extendCapacity();\nself.nums[self.size()] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize += 1;\n}  // \u4e2d\u95f4\u63d2\u5165\u5143\u7d20\npub fn insert(self: *Self, index: usize, num: T) !void {\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\n// \u5143\u7d20\u6570\u91cf\u8d85\u51fa\u5bb9\u91cf\u65f6\uff0c\u89e6\u53d1\u6269\u5bb9\u673a\u5236\nif (self.size() == self.capacity()) try self.extendCapacity();\n// \u7d22\u5f15 i \u4ee5\u53ca\u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nvar j = self.size() - 1;\nwhile (j >= index) : (j -= 1) {\nself.nums[j + 1] = self.nums[j];\n}\nself.nums[index] = num;\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize += 1;\n}\n// \u5220\u9664\u5143\u7d20\npub fn remove(self: *Self, index: usize) T {\nif (index < 0 or index >= self.size()) @panic(\"\u7d22\u5f15\u8d8a\u754c\");\nvar num = self.nums[index];\n// \u7d22\u5f15 i \u4e4b\u540e\u7684\u5143\u7d20\u90fd\u5411\u524d\u79fb\u52a8\u4e00\u4f4d\nvar j = index;\nwhile (j < self.size() - 1) : (j += 1) {\nself.nums[j] = self.nums[j + 1];\n}\n// \u66f4\u65b0\u5143\u7d20\u6570\u91cf\nself.numSize -= 1;\n// \u8fd4\u56de\u88ab\u5220\u9664\u5143\u7d20\nreturn num;\n}\n// \u5217\u8868\u6269\u5bb9\npub fn extendCapacity(self: *Self) !void {\n// \u65b0\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a size * extendRatio \u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u539f\u6570\u7ec4\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\nvar newCapacity = self.capacity() * self.extendRatio;\nvar extend = try self.mem_allocator.alloc(T, newCapacity);\nstd.mem.set(T, extend, @as(T, 0));\n// \u5c06\u539f\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u590d\u5236\u5230\u65b0\u6570\u7ec4\nstd.mem.copy(T, extend, self.nums);\nself.nums = extend;\n// \u66f4\u65b0\u5217\u8868\u5bb9\u91cf\nself.numsCapacity = newCapacity;\n}\n// \u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar nums = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, nums, @as(T, 0));\nfor (nums) |*num, i| {\nnum.* = self.get(i);\n}\nreturn nums;\n}\n};\n}\n
"},{"location":"chapter_array_and_linkedlist/summary/","title":"4.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u6570\u7ec4\u548c\u94fe\u8868\u662f\u4e24\u79cd\u57fa\u672c\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u4e24\u79cd\u5b58\u50a8\u65b9\u5f0f\uff0c\u5373\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\u548c\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\u3002\u4e24\u8005\u7684\u4f18\u70b9\u4e0e\u7f3a\u70b9\u5448\u73b0\u51fa\u6b64\u6d88\u5f7c\u957f\u7684\u5173\u7cfb\u3002
  • \u6570\u7ec4\u652f\u6301\u968f\u673a\u8bbf\u95ee\u3001\u5185\u5b58\u7a7a\u95f4\u5360\u7528\u5c0f\uff1b\u4f46\u63d2\u5165\u4e0e\u5220\u9664\u5143\u7d20\u6548\u7387\u4f4e\uff0c\u4e14\u521d\u59cb\u5316\u540e\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002
  • \u94fe\u8868\u53ef\u901a\u8fc7\u66f4\u6539\u6307\u9488\u5b9e\u73b0\u9ad8\u6548\u7684\u7ed3\u70b9\u63d2\u5165\u4e0e\u5220\u9664\uff0c\u5e76\u4e14\u53ef\u4ee5\u7075\u6d3b\u5730\u4fee\u6539\u957f\u5ea6\uff1b\u4f46\u7ed3\u70b9\u8bbf\u95ee\u6548\u7387\u4f4e\u3001\u5360\u7528\u5185\u5b58\u591a\u3002\u5e38\u89c1\u7684\u94fe\u8868\u7c7b\u578b\u6709\u5355\u5411\u94fe\u8868\u3001\u5faa\u73af\u94fe\u8868\u3001\u53cc\u5411\u94fe\u8868\u3002
  • \u5217\u8868\u53c8\u79f0\u52a8\u6001\u6570\u7ec4\uff0c\u662f\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u4e00\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u5176\u4fdd\u5b58\u4e86\u6570\u7ec4\u7684\u4f18\u52bf\uff0c\u4e14\u53ef\u4ee5\u7075\u6d3b\u6539\u53d8\u957f\u5ea6\u3002\u5217\u8868\u7684\u51fa\u73b0\u5927\u5927\u63d0\u5347\u4e86\u6570\u7ec4\u7684\u5b9e\u7528\u6027\uff0c\u4f46\u526f\u4f5c\u7528\u662f\u4f1a\u9020\u6210\u90e8\u5206\u5185\u5b58\u7a7a\u95f4\u6d6a\u8d39\u3002
  • \u4e0b\u8868\u603b\u7ed3\u5bf9\u6bd4\u4e86\u6570\u7ec4\u4e0e\u94fe\u8868\u7684\u5404\u9879\u7279\u6027\u3002
\u6570\u7ec4 \u94fe\u8868 \u5b58\u50a8\u65b9\u5f0f \u8fde\u7eed\u5185\u5b58\u7a7a\u95f4 \u79bb\u6563\u5185\u5b58\u7a7a\u95f4 \u6570\u636e\u7ed3\u6784\u957f\u5ea6 \u957f\u5ea6\u4e0d\u53ef\u53d8 \u957f\u5ea6\u53ef\u53d8 \u5185\u5b58\u4f7f\u7528\u7387 \u5360\u7528\u5185\u5b58\u5c11\u3001\u7f13\u5b58\u5c40\u90e8\u6027\u597d \u5360\u7528\u5185\u5b58\u591a \u4f18\u52bf\u64cd\u4f5c \u968f\u673a\u8bbf\u95ee \u63d2\u5165\u3001\u5220\u9664

\u7f13\u5b58\u5c40\u90e8\u6027\u7684\u7b80\u5355\u89e3\u91ca

\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c\u6570\u636e\u8bfb\u5199\u901f\u5ea6\u6392\u5e8f\u662f\u201c\u786c\u76d8 < \u5185\u5b58 < CPU \u7f13\u5b58\u201d\u3002\u5f53\u6211\u4eec\u8bbf\u95ee\u6570\u7ec4\u5143\u7d20\u65f6\uff0c\u8ba1\u7b97\u673a\u4e0d\u4ec5\u4f1a\u52a0\u8f7d\u5b83\uff0c\u8fd8\u4f1a\u7f13\u5b58\u5176\u5468\u56f4\u7684\u5176\u5b83\u6570\u636e\uff0c\u4ece\u800c\u501f\u52a9\u9ad8\u901f\u7f13\u5b58\u6765\u63d0\u5347\u540e\u7eed\u64cd\u4f5c\u7684\u6267\u884c\u901f\u5ea6\u3002\u94fe\u8868\u5219\u4e0d\u7136\uff0c\u8ba1\u7b97\u673a\u53ea\u80fd\u6328\u4e2a\u5730\u7f13\u5b58\u5404\u4e2a\u7ed3\u70b9\uff0c\u8fd9\u6837\u7684\u591a\u6b21\u201c\u642c\u8fd0\u201d\u964d\u4f4e\u4e86\u6574\u4f53\u6548\u7387\u3002

  • \u4e0b\u8868\u5bf9\u6bd4\u4e86\u6570\u7ec4\u4e0e\u94fe\u8868\u7684\u5404\u79cd\u64cd\u4f5c\u6548\u7387\u3002
\u64cd\u4f5c \u6570\u7ec4 \u94fe\u8868 \u8bbf\u95ee\u5143\u7d20 \\(O(1)\\) \\(O(N)\\) \u6dfb\u52a0\u5143\u7d20 \\(O(N)\\) \\(O(1)\\) \u5220\u9664\u5143\u7d20 \\(O(N)\\) \\(O(1)\\)"},{"location":"chapter_computational_complexity/performance_evaluation/","title":"2.1. \u00a0 \u7b97\u6cd5\u6548\u7387\u8bc4\u4f30","text":""},{"location":"chapter_computational_complexity/performance_evaluation/#211","title":"2.1.1. \u00a0 \u7b97\u6cd5\u8bc4\u4ef7\u7ef4\u5ea6","text":"

\u5728\u5f00\u59cb\u5b66\u4e60\u7b97\u6cd5\u4e4b\u524d\uff0c\u6211\u4eec\u9996\u5148\u8981\u60f3\u6e05\u695a\u7b97\u6cd5\u7684\u8bbe\u8ba1\u76ee\u6807\u662f\u4ec0\u4e48\uff0c\u6216\u8005\u8bf4\uff0c\u5982\u4f55\u6765\u8bc4\u5224\u7b97\u6cd5\u7684\u597d\u4e0e\u574f\u3002\u6574\u4f53\u4e0a\u770b\uff0c\u6211\u4eec\u8bbe\u8ba1\u7b97\u6cd5\u65f6\u8ffd\u6c42\u4e24\u4e2a\u5c42\u9762\u7684\u76ee\u6807\u3002

  1. \u627e\u5230\u95ee\u9898\u89e3\u6cd5\u3002\u7b97\u6cd5\u9700\u8981\u80fd\u591f\u5728\u89c4\u5b9a\u7684\u8f93\u5165\u8303\u56f4\u4e0b\uff0c\u53ef\u9760\u5730\u6c42\u5f97\u95ee\u9898\u7684\u6b63\u786e\u89e3\u3002
  2. \u5bfb\u6c42\u6700\u4f18\u89e3\u6cd5\u3002\u540c\u4e00\u4e2a\u95ee\u9898\u53ef\u80fd\u5b58\u5728\u591a\u79cd\u89e3\u6cd5\uff0c\u800c\u6211\u4eec\u5e0c\u671b\u7b97\u6cd5\u6548\u7387\u5c3d\u53ef\u80fd\u7684\u9ad8\u3002

\u6362\u8a00\u4e4b\uff0c\u5728\u53ef\u4ee5\u89e3\u51b3\u95ee\u9898\u7684\u524d\u63d0\u4e0b\uff0c\u7b97\u6cd5\u6548\u7387\u5219\u662f\u4e3b\u8981\u8bc4\u4ef7\u7ef4\u5ea6\uff0c\u5305\u62ec\uff1a

  • \u65f6\u95f4\u6548\u7387\uff0c\u5373\u7b97\u6cd5\u7684\u8fd0\u884c\u901f\u5ea6\u7684\u5feb\u6162\u3002
  • \u7a7a\u95f4\u6548\u7387\uff0c\u5373\u7b97\u6cd5\u5360\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u5927\u5c0f\u3002

\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u8ffd\u6c42\u201c\u8fd0\u884c\u901f\u5ea6\u5feb\u3001\u5360\u7528\u5185\u5b58\u5c11\u201d\uff0c\u800c\u5982\u4f55\u53bb\u8bc4\u4ef7\u7b97\u6cd5\u6548\u7387\u5219\u662f\u975e\u5e38\u91cd\u8981\u7684\u95ee\u9898\uff0c\u56e0\u4e3a\u53ea\u6709\u77e5\u9053\u5982\u4f55\u8bc4\u4ef7\u7b97\u6cd5\uff0c\u624d\u80fd\u53bb\u505a\u7b97\u6cd5\u4e4b\u95f4\u7684\u5bf9\u6bd4\u5206\u6790\uff0c\u4ee5\u53ca\u4f18\u5316\u7b97\u6cd5\u8bbe\u8ba1\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#212","title":"2.1.2. \u00a0 \u6548\u7387\u8bc4\u4f30\u65b9\u6cd5","text":""},{"location":"chapter_computational_complexity/performance_evaluation/#_1","title":"\u5b9e\u9645\u6d4b\u8bd5","text":"

\u5047\u8bbe\u6211\u4eec\u73b0\u5728\u6709\u7b97\u6cd5 A \u548c \u7b97\u6cd5 B \uff0c\u90fd\u80fd\u591f\u89e3\u51b3\u540c\u4e00\u95ee\u9898\uff0c\u73b0\u5728\u9700\u8981\u5bf9\u6bd4\u4e24\u4e2a\u7b97\u6cd5\u4e4b\u95f4\u7684\u6548\u7387\u3002\u6211\u4eec\u80fd\u591f\u60f3\u5230\u7684\u6700\u76f4\u63a5\u7684\u65b9\u5f0f\uff0c\u5c31\u662f\u627e\u4e00\u53f0\u8ba1\u7b97\u673a\uff0c\u628a\u4e24\u4e2a\u7b97\u6cd5\u90fd\u5b8c\u6574\u8dd1\u4e00\u904d\uff0c\u5e76\u76d1\u63a7\u8bb0\u5f55\u8fd0\u884c\u65f6\u95f4\u548c\u5185\u5b58\u5360\u7528\u60c5\u51b5\u3002\u8fd9\u79cd\u8bc4\u4f30\u65b9\u5f0f\u80fd\u591f\u53cd\u6620\u771f\u5b9e\u60c5\u51b5\uff0c\u4f46\u662f\u4e5f\u5b58\u5728\u5f88\u5927\u7684\u786c\u4f24\u3002

\u96be\u4ee5\u6392\u9664\u6d4b\u8bd5\u73af\u5883\u7684\u5e72\u6270\u56e0\u7d20\u3002\u786c\u4ef6\u914d\u7f6e\u4f1a\u5f71\u54cd\u5230\u7b97\u6cd5\u7684\u6027\u80fd\u8868\u73b0\u3002\u4f8b\u5982\uff0c\u5728\u67d0\u53f0\u8ba1\u7b97\u673a\u4e2d\uff0c\u7b97\u6cd5 A \u6bd4\u7b97\u6cd5 B \u8fd0\u884c\u65f6\u95f4\u66f4\u77ed\uff1b\u4f46\u6362\u5230\u53e6\u4e00\u53f0\u914d\u7f6e\u4e0d\u540c\u7684\u8ba1\u7b97\u673a\u4e2d\uff0c\u53ef\u80fd\u4f1a\u5f97\u5230\u76f8\u53cd\u7684\u6d4b\u8bd5\u7ed3\u679c\u3002\u8fd9\u610f\u5473\u7740\u6211\u4eec\u9700\u8981\u5728\u5404\u79cd\u673a\u5668\u4e0a\u5c55\u5f00\u6d4b\u8bd5\uff0c\u800c\u8fd9\u662f\u4e0d\u73b0\u5b9e\u7684\u3002

\u5c55\u5f00\u5b8c\u6574\u6d4b\u8bd5\u975e\u5e38\u8017\u8d39\u8d44\u6e90\u3002\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u7684\u5927\u5c0f\u53d8\u5316\uff0c\u7b97\u6cd5\u4f1a\u5448\u73b0\u51fa\u4e0d\u540c\u7684\u6548\u7387\u8868\u73b0\u3002\u6bd4\u5982\uff0c\u6709\u53ef\u80fd\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5c0f\u65f6\uff0c\u7b97\u6cd5 A \u8fd0\u884c\u65f6\u95f4\u77ed\u4e8e\u7b97\u6cd5 B \uff0c\u800c\u5728\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5927\u65f6\uff0c\u6d4b\u8bd5\u7ed3\u679c\u622a\u7136\u76f8\u53cd\u3002\u56e0\u6b64\uff0c\u82e5\u60f3\u8981\u8fbe\u5230\u5177\u6709\u8bf4\u670d\u529b\u7684\u5bf9\u6bd4\u7ed3\u679c\uff0c\u90a3\u4e48\u9700\u8981\u8f93\u5165\u5404\u79cd\u4f53\u91cf\u6570\u636e\uff0c\u8fd9\u6837\u7684\u6d4b\u8bd5\u9700\u8981\u5360\u7528\u5927\u91cf\u8ba1\u7b97\u8d44\u6e90\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#_2","title":"\u7406\u8bba\u4f30\u7b97","text":"

\u65e2\u7136\u5b9e\u9645\u6d4b\u8bd5\u5177\u6709\u5f88\u5927\u7684\u5c40\u9650\u6027\uff0c\u90a3\u4e48\u6211\u4eec\u662f\u5426\u53ef\u4ee5\u4ec5\u901a\u8fc7\u4e00\u4e9b\u8ba1\u7b97\uff0c\u5c31\u83b7\u77e5\u7b97\u6cd5\u7684\u6548\u7387\u6c34\u5e73\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\uff0c\u6211\u4eec\u5c06\u6b64\u4f30\u7b97\u65b9\u6cd5\u79f0\u4e3a\u300c\u590d\u6742\u5ea6\u5206\u6790 Complexity Analysis\u300d\u6216\u300c\u6e10\u8fd1\u590d\u6742\u5ea6\u5206\u6790 Asymptotic Complexity Analysis\u300d\u3002

\u590d\u6742\u5ea6\u5206\u6790\u8bc4\u4f30\u7684\u662f\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u589e\u591a\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002\u8fd9\u53e5\u8bdd\u6709\u4e9b\u62d7\u53e3\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u5206\u4e3a\u4e09\u4e2a\u91cd\u70b9\u6765\u7406\u89e3\uff1a

  • \u201c\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u201d\u53ef\u5206\u4e3a\u201c\u8fd0\u884c\u65f6\u95f4\u201d\u548c\u201c\u5360\u7528\u7a7a\u95f4\u201d\uff0c\u8fdb\u800c\u53ef\u5c06\u590d\u6742\u5ea6\u5206\u4e3a\u300c\u65f6\u95f4\u590d\u6742\u5ea6 Time Complexity\u300d\u548c\u300c\u7a7a\u95f4\u590d\u6742\u5ea6 Space Complexity\u300d\u3002
  • \u201c\u968f\u7740\u8f93\u5165\u6570\u636e\u91cf\u589e\u591a\u65f6\u201d\u4ee3\u8868\u590d\u6742\u5ea6\u4e0e\u8f93\u5165\u6570\u636e\u91cf\u6709\u5173\uff0c\u53cd\u6620\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u4e0e\u8f93\u5165\u6570\u636e\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\uff1b
  • \u201c\u589e\u957f\u8d8b\u52bf\u201d\u8868\u793a\u590d\u6742\u5ea6\u5206\u6790\u4e0d\u5173\u5fc3\u7b97\u6cd5\u5177\u4f53\u4f7f\u7528\u4e86\u591a\u5c11\u65f6\u95f4\u6216\u5360\u7528\u4e86\u591a\u5c11\u7a7a\u95f4\uff0c\u800c\u662f\u7ed9\u51fa\u4e00\u79cd\u201c\u8d8b\u52bf\u6027\u5206\u6790\u201d\uff1b

\u590d\u6742\u5ea6\u5206\u6790\u514b\u670d\u4e86\u5b9e\u9645\u6d4b\u8bd5\u65b9\u6cd5\u7684\u5f0a\u7aef\u3002\u4e00\u662f\u72ec\u7acb\u4e8e\u6d4b\u8bd5\u73af\u5883\uff0c\u5206\u6790\u7ed3\u679c\u9002\u7528\u4e8e\u6240\u6709\u8fd0\u884c\u5e73\u53f0\u3002\u4e8c\u662f\u53ef\u4ee5\u4f53\u73b0\u4e0d\u540c\u6570\u636e\u91cf\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\uff0c\u5c24\u5176\u662f\u53ef\u4ee5\u53cd\u6620\u5927\u6570\u636e\u91cf\u4e0b\u7684\u7b97\u6cd5\u6027\u80fd\u3002

\u5982\u679c\u611f\u89c9\u5bf9\u590d\u6742\u5ea6\u5206\u6790\u7684\u6982\u5ff5\u4e00\u77e5\u534a\u89e3\uff0c\u65e0\u9700\u62c5\u5fc3\uff0c\u540e\u7eed\u7ae0\u8282\u4f1a\u5c55\u5f00\u4ecb\u7ecd\u3002

"},{"location":"chapter_computational_complexity/performance_evaluation/#213","title":"2.1.3. \u00a0 \u590d\u6742\u5ea6\u5206\u6790\u91cd\u8981\u6027","text":"

\u590d\u6742\u5ea6\u5206\u6790\u7ed9\u51fa\u4e00\u628a\u8bc4\u4ef7\u7b97\u6cd5\u6548\u7387\u7684\u201c\u6807\u5c3a\u201d\uff0c\u544a\u8bc9\u6211\u4eec\u6267\u884c\u67d0\u4e2a\u7b97\u6cd5\u9700\u8981\u591a\u5c11\u65f6\u95f4\u548c\u7a7a\u95f4\u8d44\u6e90\uff0c\u4e5f\u8ba9\u6211\u4eec\u53ef\u4ee5\u5f00\u5c55\u4e0d\u540c\u7b97\u6cd5\u4e4b\u95f4\u7684\u6548\u7387\u5bf9\u6bd4\u3002

\u590d\u6742\u5ea6\u662f\u4e2a\u6570\u5b66\u6982\u5ff5\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u53ef\u80fd\u6bd4\u8f83\u62bd\u8c61\uff0c\u5b66\u4e60\u96be\u5ea6\u76f8\u5bf9\u8f83\u9ad8\u3002\u4ece\u8fd9\u4e2a\u89d2\u5ea6\u51fa\u53d1\uff0c\u5176\u5e76\u4e0d\u9002\u5408\u4f5c\u4e3a\u7b2c\u4e00\u7ae0\u5185\u5bb9\u3002\u4f46\u662f\uff0c\u5f53\u6211\u4eec\u8ba8\u8bba\u67d0\u4e2a\u6570\u636e\u7ed3\u6784\u6216\u8005\u7b97\u6cd5\u7684\u7279\u70b9\u65f6\uff0c\u96be\u4ee5\u907f\u514d\u9700\u8981\u5206\u6790\u5b83\u7684\u8fd0\u884c\u901f\u5ea6\u548c\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\u3002\u56e0\u6b64\uff0c\u5728\u5c55\u5f00\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e4b\u524d\uff0c\u5efa\u8bae\u8bfb\u8005\u5148\u5bf9\u590d\u6742\u5ea6\u5efa\u7acb\u8d77\u521d\u6b65\u7684\u4e86\u89e3\uff0c\u5e76\u4e14\u80fd\u591f\u5b8c\u6210\u7b80\u5355\u6848\u4f8b\u7684\u590d\u6742\u5ea6\u5206\u6790\u3002

"},{"location":"chapter_computational_complexity/space_complexity/","title":"2.3. \u00a0 \u7a7a\u95f4\u590d\u6742\u5ea6","text":"

\u300c\u7a7a\u95f4\u590d\u6742\u5ea6 Space Complexity\u300d\u7edf\u8ba1 \u7b97\u6cd5\u4f7f\u7528\u5185\u5b58\u7a7a\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002\u8fd9\u4e2a\u6982\u5ff5\u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u5f88\u7c7b\u4f3c\u3002

"},{"location":"chapter_computational_complexity/space_complexity/#231","title":"2.3.1. \u00a0 \u7b97\u6cd5\u76f8\u5173\u7a7a\u95f4","text":"

\u7b97\u6cd5\u8fd0\u884c\u4e2d\uff0c\u4f7f\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a

  • \u300c\u8f93\u5165\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u7684\u8f93\u5165\u6570\u636e\uff1b
  • \u300c\u6682\u5b58\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u53d8\u91cf\u3001\u5bf9\u8c61\u3001\u51fd\u6570\u4e0a\u4e0b\u6587\u7b49\u6570\u636e\uff1b
  • \u300c\u8f93\u51fa\u7a7a\u95f4\u300d\u7528\u4e8e\u5b58\u50a8\u7b97\u6cd5\u7684\u8f93\u51fa\u6570\u636e\uff1b

Tip

\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u7edf\u8ba1\u8303\u56f4\u662f\u300c\u6682\u5b58\u7a7a\u95f4\u300d+\u300c\u8f93\u51fa\u7a7a\u95f4\u300d\u3002

\u6682\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u4e09\u4e2a\u90e8\u5206\uff1a

  • \u300c\u6682\u5b58\u6570\u636e\u300d\u7528\u4e8e\u4fdd\u5b58\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u5404\u79cd \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61 \u7b49\u3002
  • \u300c\u6808\u5e27\u7a7a\u95f4\u300d\u7528\u4e8e\u4fdd\u5b58\u8c03\u7528\u51fd\u6570\u7684\u4e0a\u4e0b\u6587\u6570\u636e\u3002\u7cfb\u7edf\u6bcf\u6b21\u8c03\u7528\u51fd\u6570\u90fd\u4f1a\u5728\u6808\u7684\u9876\u90e8\u521b\u5efa\u4e00\u4e2a\u6808\u5e27\uff0c\u51fd\u6570\u8fd4\u56de\u65f6\uff0c\u6808\u5e27\u7a7a\u95f4\u4f1a\u88ab\u91ca\u653e\u3002
  • \u300c\u6307\u4ee4\u7a7a\u95f4\u300d\u7528\u4e8e\u4fdd\u5b58\u7f16\u8bd1\u540e\u7684\u7a0b\u5e8f\u6307\u4ee4\uff0c\u5728\u5b9e\u9645\u7edf\u8ba1\u4e2d\u4e00\u822c\u5ffd\u7565\u4e0d\u8ba1\u3002

Fig. \u7b97\u6cd5\u4f7f\u7528\u7684\u76f8\u5173\u7a7a\u95f4

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u7c7b */\nclass Node {\nint val;\nNode next;\nNode(int x) { val = x; }\n}\n/* \u51fd\u6570 */\nint function() {\n// do something...\nreturn 0;\n}\nint algorithm(int n) {        // \u8f93\u5165\u6570\u636e\nfinal int a = 0;          // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode node = new Node(0);  // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = function();       // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7ed3\u6784\u4f53 */\nstruct Node {\nint val;\nNode *next;\nNode(int x) : val(x), next(nullptr) {}\n};\n/* \u51fd\u6570 */\nint func() {\n// do something...\nreturn 0;\n}\nint algorithm(int n) {        // \u8f93\u5165\u6570\u636e\nconst int a = 0;          // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode* node = new Node(0); // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = func();           // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
\"\"\" \u7c7b \"\"\"\nclass Node:\ndef __init__(self, x: int):\nself.val: int = x                 # \u7ed3\u70b9\u503c\nself.next: Optional[Node] = None  # \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u6307\u9488\uff08\u5f15\u7528\uff09\n\"\"\" \u51fd\u6570 \"\"\"\ndef function() -> int:\n# do something...\nreturn 0\ndef algorithm(n) -> int:  # \u8f93\u5165\u6570\u636e\nb: int = 0            # \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nnode = Node(0)        # \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nc: int = function()   # \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c      # \u8f93\u51fa\u6570\u636e\n
/* \u7ed3\u6784\u4f53 */\ntype node struct {\nval  int\nnext *node\n}\n/* \u521b\u5efa node \u7ed3\u6784\u4f53  */\nfunc newNode(val int) *node {\nreturn &node{val: val}\n}\n/* \u51fd\u6570 */\nfunc function() int {\n// do something...\nreturn 0\n}\nfunc algorithm(n int) int { // \u8f93\u5165\u6570\u636e\nconst a = 0             // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nb := 0                  // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nnewNode(0)              // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nc := function()         // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c        // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nval;\nnext;\nconstructor(val) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.next = null;                       // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n/* \u51fd\u6570 */\nfunction constFunc() {\n// do something\nreturn 0;\n}\nfunction algorithm(n) {       // \u8f93\u5165\u6570\u636e\nconst a = 0;              // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nconst b = 0;              // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nconst node = new Node(0); // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nconst c = constFunc();    // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nval: number;\nnext: Node | null;\nconstructor(val?: number) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.next = null;                       // \u6307\u5411\u4e0b\u4e00\u7ed3\u70b9\u7684\u5f15\u7528\n}\n}\n/* \u51fd\u6570 */\nfunction constFunc(): number {\n// do something\nreturn 0;\n}\nfunction algorithm(n: number): number { // \u8f93\u5165\u6570\u636e\nconst a = 0;                        // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nconst b = 0;                        // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nconst node = new Node(0);           // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nconst c = constFunc();              // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;                   // \u8f93\u51fa\u6570\u636e\n}\n
\n
/* \u7c7b */\nclass Node\n{\nint val;\nNode next;\nNode(int x) { val = x; }\n}\n/* \u51fd\u6570 */\nint function()\n{\n// do something...\nreturn 0;\n}\nint algorithm(int n)          // \u8f93\u5165\u6570\u636e\n{\nint a = 0;                // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nint b = 0;                // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nNode node = new Node(0);  // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nint c = function();       // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c;         // \u8f93\u51fa\u6570\u636e\n}\n
/* \u7c7b */\nclass Node {\nvar val: Int\nvar next: Node?\ninit(x: Int) {\nval = x\n}\n}\n/* \u51fd\u6570 */\nfunc function() -> Int {\n// do something...\nreturn 0\n}\nfunc algorithm(n: Int) -> Int { // \u8f93\u5165\u6570\u636e\nlet a = 0 // \u6682\u5b58\u6570\u636e\uff08\u5e38\u91cf\uff09\nvar b = 0 // \u6682\u5b58\u6570\u636e\uff08\u53d8\u91cf\uff09\nlet node = Node(x: 0) // \u6682\u5b58\u6570\u636e\uff08\u5bf9\u8c61\uff09\nlet c = function() // \u6808\u5e27\u7a7a\u95f4\uff08\u8c03\u7528\u51fd\u6570\uff09\nreturn a + b + c // \u8f93\u51fa\u6570\u636e\n}\n
\n
"},{"location":"chapter_computational_complexity/space_complexity/#232","title":"2.3.2. \u00a0 \u63a8\u7b97\u65b9\u6cd5","text":"

\u7a7a\u95f4\u590d\u6742\u5ea6\u7684\u63a8\u7b97\u65b9\u6cd5\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u603b\u4f53\u7c7b\u4f3c\uff0c\u53ea\u662f\u4ece\u7edf\u8ba1\u201c\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\u201d\u53d8\u4e3a\u7edf\u8ba1\u201c\u4f7f\u7528\u7a7a\u95f4\u5927\u5c0f\u201d\u3002\u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u540c\u7684\u662f\uff0c\u6211\u4eec\u4e00\u822c\u53ea\u5173\u6ce8\u300c\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\u3002\u8fd9\u662f\u56e0\u4e3a\u5185\u5b58\u7a7a\u95f4\u662f\u4e00\u4e2a\u786c\u6027\u8981\u6c42\uff0c\u6211\u4eec\u5fc5\u987b\u4fdd\u8bc1\u5728\u6240\u6709\u8f93\u5165\u6570\u636e\u4e0b\u90fd\u6709\u8db3\u591f\u7684\u5185\u5b58\u7a7a\u95f4\u9884\u7559\u3002

\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e2d\u7684\u201c\u6700\u5dee\u201d\u6709\u4e24\u5c42\u542b\u4e49\uff0c\u5206\u522b\u4e3a\u8f93\u5165\u6570\u636e\u7684\u6700\u5dee\u5206\u5e03\u3001\u7b97\u6cd5\u8fd0\u884c\u4e2d\u7684\u6700\u5dee\u65f6\u95f4\u70b9\u3002

  • \u4ee5\u6700\u5dee\u8f93\u5165\u6570\u636e\u4e3a\u51c6\u3002\u5f53 \\(n < 10\\) \u65f6\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff1b\u4f46\u662f\u5f53 \\(n > 10\\) \u65f6\uff0c\u521d\u59cb\u5316\u7684\u6570\u7ec4 nums \u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\uff1b\u56e0\u6b64\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff1b
  • \u4ee5\u7b97\u6cd5\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u5cf0\u503c\u5185\u5b58\u4e3a\u51c6\u3002\u7a0b\u5e8f\u5728\u6267\u884c\u6700\u540e\u4e00\u884c\u4e4b\u524d\uff0c\u4f7f\u7528 \\(O(1)\\) \u7a7a\u95f4\uff1b\u5f53\u521d\u59cb\u5316\u6570\u7ec4 nums \u65f6\uff0c\u7a0b\u5e8f\u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\uff1b\u56e0\u6b64\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff1b
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 0;                   // O(1)\nint[] b = new int[10000];    // O(1)\nif (n > 10)\nint[] nums = new int[n]; // O(n)\n}\n
void algorithm(int n) {\nint a = 0;               // O(1)\nvector<int> b(10000);    // O(1)\nif (n > 10)\nvector<int> nums(n); // O(n)\n}\n
def algorithm(n: int) -> None:\na: int = 0                     # O(1)\nb: List[int] = [0] * 10000     # O(1)\nif n > 10:\nnums: List[int] = [0] * n  # O(n)\n
func algorithm(n int) {\na := 0                      // O(1)\nb := make([]int, 10000)     // O(1)\nvar nums []int\nif n > 10 {\nnums := make([]int, n)  // O(n)\n}\nfmt.Println(a, b, nums)\n}\n
function algorithm(n) {\nconst a = 0;                   // O(1)\nconst b = new Array(10000);    // O(1)\nif (n > 10) {\nconst nums = new Array(n); // O(n)\n}\n}\n
function algorithm(n: number): void {\nconst a = 0;                   // O(1)\nconst b = new Array(10000);    // O(1)\nif (n > 10) {\nconst nums = new Array(n); // O(n)\n}\n}\n
\n
void algorithm(int n)\n{\nint a = 0;                   // O(1)\nint[] b = new int[10000];    // O(1)\nif (n > 10)\n{\nint[] nums = new int[n]; // O(n)\n}\n}\n
func algorithm(n: Int) {\nlet a = 0 // O(1)\nlet b = Array(repeating: 0, count: 10000) // O(1)\nif n > 10 {\nlet nums = Array(repeating: 0, count: n) // O(n)\n}\n}\n
\n

\u5728\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u9700\u8981\u6ce8\u610f\u7edf\u8ba1\u6808\u5e27\u7a7a\u95f4\u3002\u4f8b\u5982\u51fd\u6570 loop()\uff0c\u5728\u5faa\u73af\u4e2d\u8c03\u7528\u4e86 \\(n\\) \u6b21 function() \uff0c\u6bcf\u8f6e\u4e2d\u7684 function() \u90fd\u8fd4\u56de\u5e76\u91ca\u653e\u4e86\u6808\u5e27\u7a7a\u95f4\uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(1)\\) \u3002\u800c\u9012\u5f52\u51fd\u6570 recur() \u5728\u8fd0\u884c\u4e2d\u4f1a\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 recur() \uff0c\u4ece\u800c\u4f7f\u7528 \\(O(n)\\) \u7684\u6808\u5e27\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
int function() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n) {\nfor (int i = 0; i < n; i++) {\nfunction();\n}\n}\n/* \u9012\u5f52 O(n) */\nvoid recur(int n) {\nif (n == 1) return;\nreturn recur(n - 1);\n}\n
int func() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n) {\nfor (int i = 0; i < n; i++) {\nfunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nvoid recur(int n) {\nif (n == 1) return;\nreturn recur(n - 1);\n}\n
def function() -> int:\n# do something\nreturn 0\n\"\"\" \u5faa\u73af O(1) \"\"\"\ndef loop(n: int) -> None:\nfor _ in range(n):\nfunction()\n\"\"\" \u9012\u5f52 O(n) \"\"\"\ndef recur(n: int) -> int:\nif n == 1: return\nreturn recur(n - 1)\n
func function() int {\n// do something\nreturn 0\n}\n/* \u5faa\u73af O(1) */\nfunc loop(n int) {\nfor i := 0; i < n; i++ {\nfunction()\n}\n}\n/* \u9012\u5f52 O(n) */\nfunc recur(n int) {\nif n == 1 {\nreturn\n}\nrecur(n - 1)\n}\n
function constFunc() {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nfunction loop(n) {\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nfunction recur(n) {\nif (n === 1) return;\nreturn recur(n - 1);\n}\n
function constFunc(): number {\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nfunction loop(n: number): void {\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n/* \u9012\u5f52 O(n) */\nfunction recur(n: number): void {\nif (n === 1) return;\nreturn recur(n - 1);\n}\n
\n
int function()\n{\n// do something\nreturn 0;\n}\n/* \u5faa\u73af O(1) */\nvoid loop(int n)\n{\nfor (int i = 0; i < n; i++)\n{\nfunction();\n}\n}\n/* \u9012\u5f52 O(n) */\nint recur(int n)\n{\nif (n == 1) return 1;\nreturn recur(n - 1);\n}\n
@discardableResult\nfunc function() -> Int {\n// do something\nreturn 0\n}\n/* \u5faa\u73af O(1) */\nfunc loop(n: Int) {\nfor _ in 0 ..< n {\nfunction()\n}\n}\n/* \u9012\u5f52 O(n) */\nfunc recur(n: Int) {\nif n == 1 {\nreturn\n}\nrecur(n: n - 1)\n}\n
\n
"},{"location":"chapter_computational_complexity/space_complexity/#233","title":"2.3.3. \u00a0 \u5e38\u89c1\u7c7b\u578b","text":"

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u5e38\u89c1\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u7c7b\u578b\u6709\uff08\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\uff09

\\[ \\begin{aligned} O(1) < O(\\log n) < O(n) < O(n^2) < O(2^n) \\newline \\text{\u5e38\u6570\u9636} < \\text{\u5bf9\u6570\u9636} < \\text{\u7ebf\u6027\u9636} < \\text{\u5e73\u65b9\u9636} < \\text{\u6307\u6570\u9636} \\end{aligned} \\]

Fig. \u7a7a\u95f4\u590d\u6742\u5ea6\u7684\u5e38\u89c1\u7c7b\u578b

Tip

\u90e8\u5206\u793a\u4f8b\u4ee3\u7801\u9700\u8981\u4e00\u4e9b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5305\u62ec\u6570\u7ec4\u3001\u94fe\u8868\u3001\u4e8c\u53c9\u6811\u3001\u9012\u5f52\u7b97\u6cd5\u7b49\u3002\u5982\u679c\u9047\u5230\u770b\u4e0d\u61c2\u7684\u5730\u65b9\u65e0\u9700\u62c5\u5fc3\uff0c\u53ef\u4ee5\u5728\u5b66\u4e60\u5b8c\u540e\u9762\u7ae0\u8282\u540e\u518d\u6765\u590d\u4e60\uff0c\u73b0\u9636\u6bb5\u5148\u805a\u7126\u5728\u7406\u89e3\u7a7a\u95f4\u590d\u6742\u5ea6\u542b\u4e49\u548c\u63a8\u7b97\u65b9\u6cd5\u4e0a\u3002

"},{"location":"chapter_computational_complexity/space_complexity/#o1","title":"\u5e38\u6570\u9636 \\(O(1)\\)","text":"

\u5e38\u6570\u9636\u5e38\u89c1\u4e8e\u6570\u91cf\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\u7684\u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u3002

\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u5faa\u73af\u4e2d\u521d\u59cb\u5316\u53d8\u91cf\u6216\u8c03\u7528\u51fd\u6570\u800c\u5360\u7528\u7684\u5185\u5b58\uff0c\u5728\u8fdb\u5165\u4e0b\u4e00\u5faa\u73af\u540e\u5c31\u4f1a\u88ab\u91ca\u653e\uff0c\u5373\u4e0d\u4f1a\u7d2f\u79ef\u5360\u7528\u7a7a\u95f4\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(1)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e38\u6570\u9636 */\nvoid constant(int n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nfinal int a = 0;\nint b = 0;\nint[] nums = new int[10000];\nListNode node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nfunction();\n}\n}\n
space_complexity.cpp
/* \u5e38\u6570\u9636 */\nvoid constant(int n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst int a = 0;\nint b = 0;\nvector<int> nums(10000);\nListNode node(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++) {\nfunc();\n}\n}\n
space_complexity.py
def constant(n: int) -> None:\n\"\"\" \u5e38\u6570\u9636 \"\"\"\n# \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\na: int = 0\nnums: List[int] = [0] * 10000\nnode = ListNode(0)\n# \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in range(n):\nc: int = 0\n# \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in range(n):\nfunction()\n
space_complexity.go
/* \u5e38\u6570\u9636 */\nfunc spaceConstant(n int) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0\nb := 0\nnums := make([]int, 10000)\nListNode := newNode(0)\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nvar c int\nfor i := 0; i < n; i++ {\nc = 0\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor i := 0; i < n; i++ {\nfunction()\n}\nfmt.Println(a, b, nums, c, ListNode)\n}\n
space_complexity.js
/* \u5e38\u6570\u9636 */\nfunction constant(n) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0;\nconst b = 0;\nconst nums = new Array(10000);\nconst node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconst c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n
space_complexity.ts
/* \u5e38\u6570\u9636 */\nfunction constant(n: number): void {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a = 0;\nconst b = 0;\nconst nums = new Array(10000);\nconst node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconst c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (let i = 0; i < n; i++) {\nconstFunc();\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceConstant}\n
space_complexity.cs
/* \u5e38\u6570\u9636 */\nvoid constant(int n)\n{\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nint a = 0;\nint b = 0;\nint[] nums = new int[10000];\nListNode node = new ListNode(0);\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++)\n{\nint c = 0;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor (int i = 0; i < n; i++)\n{\nfunction();\n}\n}\n
space_complexity.swift
/* \u5e38\u6570\u9636 */\nfunc constant(n: Int) {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nlet a = 0\nvar b = 0\nlet nums = Array(repeating: 0, count: 10000)\nlet node = ListNode(x: 0)\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in 0 ..< n {\nlet c = 0\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\nfor _ in 0 ..< n {\nfunction()\n}\n}\n
space_complexity.zig
// \u5e38\u6570\u9636\nfn constant(n: i32) void {\n// \u5e38\u91cf\u3001\u53d8\u91cf\u3001\u5bf9\u8c61\u5360\u7528 O(1) \u7a7a\u95f4\nconst a: i32 = 0;\nvar b: i32 = 0;\nvar nums = [_]i32{0}**10000;\nvar node = inc.ListNode(i32){.val = 0};\nvar i: i32 = 0;\n// \u5faa\u73af\u4e2d\u7684\u53d8\u91cf\u5360\u7528 O(1) \u7a7a\u95f4\nwhile (i < n) : (i += 1) {\nvar c: i32 = 0;\n_ = c;\n}\n// \u5faa\u73af\u4e2d\u7684\u51fd\u6570\u5360\u7528 O(1) \u7a7a\u95f4\ni = 0;\nwhile (i < n) : (i += 1) {\n_ = function();\n}\n_ = a;\n_ = b;\n_ = nums;\n_ = node;\n}\n
"},{"location":"chapter_computational_complexity/space_complexity/#on","title":"\u7ebf\u6027\u9636 \\(O(n)\\)","text":"

\u7ebf\u6027\u9636\u5e38\u89c1\u4e8e\u5143\u7d20\u6570\u91cf\u4e0e \\(n\\) \u6210\u6b63\u6bd4\u7684\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u7b49\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u7ebf\u6027\u9636 */\nvoid linear(int n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nint[] nums = new int[n];\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nList<ListNode> nodes = new ArrayList<>();\nfor (int i = 0; i < n; i++) {\nnodes.add(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nMap<Integer, String> map = new HashMap<>();\nfor (int i = 0; i < n; i++) {\nmap.put(i, String.valueOf(i));\n}\n}\n
space_complexity.cpp
/* \u7ebf\u6027\u9636 */\nvoid linear(int n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nvector<int> nums(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvector<ListNode> nodes;\nfor (int i = 0; i < n; i++) {\nnodes.push_back(ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nunordered_map<int, string> map;\nfor (int i = 0; i < n; i++) {\nmap[i] = to_string(i);\n}\n}\n
space_complexity.py
def linear(n: int) -> None:\n\"\"\" \u7ebf\u6027\u9636 \"\"\"\n# \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nnums: List[int] = [0] * n\n# \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nmapp: Dict = {}\nfor i in range(n):\nmapp[i] = str(i)\n
space_complexity.go
/* \u7ebf\u6027\u9636 */\nfunc spaceLinear(n int) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\n_ = make([]int, n)\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar nodes []*node\nfor i := 0; i < n; i++ {\nnodes = append(nodes, newNode(i))\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nm := make(map[int]string, n)\nfor i := 0; i < n; i++ {\nm[i] = strconv.Itoa(i)\n}\n}\n
space_complexity.js
/* \u7ebf\u6027\u9636 */\nfunction linear(n) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nconst nums = new Array(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst nodes = [];\nfor (let i = 0; i < n; i++) {\nnodes.push(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst map = new Map();\nfor (let i = 0; i < n; i++) {\nmap.set(i, i.toString());\n}\n}\n
space_complexity.ts
/* \u7ebf\u6027\u9636 */\nfunction linear(n: number): void {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nconst nums = new Array(n);\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst nodes: ListNode[] = [];\nfor (let i = 0; i < n; i++) {\nnodes.push(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nconst map = new Map();\nfor (let i = 0; i < n; i++) {\nmap.set(i, i.toString());\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceLinear}\n
space_complexity.cs
/* \u7ebf\u6027\u9636 */\nvoid linear(int n)\n{\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nint[] nums = new int[n];\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nList<ListNode> nodes = new();\nfor (int i = 0; i < n; i++)\n{\nnodes.Add(new ListNode(i));\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nDictionary<int, String> map = new();\nfor (int i = 0; i < n; i++)\n{\nmap.Add(i, i.ToString());\n}\n}\n
space_complexity.swift
/* \u7ebf\u6027\u9636 */\nfunc linear(n: Int) {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nlet nums = Array(repeating: 0, count: n)\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nlet nodes = (0 ..< n).map { ListNode(x: $0) }\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nlet map = Dictionary(uniqueKeysWithValues: (0 ..< n).map { ($0, \"\\($0)\") })\n}\n
space_complexity.zig
// \u7ebf\u6027\u9636\nfn linear(comptime n: i32) !void {\n// \u957f\u5ea6\u4e3a n \u7684\u6570\u7ec4\u5360\u7528 O(n) \u7a7a\u95f4\nvar nums = [_]i32{0}**n;\n// \u957f\u5ea6\u4e3a n \u7684\u5217\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar nodes = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer nodes.deinit();\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\ntry nodes.append(i);\n}\n// \u957f\u5ea6\u4e3a n \u7684\u54c8\u5e0c\u8868\u5360\u7528 O(n) \u7a7a\u95f4\nvar map = std.AutoArrayHashMap(i32, []const u8).init(std.heap.page_allocator);\ndefer map.deinit();\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\nconst string = try std.fmt.allocPrint(std.heap.page_allocator, \"{d}\", .{j});\ndefer std.heap.page_allocator.free(string);\ntry map.put(i, string);\n}\n_ = nums;\n}\n

\u4ee5\u4e0b\u9012\u5f52\u51fd\u6570\u4f1a\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 algorithm() \u51fd\u6570\uff0c\u4f7f\u7528 \\(O(n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n) {\nSystem.out.println(\"\u9012\u5f52 n = \" + n);\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.cpp
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n) {\ncout << \"\u9012\u5f52 n = \" << n << endl;\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.py
def linear_recur(n: int) -> None:\n\"\"\" \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 \"\"\"\nprint(\"\u9012\u5f52 n =\", n)\nif n == 1: return\nlinear_recur(n - 1)\n
space_complexity.go
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc spaceLinearRecur(n int) {\nfmt.Println(\"\u9012\u5f52 n =\", n)\nif n == 1 {\nreturn\n}\nspaceLinearRecur(n - 1)\n}\n
space_complexity.js
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction linearRecur(n) {\nconsole.log(`\u9012\u5f52 n = ${n}`);\nif (n === 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.ts
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction linearRecur(n: number): void {\nconsole.log(`\u9012\u5f52 n = ${n}`);\nif (n === 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.c
[class]{}-[func]{spaceLinearRecur}\n
space_complexity.cs
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nvoid linearRecur(int n)\n{\nConsole.WriteLine(\"\u9012\u5f52 n = \" + n);\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n
space_complexity.swift
/* \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc linearRecur(n: Int) {\nprint(\"\u9012\u5f52 n = \\(n)\")\nif n == 1 {\nreturn\n}\nlinearRecur(n: n - 1)\n}\n
space_complexity.zig
// \u7ebf\u6027\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn linearRecur(comptime n: i32) void {\nstd.debug.print(\"\u9012\u5f52 n = {}\\n\", .{n});\nif (n == 1) return;\nlinearRecur(n - 1);\n}\n

Fig. \u9012\u5f52\u51fd\u6570\u4ea7\u751f\u7684\u7ebf\u6027\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#on2","title":"\u5e73\u65b9\u9636 \\(O(n^2)\\)","text":"

\u5e73\u65b9\u9636\u5e38\u89c1\u4e8e\u5143\u7d20\u6570\u91cf\u4e0e \\(n\\) \u6210\u5e73\u65b9\u5173\u7cfb\u7684\u77e9\u9635\u3001\u56fe\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nint[][] numMatrix = new int[n][n];\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nList<List<Integer>> numList = new ArrayList<>();\nfor (int i = 0; i < n; i++) {\nList<Integer> tmp = new ArrayList<>();\nfor (int j = 0; j < n; j++) {\ntmp.add(0);\n}\nnumList.add(tmp);\n}\n}\n
space_complexity.cpp
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n) {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nvector<vector<int>> numMatrix;\nfor (int i = 0; i < n; i++) {\nvector<int> tmp;\nfor (int j = 0; j < n; j++) {\ntmp.push_back(0);\n}\nnumMatrix.push_back(tmp);\n}\n}\n
space_complexity.py
def quadratic(n: int) -> None:\n\"\"\" \u5e73\u65b9\u9636 \"\"\"\n# \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nnum_matrix: List[List[int]] = [[0] * n for _ in range(n)]\n
space_complexity.go
/* \u5e73\u65b9\u9636 */\nfunc spaceQuadratic(n int) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nnumMatrix := make([][]int, n)\nfor i := 0; i < n; i++ {\nnumMatrix[i] = make([]int, n)\n}\n}\n
space_complexity.js
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n) {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numMatrix = Array(n).fill(null).map(() => Array(n).fill(null));\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numList = [];\nfor (let i = 0; i < n; i++) {\nconst tmp = [];\nfor (let j = 0; j < n; j++) {\ntmp.push(0);\n}\nnumList.push(tmp);\n}\n}\n
space_complexity.ts
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n: number): void {\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numMatrix = Array(n)\n.fill(null)\n.map(() => Array(n).fill(null));\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nconst numList = [];\nfor (let i = 0; i < n; i++) {\nconst tmp = [];\nfor (let j = 0; j < n; j++) {\ntmp.push(0);\n}\nnumList.push(tmp);\n}\n}\n
space_complexity.c
[class]{}-[func]{spaceQuadratic}\n
space_complexity.cs
/* \u5e73\u65b9\u9636 */\nvoid quadratic(int n)\n{\n// \u77e9\u9635\u5360\u7528 O(n^2) \u7a7a\u95f4\nint[,] numMatrix = new int[n, n];\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nList<List<int>> numList = new();\nfor (int i = 0; i < n; i++)\n{\nList<int> tmp = new();\nfor (int j = 0; j < n; j++)\n{\ntmp.Add(0);\n}\nnumList.Add(tmp);\n}\n}\n
space_complexity.swift
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n: Int) {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nlet numList = Array(repeating: Array(repeating: 0, count: n), count: n)\n}\n
space_complexity.zig
// \u5e73\u65b9\u9636\nfn quadratic(n: i32) !void {\n// \u4e8c\u7ef4\u5217\u8868\u5360\u7528 O(n^2) \u7a7a\u95f4\nvar nodes = std.ArrayList(std.ArrayList(i32)).init(std.heap.page_allocator);\ndefer nodes.deinit();\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\nvar tmp = std.ArrayList(i32).init(std.heap.page_allocator);\ndefer tmp.deinit();\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\ntry tmp.append(0);\n}\ntry nodes.append(tmp);\n}\n}\n

\u5728\u4ee5\u4e0b\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u540c\u65f6\u5b58\u5728 \\(n\\) \u4e2a\u672a\u8fd4\u56de\u7684 algorithm() \uff0c\u5e76\u4e14\u6bcf\u4e2a\u51fd\u6570\u4e2d\u90fd\u521d\u59cb\u5316\u4e86\u4e00\u4e2a\u6570\u7ec4\uff0c\u957f\u5ea6\u5206\u522b\u4e3a \\(n, n-1, n-2, ..., 2, 1\\) \uff0c\u5e73\u5747\u957f\u5ea6\u4e3a \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u603b\u4f53\u4f7f\u7528 \\(O(n^2)\\) \u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n) {\nif (n <= 0) return 0;\n// \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nint[] nums = new int[n];\nSystem.out.println(\"\u9012\u5f52 n = \" + n + \" \u4e2d\u7684 nums \u957f\u5ea6 = \" + nums.length);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.cpp
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n) {\nif (n <= 0) return 0;\nvector<int> nums(n);\ncout << \"\u9012\u5f52 n = \" << n << \" \u4e2d\u7684 nums \u957f\u5ea6 = \" << nums.size() << endl;\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.py
def quadratic_recur(n: int) -> int:\n\"\"\" \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 \"\"\"\nif n <= 0: return 0\n# \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nnums: List[int] = [0] * n\nreturn quadratic_recur(n - 1)\n
space_complexity.go
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc spaceQuadraticRecur(n int) int {\nif n <= 0 {\nreturn 0\n}\nnums := make([]int, n)\nfmt.Printf(\"\u9012\u5f52 n = %d \u4e2d\u7684 nums \u957f\u5ea6 = %d \\n\", n, len(nums))\nreturn spaceQuadraticRecur(n - 1)\n}\n
space_complexity.js
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction quadraticRecur(n) {\nif (n <= 0) return 0;\nconst nums = new Array(n);\nconsole.log(`\u9012\u5f52 n = ${n} \u4e2d\u7684 nums \u957f\u5ea6 = ${nums.length}`);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.ts
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction quadraticRecur(n: number): number {\nif (n <= 0) return 0;\nconst nums = new Array(n);\nconsole.log(`\u9012\u5f52 n = ${n} \u4e2d\u7684 nums \u957f\u5ea6 = ${nums.length}`);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.c
[class]{}-[func]{spaceQuadraticRecur}\n
space_complexity.cs
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint quadraticRecur(int n)\n{\nif (n <= 0) return 0;\nint[] nums = new int[n];\nConsole.WriteLine(\"\u9012\u5f52 n = \" + n + \" \u4e2d\u7684 nums \u957f\u5ea6 = \" + nums.Length);\nreturn quadraticRecur(n - 1);\n}\n
space_complexity.swift
/* \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\n@discardableResult\nfunc quadraticRecur(n: Int) -> Int {\nif n <= 0 {\nreturn 0\n}\n// \u6570\u7ec4 nums \u957f\u5ea6\u4e3a n, n-1, ..., 2, 1\nlet nums = Array(repeating: 0, count: n)\nprint(\"\u9012\u5f52 n = \\(n) \u4e2d\u7684 nums \u957f\u5ea6 = \\(nums.count)\")\nreturn quadraticRecur(n: n - 1)\n}\n
space_complexity.zig
// \u5e73\u65b9\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn quadraticRecur(comptime n: i32) i32 {\nif (n <= 0) return 0;\nvar nums = [_]i32{0}**n;\nstd.debug.print(\"\u9012\u5f52 n = {} \u4e2d\u7684 nums \u957f\u5ea6 = {}\\n\", .{n, nums.len});\nreturn quadraticRecur(n - 1);\n}\n

Fig. \u9012\u5f52\u51fd\u6570\u4ea7\u751f\u7684\u5e73\u65b9\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#o2n","title":"\u6307\u6570\u9636 \\(O(2^n)\\)","text":"

\u6307\u6570\u9636\u5e38\u89c1\u4e8e\u4e8c\u53c9\u6811\u3002\u9ad8\u5ea6\u4e3a \\(n\\) \u7684\u300c\u6ee1\u4e8c\u53c9\u6811\u300d\u7684\u7ed3\u70b9\u6570\u91cf\u4e3a \\(2^n - 1\\) \uff0c\u4f7f\u7528 \\(O(2^n)\\) \u7a7a\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig space_complexity.java
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode buildTree(int n) {\nif (n == 0) return null;\nTreeNode root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.cpp
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode* buildTree(int n) {\nif (n == 0) return nullptr;\nTreeNode* root = new TreeNode(0);\nroot->left = buildTree(n - 1);\nroot->right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.py
def build_tree(n: int) -> Optional[TreeNode]:\n\"\"\" \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 \"\"\"\nif n == 0: return None\nroot = TreeNode(0)\nroot.left = build_tree(n - 1)\nroot.right = build_tree(n - 1)\nreturn root\n
space_complexity.go
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunc buildTree(n int) *treeNode {\nif n == 0 {\nreturn nil\n}\nroot := newTreeNode(0)\nroot.left = buildTree(n - 1)\nroot.right = buildTree(n - 1)\nreturn root\n}\n
space_complexity.js
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunction buildTree(n) {\nif (n === 0) return null;\nconst root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.ts
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunction buildTree(n: number): TreeNode | null {\nif (n === 0) return null;\nconst root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.c
[class]{}-[func]{buildTree}\n
space_complexity.cs
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nTreeNode? buildTree(int n)\n{\nif (n == 0) return null;\nTreeNode root = new TreeNode(0);\nroot.left = buildTree(n - 1);\nroot.right = buildTree(n - 1);\nreturn root;\n}\n
space_complexity.swift
/* \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09 */\nfunc buildTree(n: Int) -> TreeNode? {\nif n == 0 {\nreturn nil\n}\nlet root = TreeNode(x: 0)\nroot.left = buildTree(n: n - 1)\nroot.right = buildTree(n: n - 1)\nreturn root\n}\n
space_complexity.zig
// \u6307\u6570\u9636\uff08\u5efa\u7acb\u6ee1\u4e8c\u53c9\u6811\uff09\nfn buildTree(mem_allocator: std.mem.Allocator, n: i32) !?*inc.TreeNode(i32) {\nif (n == 0) return null;\nconst root = try mem_allocator.create(inc.TreeNode(i32));\nroot.init(0);\nroot.left = try buildTree(mem_allocator, n - 1);\nroot.right = try buildTree(mem_allocator, n - 1);\nreturn root;\n}\n

Fig. \u6ee1\u4e8c\u53c9\u6811\u4ea7\u751f\u7684\u6307\u6570\u9636\u7a7a\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/space_complexity/#olog-n","title":"\u5bf9\u6570\u9636 \\(O(\\log n)\\)","text":"

\u5bf9\u6570\u9636\u5e38\u89c1\u4e8e\u5206\u6cbb\u7b97\u6cd5\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u7b49\u3002

\u4f8b\u5982\u300c\u5f52\u5e76\u6392\u5e8f\u300d\uff0c\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6570\u7ec4\u53ef\u4ee5\u5f62\u6210\u9ad8\u5ea6\u4e3a \\(\\log n\\) \u7684\u9012\u5f52\u6811\uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

\u518d\u4f8b\u5982\u300c\u6570\u5b57\u8f6c\u5316\u4e3a\u5b57\u7b26\u4e32\u300d\uff0c\u8f93\u5165\u4efb\u610f\u6b63\u6574\u6570 \\(n\\) \uff0c\u5b83\u7684\u4f4d\u6570\u4e3a \\(\\log_{10} n\\) \uff0c\u5373\u5bf9\u5e94\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a \\(\\log_{10} n\\) \uff0c\u56e0\u6b64\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log_{10} n) = O(\\log n)\\) \u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/","title":"2.4. \u00a0 \u6743\u8861\u65f6\u95f4\u4e0e\u7a7a\u95f4","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u90fd\u80fd\u591f\u8fbe\u5230\u6700\u4f18\uff0c\u800c\u5b9e\u9645\u4e0a\uff0c\u540c\u65f6\u4f18\u5316\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u662f\u975e\u5e38\u56f0\u96be\u7684\u3002

\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u5f80\u5f80\u662f\u4ee5\u63d0\u5347\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a\u4ee3\u4ef7\u7684\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002\u6211\u4eec\u628a\u727a\u7272\u5185\u5b58\u7a7a\u95f4\u6765\u63d0\u5347\u7b97\u6cd5\u8fd0\u884c\u901f\u5ea6\u7684\u601d\u8def\u79f0\u4e3a\u300c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u300d\uff1b\u53cd\u4e4b\uff0c\u79f0\u4e4b\u4e3a\u300c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u300d\u3002\u9009\u62e9\u54ea\u79cd\u601d\u8def\u53d6\u51b3\u4e8e\u6211\u4eec\u66f4\u770b\u91cd\u54ea\u4e2a\u65b9\u9762\u3002

\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u90fd\u662f\u6bd4\u7a7a\u95f4\u66f4\u5b9d\u8d35\u7684\uff0c\u53ea\u8981\u7a7a\u95f4\u590d\u6742\u5ea6\u4e0d\u8981\u592a\u79bb\u8c31\u3001\u80fd\u63a5\u53d7\u5c31\u884c\uff0c\u56e0\u6b64\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u6700\u4e3a\u5e38\u7528\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#241","title":"2.4.1. \u00a0 \u793a\u4f8b\u9898\u76ee *","text":"

\u4ee5 LeetCode \u5168\u7ad9\u7b2c\u4e00\u9898 \u4e24\u6570\u4e4b\u548c \u4e3a\u4f8b\u3002

\u4e24\u6570\u4e4b\u548c

\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums \u548c\u4e00\u4e2a\u6574\u6570\u76ee\u6807\u503c target \uff0c\u8bf7\u4f60\u5728\u8be5\u6570\u7ec4\u4e2d\u627e\u51fa\u201c\u548c\u201d\u4e3a\u76ee\u6807\u503c target \u7684\u90a3\u4e24\u4e2a\u6574\u6570\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u6570\u7ec4\u4e0b\u6807\u3002

\u4f60\u53ef\u4ee5\u5047\u8bbe\u6bcf\u79cd\u8f93\u5165\u53ea\u4f1a\u5bf9\u5e94\u4e00\u4e2a\u7b54\u6848\u3002\u4f46\u662f\uff0c\u6570\u7ec4\u4e2d\u540c\u4e00\u4e2a\u5143\u7d20\u5728\u7b54\u6848\u91cc\u4e0d\u80fd\u91cd\u590d\u51fa\u73b0\u3002

\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u8fd4\u56de\u7b54\u6848\u3002

\u300c\u66b4\u529b\u679a\u4e3e\u300d\u548c\u300c\u8f85\u52a9\u54c8\u5e0c\u8868\u300d\u5206\u522b\u5bf9\u5e94 \u7a7a\u95f4\u6700\u4f18 \u548c \u65f6\u95f4\u6700\u4f18 \u7684\u4e24\u79cd\u89e3\u6cd5\u3002\u672c\u7740\u65f6\u95f4\u6bd4\u7a7a\u95f4\u66f4\u5b9d\u8d35\u7684\u539f\u5219\uff0c\u540e\u8005\u662f\u672c\u9898\u7684\u6700\u4f73\u89e3\u6cd5\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#_1","title":"\u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e","text":"

\u8003\u8651\u76f4\u63a5\u904d\u5386\u6240\u6709\u6240\u6709\u53ef\u80fd\u6027\u3002\u901a\u8fc7\u5f00\u542f\u4e00\u4e2a\u4e24\u5c42\u5faa\u73af\uff0c\u5224\u65ad\u4e24\u4e2a\u6574\u6570\u7684\u548c\u662f\u5426\u4e3a target \uff0c\u82e5\u662f\u5219\u8fd4\u56de\u5b83\u4fe9\u7684\u7d22\u5f15\uff08\u5373\u4e0b\u6807\uff09\u5373\u53ef\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig leetcode_two_sum.java
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nint[] twoSumBruteForce(int[] nums, int target) {\nint size = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++) {\nfor (int j = i + 1; j < size; j++) {\nif (nums[i] + nums[j] == target)\nreturn new int[] { i, j };\n}\n}\nreturn new int[0];\n}\n
leetcode_two_sum.cpp
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nvector<int> twoSumBruteForce(vector<int>& nums, int target) {\nint size = nums.size();\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++) {\nfor (int j = i + 1; j < size; j++) {\nif (nums[i] + nums[j] == target)\nreturn { i, j };\n}\n}\nreturn {};\n}\n
leetcode_two_sum.py
def two_sum_brute_force(nums: List[int], target: int) -> List[int]:\n\"\"\" \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e \"\"\"\n# \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i in range(len(nums) - 1):\nfor j in range(i + 1, len(nums)):\nif nums[i] + nums[j] == target:\nreturn [i, j]\nreturn []\n
leetcode_two_sum.go
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunc twoSumBruteForce(nums []int, target int) []int {\nsize := len(nums)\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i := 0; i < size-1; i++ {\nfor j := i + 1; i < size; j++ {\nif nums[i]+nums[j] == target {\nreturn []int{i, j}\n}\n}\n}\nreturn nil\n}\n
leetcode_two_sum.js
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunction twoSumBruteForce(nums, target) {\nconst n = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (let i = 0; i < n; i++) {\nfor (let j = i + 1; j < n; j++) {\nif (nums[i] + nums[j] === target) {\nreturn [i, j];\n}\n}\n}\nreturn [];\n}\n
leetcode_two_sum.ts
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunction twoSumBruteForce(nums: number[], target: number): number[] {\nconst n = nums.length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (let i = 0; i < n; i++) {\nfor (let j = i + 1; j < n; j++) {\nif (nums[i] + nums[j] === target) {\nreturn [i, j];\n}\n}\n}\nreturn [];\n};\n
leetcode_two_sum.c
[class]{}-[func]{twoSumBruteForce}\n
leetcode_two_sum.cs
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nint[] twoSumBruteForce(int[] nums, int target)\n{\nint size = nums.Length;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor (int i = 0; i < size - 1; i++)\n{\nfor (int j = i + 1; j < size; j++)\n{\nif (nums[i] + nums[j] == target)\nreturn new int[] { i, j };\n}\n}\nreturn new int[0];\n}\n
leetcode_two_sum.swift
/* \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e */\nfunc twoSumBruteForce(nums: [Int], target: Int) -> [Int] {\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nfor i in nums.indices.dropLast() {\nfor j in nums.indices.dropFirst(i + 1) {\nif nums[i] + nums[j] == target {\nreturn [i, j]\n}\n}\n}\nreturn [0]\n}\n
leetcode_two_sum.zig
// \u65b9\u6cd5\u4e00\uff1a\u66b4\u529b\u679a\u4e3e\nfn twoSumBruteForce(nums: []i32, target: i32) ?[2]i32 {\nvar size: usize = nums.len;\nvar i: usize = 0;\n// \u4e24\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n^2)\nwhile (i < size - 1) : (i += 1) {\nvar j = i + 1;\nwhile (j < size) : (j += 1) {\nif (nums[i] + nums[j] == target) {\nreturn [_]i32{@intCast(i32, i), @intCast(i32, j)};\n}\n}\n}\nreturn null;\n}\n

\u8be5\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N^2)\\) \uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u5c5e\u4e8e\u65f6\u95f4\u6362\u7a7a\u95f4\u3002\u672c\u65b9\u6cd5\u65f6\u95f4\u590d\u6742\u5ea6\u8f83\u9ad8\uff0c\u5728\u5927\u6570\u636e\u91cf\u4e0b\u975e\u5e38\u8017\u65f6\u3002

"},{"location":"chapter_computational_complexity/space_time_tradeoff/#_2","title":"\u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868","text":"

\u8003\u8651\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\uff0ckey \u4e3a\u6570\u7ec4\u5143\u7d20\u3001value \u4e3a\u5143\u7d20\u7d22\u5f15\u3002\u5faa\u73af\u904d\u5386\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20 num \uff0c\u5e76\u6267\u884c\uff1a

  1. \u5224\u65ad\u6570\u5b57 target - num \u662f\u5426\u5728\u54c8\u5e0c\u8868\u4e2d\uff0c\u82e5\u662f\u5219\u76f4\u63a5\u8fd4\u56de\u8be5\u4e24\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\uff1b
  2. \u5c06\u5143\u7d20 num \u548c\u5176\u7d22\u5f15\u6dfb\u52a0\u8fdb\u54c8\u5e0c\u8868\uff1b
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig leetcode_two_sum.java
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nint[] twoSumHashTable(int[] nums, int target) {\nint size = nums.length;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nMap<Integer, Integer> dic = new HashMap<>();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++) {\nif (dic.containsKey(target - nums[i])) {\nreturn new int[] { dic.get(target - nums[i]), i };\n}\ndic.put(nums[i], i);\n}\nreturn new int[0];\n}\n
leetcode_two_sum.cpp
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nvector<int> twoSumHashTable(vector<int>& nums, int target) {\nint size = nums.size();\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nunordered_map<int, int> dic;\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++) {\nif (dic.find(target - nums[i]) != dic.end()) {\nreturn { dic[target - nums[i]], i };\n}\ndic.emplace(nums[i], i);\n}\nreturn {};\n}\n
leetcode_two_sum.py
def two_sum_hash_table(nums: List[int], target: int) -> List[int]:\n\"\"\" \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 \"\"\"\n# \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\ndic = {}\n# \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor i in range(len(nums)):\nif target - nums[i] in dic:\nreturn [dic[target - nums[i]], i]\ndic[nums[i]] = i\nreturn []\n
leetcode_two_sum.go
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunc twoSumHashTable(nums []int, target int) []int {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nhashTable := map[int]int{}\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor idx, val := range nums {\nif preIdx, ok := hashTable[target-val]; ok {\nreturn []int{preIdx, idx}\n}\nhashTable[val] = idx\n}\nreturn nil\n}\n
leetcode_two_sum.js
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunction twoSumHashTable(nums, target) {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nlet m = {};\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (let i = 0; i < nums.length; i++) {\nif (m[nums[i]] !== undefined) {\nreturn [m[nums[i]], i];\n} else {\nm[target - nums[i]] = i;\n}\n}\nreturn [];\n}\n
leetcode_two_sum.ts
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunction twoSumHashTable(nums: number[], target: number): number[] {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nlet m: Map<number, number> = new Map();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (let i = 0; i < nums.length; i++) {\nlet index = m.get(nums[i]);\nif (index !== undefined) {\nreturn [index, i];\n} else {\nm.set(target - nums[i], i);\n}\n}\nreturn [];\n};\n
leetcode_two_sum.c
[class]{}-[func]{twoSumHashTable}\n
leetcode_two_sum.cs
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nint[] twoSumHashTable(int[] nums, int target)\n{\nint size = nums.Length;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nDictionary<int, int> dic = new();\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor (int i = 0; i < size; i++)\n{\nif (dic.ContainsKey(target - nums[i]))\n{\nreturn new int[] { dic[target - nums[i]], i };\n}\ndic.Add(nums[i], i);\n}\nreturn new int[0];\n}\n
leetcode_two_sum.swift
/* \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868 */\nfunc twoSumHashTable(nums: [Int], target: Int) -> [Int] {\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nvar dic: [Int: Int] = [:]\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nfor i in nums.indices {\nif let j = dic[target - nums[i]] {\nreturn [j, i]\n}\ndic[nums[i]] = i\n}\nreturn [0]\n}\n
leetcode_two_sum.zig
// \u65b9\u6cd5\u4e8c\uff1a\u8f85\u52a9\u54c8\u5e0c\u8868\nfn twoSumHashTable(nums: []i32, target: i32) !?[2]i32 {\nvar size: usize = nums.len;\n// \u8f85\u52a9\u54c8\u5e0c\u8868\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(n)\nvar dic = std.AutoHashMap(i32, i32).init(std.heap.page_allocator);\ndefer dic.deinit();\nvar i: usize = 0;\n// \u5355\u5c42\u5faa\u73af\uff0c\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nwhile (i < size) : (i += 1) {\nif (dic.contains(target - nums[i])) {\nreturn [_]i32{dic.get(target - nums[i]).?, @intCast(i32, i)};\n}\ntry dic.put(nums[i], @intCast(i32, i));\n}\nreturn null;\n}\n

\u8be5\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff0c\u4f53\u73b0\u7a7a\u95f4\u6362\u65f6\u95f4\u3002\u672c\u65b9\u6cd5\u867d\u7136\u5f15\u5165\u4e86\u989d\u5916\u7a7a\u95f4\u4f7f\u7528\uff0c\u4f46\u65f6\u95f4\u548c\u7a7a\u95f4\u4f7f\u7528\u6574\u4f53\u66f4\u52a0\u5747\u8861\uff0c\u56e0\u6b64\u4e3a\u672c\u9898\u6700\u4f18\u89e3\u6cd5\u3002

"},{"location":"chapter_computational_complexity/summary/","title":"2.5. \u00a0 \u5c0f\u7ed3","text":""},{"location":"chapter_computational_complexity/summary/#_1","title":"\u7b97\u6cd5\u6548\u7387\u8bc4\u4f30","text":"
  • \u300c\u65f6\u95f4\u6548\u7387\u300d\u548c\u300c\u7a7a\u95f4\u6548\u7387\u300d\u662f\u7b97\u6cd5\u6027\u80fd\u7684\u4e24\u4e2a\u91cd\u8981\u7684\u8bc4\u4ef7\u7ef4\u5ea6\u3002
  • \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u300c\u5b9e\u9645\u6d4b\u8bd5\u300d\u6765\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\uff0c\u4f46\u96be\u4ee5\u6392\u9664\u6d4b\u8bd5\u73af\u5883\u7684\u5e72\u6270\uff0c\u5e76\u4e14\u975e\u5e38\u8017\u8d39\u8ba1\u7b97\u8d44\u6e90\u3002
  • \u300c\u590d\u6742\u5ea6\u5206\u6790\u300d\u514b\u670d\u4e86\u5b9e\u9645\u6d4b\u8bd5\u7684\u5f0a\u7aef\uff0c\u5206\u6790\u7ed3\u679c\u9002\u7528\u4e8e\u6240\u6709\u8fd0\u884c\u5e73\u53f0\uff0c\u5e76\u4e14\u53ef\u4ee5\u4f53\u73b0\u4e0d\u540c\u6570\u636e\u5927\u5c0f\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\u3002
"},{"location":"chapter_computational_complexity/summary/#_2","title":"\u65f6\u95f4\u590d\u6742\u5ea6","text":"
  • \u300c\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\uff0c\u53ef\u4ee5\u6709\u6548\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u5931\u6548\uff0c\u6bd4\u5982\u5728\u8f93\u5165\u6570\u636e\u91cf\u8f83\u5c0f\u6216\u65f6\u95f4\u590d\u6742\u5ea6\u76f8\u540c\u65f6\uff0c\u65e0\u6cd5\u7cbe\u786e\u5bf9\u6bd4\u7b97\u6cd5\u6548\u7387\u7684\u4f18\u52a3\u6027\u3002
  • \u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u4f7f\u7528\u5927 \\(O\\) \u7b26\u53f7\u8868\u793a\uff0c\u5373\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\uff0c\u5176\u53cd\u6620\u5f53 \\(n\\) \u8d8b\u4e8e\u6b63\u65e0\u7a77\u65f6\uff0c\\(T(n)\\) \u5904\u4e8e\u4f55\u79cd\u589e\u957f\u7ea7\u522b\u3002
  • \u63a8\u7b97\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u4e3a\u4e24\u6b65\uff0c\u9996\u5148\u7edf\u8ba1\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\uff0c\u518d\u5224\u65ad\u6e10\u8fd1\u4e0a\u754c\u3002
  • \u5e38\u89c1\u65f6\u95f4\u590d\u6742\u5ea6\u4ece\u5c0f\u5230\u5927\u6392\u5217\u6709 \\(O(1)\\) , \\(O(\\log n)\\) , \\(O(n)\\) , \\(O(n \\log n)\\) , \\(O(n^2)\\) , \\(O(2^n)\\) , \\(O(n!)\\) \u3002
  • \u67d0\u4e9b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u662f\u6052\u5b9a\u7684\uff0c\u800c\u662f\u4e0e\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\u6709\u5173\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u4e3a\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u548c\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u540e\u8005\u51e0\u4e4e\u4e0d\u7528\uff0c\u56e0\u4e3a\u8f93\u5165\u6570\u636e\u9700\u8981\u6ee1\u8db3\u82db\u523b\u7684\u6761\u4ef6\u624d\u80fd\u8fbe\u5230\u6700\u4f73\u60c5\u51b5\u3002
  • \u300c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u53ef\u4ee5\u53cd\u6620\u5728\u968f\u673a\u6570\u636e\u8f93\u5165\u4e0b\u7684\u7b97\u6cd5\u6548\u7387\uff0c\u6700\u8d34\u5408\u5b9e\u9645\u4f7f\u7528\u60c5\u51b5\u4e0b\u7684\u7b97\u6cd5\u6027\u80fd\u3002\u8ba1\u7b97\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u9700\u8981\u7edf\u8ba1\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\uff0c\u4ee5\u53ca\u7efc\u5408\u540e\u7684\u6570\u5b66\u671f\u671b\u3002
"},{"location":"chapter_computational_complexity/summary/#_3","title":"\u7a7a\u95f4\u590d\u6742\u5ea6","text":"
  • \u4e0e\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u5b9a\u4e49\u7c7b\u4f3c\uff0c\u300c\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\u7edf\u8ba1\u7b97\u6cd5\u5360\u7528\u7a7a\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf\u3002

  • \u7b97\u6cd5\u8fd0\u884c\u4e2d\u76f8\u5173\u5185\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u8f93\u5165\u7a7a\u95f4\u3001\u6682\u5b58\u7a7a\u95f4\u3001\u8f93\u51fa\u7a7a\u95f4\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165\u7a7a\u95f4\u4e0d\u8ba1\u5165\u7a7a\u95f4\u590d\u6742\u5ea6\u8ba1\u7b97\u3002\u6682\u5b58\u7a7a\u95f4\u53ef\u5206\u4e3a\u6307\u4ee4\u7a7a\u95f4\u3001\u6570\u636e\u7a7a\u95f4\u3001\u6808\u5e27\u7a7a\u95f4\uff0c\u5176\u4e2d\u6808\u5e27\u7a7a\u95f4\u4e00\u822c\u5728\u9012\u5f52\u51fd\u6570\u4e2d\u624d\u4f1a\u5f71\u54cd\u5230\u7a7a\u95f4\u590d\u6742\u5ea6\u3002

  • \u6211\u4eec\u4e00\u822c\u53ea\u5173\u5fc3\u300c\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u5373\u7edf\u8ba1\u7b97\u6cd5\u5728\u300c\u6700\u5dee\u8f93\u5165\u6570\u636e\u300d\u548c\u300c\u6700\u5dee\u8fd0\u884c\u65f6\u95f4\u70b9\u300d\u4e0b\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u3002
  • \u5e38\u89c1\u7a7a\u95f4\u590d\u6742\u5ea6\u4ece\u5c0f\u5230\u5927\u6392\u5217\u6709 \\(O(1)\\) , \\(O(\\log n)\\) , \\(O(n)\\) , \\(O(n^2)\\) , \\(O(2^n)\\) \u3002
"},{"location":"chapter_computational_complexity/time_complexity/","title":"2.2. \u00a0 \u65f6\u95f4\u590d\u6742\u5ea6","text":""},{"location":"chapter_computational_complexity/time_complexity/#221","title":"2.2.1. \u00a0 \u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4","text":"

\u8fd0\u884c\u65f6\u95f4\u80fd\u591f\u76f4\u89c2\u4e14\u51c6\u786e\u5730\u4f53\u73b0\u51fa\u7b97\u6cd5\u7684\u6548\u7387\u6c34\u5e73\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981 \u51c6\u786e\u9884\u4f30\u4e00\u6bb5\u4ee3\u7801\u7684\u8fd0\u884c\u65f6\u95f4 \uff0c\u8be5\u5982\u4f55\u505a\u5462\uff1f

  1. \u9996\u5148\u9700\u8981 \u786e\u5b9a\u8fd0\u884c\u5e73\u53f0 \uff0c\u5305\u62ec\u786c\u4ef6\u914d\u7f6e\u3001\u7f16\u7a0b\u8bed\u8a00\u3001\u7cfb\u7edf\u73af\u5883\u7b49\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u5f71\u54cd\u5230\u4ee3\u7801\u7684\u8fd0\u884c\u6548\u7387\u3002
  2. \u8bc4\u4f30 \u5404\u79cd\u8ba1\u7b97\u64cd\u4f5c\u7684\u6240\u9700\u8fd0\u884c\u65f6\u95f4 \uff0c\u4f8b\u5982\u52a0\u6cd5\u64cd\u4f5c + \u9700\u8981 1 ns \uff0c\u4e58\u6cd5\u64cd\u4f5c * \u9700\u8981 10 ns \uff0c\u6253\u5370\u64cd\u4f5c\u9700\u8981 5 ns \u7b49\u3002
  3. \u6839\u636e\u4ee3\u7801 \u7edf\u8ba1\u6240\u6709\u8ba1\u7b97\u64cd\u4f5c\u7684\u6570\u91cf \uff0c\u5e76\u5c06\u6240\u6709\u64cd\u4f5c\u7684\u6267\u884c\u65f6\u95f4\u6c42\u548c\uff0c\u5373\u53ef\u5f97\u5230\u8fd0\u884c\u65f6\u95f4\u3002

\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u6839\u636e\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5f97\u5230\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u4e3a \\(6n + 12\\) ns \u3002

\\[ 1 + 1 + 10 + (1 + 5) \\times n = 6n + 12 \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nSystem.out.println(0);     // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\ncout << 0 << endl;         // 5 ns\n}\n}\n
# \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\ndef algorithm(n: int) -> None:\na = 2      # 1 ns\na = a + 1  # 1 ns\na = a * 2  # 10 ns\n# \u5faa\u73af n \u6b21\nfor _ in range(n):  # 1 ns\nprint(0)        # 5 ns\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunc algorithm(n int) {\na := 2      // 1 ns\na = a + 1   // 1 ns\na = a * 2   // 10 ns\n// \u5faa\u73af n \u6b21\nfor i := 0; i < n; i++ {    // 1 ns\nfmt.Println(a)          // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunction algorithm(n) {\nvar a = 2; // 1 ns\na = a + 1; // 1 ns\na = a * 2; // 10 ns\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++) { // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nconsole.log(0); // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunction algorithm(n: number): void {\nvar a: number = 2; // 1 ns\na = a + 1; // 1 ns\na = a * 2; // 10 ns\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++) { // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nconsole.log(0); // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n) {\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {   // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nprintf(\"%d\", 0);            // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nvoid algorithm(int n)\n{\nint a = 2;  // 1 ns\na = a + 1;  // 1 ns\na = a * 2;  // 10 ns\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++)\n{  // 1 ns \uff0c\u6bcf\u8f6e\u90fd\u8981\u6267\u884c i++\nConsole.WriteLine(0);     // 5 ns\n}\n}\n
// \u5728\u67d0\u8fd0\u884c\u5e73\u53f0\u4e0b\nfunc algorithm(n: Int) {\nvar a = 2 // 1 ns\na = a + 1 // 1 ns\na = a * 2 // 10 ns\n// \u5faa\u73af n \u6b21\nfor _ in 0 ..< n { // 1 ns\nprint(0) // 5 ns\n}\n}\n
\n

\u4f46\u5b9e\u9645\u4e0a\uff0c \u7edf\u8ba1\u7b97\u6cd5\u7684\u8fd0\u884c\u65f6\u95f4\u65e2\u4e0d\u5408\u7406\u4e5f\u4e0d\u73b0\u5b9e\u3002\u9996\u5148\uff0c\u6211\u4eec\u4e0d\u5e0c\u671b\u9884\u4f30\u65f6\u95f4\u548c\u8fd0\u884c\u5e73\u53f0\u7ed1\u5b9a\uff0c\u6bd5\u7adf\u7b97\u6cd5\u9700\u8981\u8dd1\u5728\u5404\u5f0f\u5404\u6837\u7684\u5e73\u53f0\u4e4b\u4e0a\u3002\u5176\u6b21\uff0c\u6211\u4eec\u5f88\u96be\u83b7\u77e5\u6bcf\u4e00\u79cd\u64cd\u4f5c\u7684\u8fd0\u884c\u65f6\u95f4\uff0c\u8fd9\u4e3a\u9884\u4f30\u8fc7\u7a0b\u5e26\u6765\u4e86\u6781\u5927\u7684\u96be\u5ea6\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#222","title":"2.2.2. \u00a0 \u7edf\u8ba1\u65f6\u95f4\u589e\u957f\u8d8b\u52bf","text":"

\u300c\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u300d\u91c7\u53d6\u4e86\u4e0d\u540c\u7684\u505a\u6cd5\uff0c\u5176\u7edf\u8ba1\u7684\u4e0d\u662f\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\uff0c\u800c\u662f \u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740\u6570\u636e\u91cf\u53d8\u5927\u65f6\u7684\u589e\u957f\u8d8b\u52bf \u3002

\u201c\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u201d\u8fd9\u4e2a\u6982\u5ff5\u6bd4\u8f83\u62bd\u8c61\uff0c\u6211\u4eec\u501f\u52a9\u4e00\u4e2a\u4f8b\u5b50\u6765\u7406\u89e3\u3002\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u7ed9\u5b9a\u4e09\u4e2a\u7b97\u6cd5 A , B , C \u3002

  • \u7b97\u6cd5 A \u53ea\u6709 \\(1\\) \u4e2a\u6253\u5370\u64cd\u4f5c\uff0c\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u4e0d\u968f\u7740 \\(n\\) \u589e\u5927\u800c\u589e\u957f\u3002\u6211\u4eec\u79f0\u6b64\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a\u300c\u5e38\u6570\u9636\u300d\u3002
  • \u7b97\u6cd5 B \u4e2d\u7684\u6253\u5370\u64cd\u4f5c\u9700\u8981\u5faa\u73af \\(n\\) \u6b21\uff0c\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u968f\u7740 \\(n\\) \u589e\u5927\u6210\u7ebf\u6027\u589e\u957f\u3002\u6b64\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u88ab\u79f0\u4e3a\u300c\u7ebf\u6027\u9636\u300d\u3002
  • \u7b97\u6cd5 C \u4e2d\u7684\u6253\u5370\u64cd\u4f5c\u9700\u8981\u5faa\u73af \\(1000000\\) \u6b21\uff0c\u4f46\u8fd0\u884c\u65f6\u95f4\u4ecd\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\u3002\u56e0\u6b64 C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u548c A \u76f8\u540c\uff0c\u4ecd\u4e3a\u300c\u5e38\u6570\u9636\u300d\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\nSystem.out.println(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\nSystem.out.println(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\nSystem.out.println(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\ncout << 0 << endl;\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\ncout << 0 << endl;\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\ncout << 0 << endl;\n}\n}\n
# \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\ndef algorithm_A(n: int) -> None:\nprint(0)\n# \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\ndef algorithm_B(n: int) -> None:\nfor _ in range(n):\nprint(0)\n# \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\ndef algorithm_C(n: int) -> None:\nfor _ in range(1000000):\nprint(0)\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithm_A(n int) {\nfmt.Println(0)\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunc algorithm_B(n int) {\nfor i := 0; i < n; i++ {\nfmt.Println(0)\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithm_C(n int) {\nfor i := 0; i < 1000000; i++ {\nfmt.Println(0)\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_A(n) {\nconsole.log(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunction algorithm_B(n) {\nfor (let i = 0; i < n; i++) {\nconsole.log(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_C(n) {\nfor (let i = 0; i < 1000000; i++) {\nconsole.log(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_A(n: number): void {\nconsole.log(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunction algorithm_B(n: number): void {\nfor (let i = 0; i < n; i++) {\nconsole.log(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunction algorithm_C(n: number): void {\nfor (let i = 0; i < 1000000; i++) {\nconsole.log(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n) {\nprintf(\"%d\", 0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n) {\nfor (int i = 0; i < n; i++) {\nprintf(\"%d\", 0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n) {\nfor (int i = 0; i < 1000000; i++) {\nprintf(\"%d\", 0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_A(int n)\n{\nConsole.WriteLine(0);\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nvoid algorithm_B(int n)\n{\nfor (int i = 0; i < n; i++)\n{\nConsole.WriteLine(0);\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nvoid algorithm_C(int n)\n{\nfor (int i = 0; i < 1000000; i++)\n{\nConsole.WriteLine(0);\n}\n}\n
// \u7b97\u6cd5 A \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithmA(n: Int) {\nprint(0)\n}\n// \u7b97\u6cd5 B \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u7ebf\u6027\u9636\nfunc algorithmB(n: Int) {\nfor _ in 0 ..< n {\nprint(0)\n}\n}\n// \u7b97\u6cd5 C \u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u5e38\u6570\u9636\nfunc algorithmC(n: Int) {\nfor _ in 0 ..< 1000000 {\nprint(0)\n}\n}\n
\n

Fig. \u7b97\u6cd5 A, B, C \u7684\u65f6\u95f4\u589e\u957f\u8d8b\u52bf

\u76f8\u6bd4\u76f4\u63a5\u7edf\u8ba1\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u7684\u505a\u6cd5\u6709\u4ec0\u4e48\u597d\u5904\u5462\uff1f\u4ee5\u53ca\u6709\u4ec0\u4e48\u4e0d\u8db3\uff1f

\u65f6\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u6709\u6548\u8bc4\u4f30\u7b97\u6cd5\u6548\u7387\u3002\u7b97\u6cd5 B \u8fd0\u884c\u65f6\u95f4\u7684\u589e\u957f\u662f\u7ebf\u6027\u7684\uff0c\u5728 \\(n > 1\\) \u65f6\u6162\u4e8e\u7b97\u6cd5 A \uff0c\u5728 \\(n > 1000000\\) \u65f6\u6162\u4e8e\u7b97\u6cd5 C \u3002\u5b9e\u8d28\u4e0a\uff0c\u53ea\u8981\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u8db3\u591f\u5927\uff0c\u590d\u6742\u5ea6\u4e3a\u300c\u5e38\u6570\u9636\u300d\u7684\u7b97\u6cd5\u4e00\u5b9a\u4f18\u4e8e\u300c\u7ebf\u6027\u9636\u300d\u7684\u7b97\u6cd5\uff0c\u8fd9\u4e5f\u6b63\u662f\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u7684\u542b\u4e49\u3002

\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u63a8\u7b97\u65b9\u6cd5\u66f4\u52a0\u7b80\u4fbf\u3002\u5728\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u7edf\u8ba1\u300c\u8ba1\u7b97\u64cd\u4f5c\u7684\u8fd0\u884c\u65f6\u95f4\u300d\u7b80\u5316\u4e3a\u7edf\u8ba1\u300c\u8ba1\u7b97\u64cd\u4f5c\u7684\u6570\u91cf\u300d\uff0c\u8fd9\u662f\u56e0\u4e3a\uff0c\u65e0\u8bba\u662f\u8fd0\u884c\u5e73\u53f0\u8fd8\u662f\u8ba1\u7b97\u64cd\u4f5c\u7c7b\u578b\uff0c\u90fd\u4e0e\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u7684\u589e\u957f\u8d8b\u52bf\u65e0\u5173\u3002\u56e0\u800c\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u5730\u5c06\u6240\u6709\u8ba1\u7b97\u64cd\u4f5c\u7684\u6267\u884c\u65f6\u95f4\u7edf\u4e00\u770b\u4f5c\u662f\u76f8\u540c\u7684\u201c\u5355\u4f4d\u65f6\u95f4\u201d\uff0c\u8fd9\u6837\u7684\u7b80\u5316\u505a\u6cd5\u5927\u5927\u964d\u4f4e\u4e86\u4f30\u7b97\u96be\u5ea6\u3002

\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u5b58\u5728\u4e00\u5b9a\u7684\u5c40\u9650\u6027\u3002\u6bd4\u5982\uff0c\u867d\u7136\u7b97\u6cd5 A \u548c C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u76f8\u540c\uff0c\u4f46\u662f\u5b9e\u9645\u7684\u8fd0\u884c\u65f6\u95f4\u6709\u975e\u5e38\u5927\u7684\u5dee\u522b\u3002\u518d\u6bd4\u5982\uff0c\u867d\u7136\u7b97\u6cd5 B \u6bd4 C \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u8981\u66f4\u9ad8\uff0c\u4f46\u5728\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u6bd4\u8f83\u5c0f\u65f6\uff0c\u7b97\u6cd5 B \u662f\u8981\u660e\u663e\u4f18\u4e8e\u7b97\u6cd5 C \u7684\u3002\u5bf9\u4e8e\u4ee5\u4e0a\u60c5\u51b5\uff0c\u6211\u4eec\u5f88\u96be\u4ec5\u51ed\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u5224\u5b9a\u7b97\u6cd5\u6548\u7387\u9ad8\u4f4e\u3002\u7136\u800c\uff0c\u5373\u4f7f\u5b58\u5728\u8fd9\u4e9b\u95ee\u9898\uff0c\u590d\u6742\u5ea6\u5206\u6790\u4ecd\u7136\u662f\u8bc4\u5224\u7b97\u6cd5\u6548\u7387\u7684\u6700\u6709\u6548\u4e14\u5e38\u7528\u7684\u65b9\u6cd5\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#223","title":"2.2.3. \u00a0 \u51fd\u6570\u6e10\u8fd1\u4e0a\u754c","text":"

\u8bbe\u7b97\u6cd5\u300c\u8ba1\u7b97\u64cd\u4f5c\u6570\u91cf\u300d\u4e3a \\(T(n)\\) \uff0c\u5176\u662f\u4e00\u4e2a\u5173\u4e8e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u7684\u51fd\u6570\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u7b97\u6cd5\u7684\u64cd\u4f5c\u6570\u91cf\u4e3a

\\[ T(n) = 3 + 2n \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) { // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nSystem.out.println(0);    // +1\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) { // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\ncout << 0 << endl;    // +1\n}\n}\n
def algorithm(n: int) -> None:\na: int = 1  # +1\na = a + 1  # +1\na = a * 2  # +1\n# \u5faa\u73af n \u6b21\nfor i in range(n):  # +1\nprint(0)        # +1\n
func algorithm(n int) {\na := 1      // +1\na = a + 1   // +1\na = a * 2   // +1\n// \u5faa\u73af n \u6b21\nfor i := 0; i < n; i++ {   // +1\nfmt.Println(a)         // +1\n}\n}\n
function algorithm(n) {\nvar a = 1; // +1\na += 1; // +1\na *= 2; // +1\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++){ // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nconsole.log(0); // +1\n}\n}\n
function algorithm(n: number): void{\nvar a: number = 1; // +1\na += 1; // +1\na *= 2; // +1\n// \u5faa\u73af n \u6b21\nfor(let i = 0; i < n; i++){ // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nconsole.log(0); // +1\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) {   // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\nprintf(\"%d\", 0);            // +1\n}\n}  
void algorithm(int n)\n{\nint a = 1;  // +1\na = a + 1;  // +1\na = a * 2;  // +1\n// \u5faa\u73af n \u6b21\nfor (int i = 0; i < n; i++) // +1\uff08\u6bcf\u8f6e\u90fd\u6267\u884c i ++\uff09\n{\nConsole.WriteLine(0);   // +1\n}\n}\n
func algorithm(n: Int) {\nvar a = 1 // +1\na = a + 1 // +1\na = a * 2 // +1\n// \u5faa\u73af n \u6b21\nfor _ in 0 ..< n { // +1\nprint(0) // +1\n}\n}\n
\n

\\(T(n)\\) \u662f\u4e2a\u4e00\u6b21\u51fd\u6570\uff0c\u8bf4\u660e\u65f6\u95f4\u589e\u957f\u8d8b\u52bf\u662f\u7ebf\u6027\u7684\uff0c\u56e0\u6b64\u6613\u5f97\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u7ebf\u6027\u9636\u3002

\u6211\u4eec\u5c06\u7ebf\u6027\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u8bb0\u4e3a \\(O(n)\\) \uff0c\u8fd9\u4e2a\u6570\u5b66\u7b26\u53f7\u88ab\u79f0\u4e3a\u300c\u5927 \\(O\\) \u8bb0\u53f7 Big-\\(O\\) Notation\u300d\uff0c\u4ee3\u8868\u51fd\u6570 \\(T(n)\\) \u7684\u300c\u6e10\u8fd1\u4e0a\u754c asymptotic upper bound\u300d\u3002

\u6211\u4eec\u8981\u63a8\u7b97\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u672c\u8d28\u4e0a\u662f\u5728\u8ba1\u7b97\u300c\u64cd\u4f5c\u6570\u91cf\u51fd\u6570 \\(T(n)\\) \u300d\u7684\u6e10\u8fd1\u4e0a\u754c\u3002\u4e0b\u9762\u6211\u4eec\u5148\u6765\u770b\u770b\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\u7684\u6570\u5b66\u5b9a\u4e49\u3002

\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c

\u82e5\u5b58\u5728\u6b63\u5b9e\u6570 \\(c\\) \u548c\u5b9e\u6570 \\(n_0\\) \uff0c\u4f7f\u5f97\u5bf9\u4e8e\u6240\u6709\u7684 \\(n > n_0\\) \uff0c\u5747\u6709 $$ T(n) \\leq c \\cdot f(n) $$ \u5219\u53ef\u8ba4\u4e3a \\(f(n)\\) \u7ed9\u51fa\u4e86 \\(T(n)\\) \u7684\u4e00\u4e2a\u6e10\u8fd1\u4e0a\u754c\uff0c\u8bb0\u4e3a $$ T(n) = O(f(n)) $$

Fig. \u51fd\u6570\u7684\u6e10\u8fd1\u4e0a\u754c

\u672c\u8d28\u4e0a\u770b\uff0c\u8ba1\u7b97\u6e10\u8fd1\u4e0a\u754c\u5c31\u662f\u5728\u627e\u4e00\u4e2a\u51fd\u6570 \\(f(n)\\) \uff0c\u4f7f\u5f97\u5728 \\(n\\) \u8d8b\u5411\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\\(T(n)\\) \u548c \\(f(n)\\) \u5904\u4e8e\u76f8\u540c\u7684\u589e\u957f\u7ea7\u522b\uff08\u4ec5\u76f8\u5dee\u4e00\u4e2a\u5e38\u6570\u9879 \\(c\\) \u7684\u500d\u6570\uff09\u3002

Tip

\u6e10\u8fd1\u4e0a\u754c\u7684\u6570\u5b66\u5473\u513f\u6709\u70b9\u91cd\uff0c\u5982\u679c\u4f60\u611f\u89c9\u6ca1\u6709\u5b8c\u5168\u7406\u89e3\uff0c\u65e0\u9700\u62c5\u5fc3\uff0c\u56e0\u4e3a\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\u6211\u4eec\u53ea\u9700\u8981\u4f1a\u63a8\u7b97\u5373\u53ef\uff0c\u6570\u5b66\u610f\u4e49\u53ef\u4ee5\u6162\u6162\u9886\u609f\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#224","title":"2.2.4. \u00a0 \u63a8\u7b97\u65b9\u6cd5","text":"

\u63a8\u7b97\u51fa \\(f(n)\\) \u540e\uff0c\u6211\u4eec\u5c31\u5f97\u5230\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(f(n))\\) \u3002\u90a3\u4e48\uff0c\u5982\u4f55\u6765\u786e\u5b9a\u6e10\u8fd1\u4e0a\u754c \\(f(n)\\) \u5462\uff1f\u603b\u4f53\u5206\u4e3a\u4e24\u6b65\uff0c\u9996\u5148\u300c\u7edf\u8ba1\u64cd\u4f5c\u6570\u91cf\u300d\uff0c\u7136\u540e\u300c\u5224\u65ad\u6e10\u8fd1\u4e0a\u754c\u300d\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#1","title":"1) \u7edf\u8ba1\u64cd\u4f5c\u6570\u91cf","text":"

\u5bf9\u7740\u4ee3\u7801\uff0c\u4ece\u4e0a\u5230\u4e0b\u4e00\u884c\u4e00\u884c\u5730\u8ba1\u6570\u5373\u53ef\u3002\u7136\u800c\uff0c\u7531\u4e8e\u4e0a\u8ff0 \\(c \\cdot f(n)\\) \u4e2d\u7684\u5e38\u6570\u9879 \\(c\\) \u53ef\u4ee5\u53d6\u4efb\u610f\u5927\u5c0f\uff0c\u56e0\u6b64\u64cd\u4f5c\u6570\u91cf \\(T(n)\\) \u4e2d\u7684\u5404\u79cd\u7cfb\u6570\u3001\u5e38\u6570\u9879\u90fd\u53ef\u4ee5\u88ab\u5ffd\u7565\u3002\u6839\u636e\u6b64\u539f\u5219\uff0c\u53ef\u4ee5\u603b\u7ed3\u51fa\u4ee5\u4e0b\u8ba1\u6570\u5077\u61d2\u6280\u5de7\uff1a

  1. \u8df3\u8fc7\u6570\u91cf\u4e0e \\(n\\) \u65e0\u5173\u7684\u64cd\u4f5c\u3002\u56e0\u4e3a\u4ed6\u4eec\u90fd\u662f \\(T(n)\\) \u4e2d\u7684\u5e38\u6570\u9879\uff0c\u5bf9\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u4ea7\u751f\u5f71\u54cd\u3002
  2. \u7701\u7565\u6240\u6709\u7cfb\u6570\u3002\u4f8b\u5982\uff0c\u5faa\u73af \\(2n\\) \u6b21\u3001\\(5n + 1\\) \u6b21\u3001\u2026\u2026\uff0c\u90fd\u53ef\u4ee5\u5316\u7b80\u8bb0\u4e3a \\(n\\) \u6b21\uff0c\u56e0\u4e3a \\(n\\) \u524d\u9762\u7684\u7cfb\u6570\u5bf9\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u4e0d\u4ea7\u751f\u5f71\u54cd\u3002
  3. \u5faa\u73af\u5d4c\u5957\u65f6\u4f7f\u7528\u4e58\u6cd5\u3002\u603b\u64cd\u4f5c\u6570\u91cf\u7b49\u4e8e\u5916\u5c42\u5faa\u73af\u548c\u5185\u5c42\u5faa\u73af\u64cd\u4f5c\u6570\u91cf\u4e4b\u79ef\uff0c\u6bcf\u4e00\u5c42\u5faa\u73af\u4f9d\u7136\u53ef\u4ee5\u5206\u522b\u5957\u7528\u4e0a\u8ff0 1. \u548c 2. \u6280\u5de7\u3002

\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u4f7f\u7528\u4e0a\u8ff0\u6280\u5de7\u524d\u3001\u540e\u7684\u7edf\u8ba1\u7ed3\u679c\u3002

\\[ \\begin{aligned} T(n) & = 2n(n + 1) + (5n + 1) + 2 & \\text{\u5b8c\u6574\u7edf\u8ba1 (-.-|||)} \\newline & = 2n^2 + 7n + 3 \\newline T(n) & = n^2 + n & \\text{\u5077\u61d2\u7edf\u8ba1 (o.O)} \\end{aligned} \\]

\u6700\u7ec8\uff0c\u4e24\u8005\u90fd\u80fd\u63a8\u51fa\u76f8\u540c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7ed3\u679c\uff0c\u5373 \\(O(n^2)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\nSystem.out.println(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\nSystem.out.println(0);\n}\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\ncout << 0 << endl;\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\ncout << 0 << endl;\n}\n}\n}\n
def algorithm(n: int) -> None:\na: int = 1  # +0\uff08\u6280\u5de7 1\uff09\na = a + n   # +0\uff08\u6280\u5de7 1\uff09\n# +n\uff08\u6280\u5de7 2\uff09\nfor i in range(5 * n + 1):\nprint(0)\n# +n*n\uff08\u6280\u5de7 3\uff09\nfor i in range(2 * n):\nfor j in range(n + 1):\nprint(0)\n
func algorithm(n int) {\na := 1      // +0\uff08\u6280\u5de7 1\uff09\na = a + n  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor i := 0; i < 5 * n + 1; i++ {\nfmt.Println(0)\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor i := 0; i < 2 * n; i++ {\nfor j := 0; j < n + 1; j++ {\nfmt.Println(0)\n}\n}\n}\n
function algorithm(n) {\nlet a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (let i = 0; i < 5 * n + 1; i++) {\nconsole.log(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (let i = 0; i < 2 * n; i++) {\nfor (let j = 0; j < n + 1; j++) {\nconsole.log(0);\n}\n}\n}\n
function algorithm(n: number): void {\nlet a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (let i = 0; i < 5 * n + 1; i++) {\nconsole.log(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (let i = 0; i < 2 * n; i++) {\nfor (let j = 0; j < n + 1; j++) {\nconsole.log(0);\n}\n}\n}\n
void algorithm(int n) {\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++) {\nprintf(\"%d\", 0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++) {\nfor (int j = 0; j < n + 1; j++) {\nprintf(\"%d\", 0);\n}\n}\n}\n
void algorithm(int n)\n{\nint a = 1;  // +0\uff08\u6280\u5de7 1\uff09\na = a + n;  // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor (int i = 0; i < 5 * n + 1; i++)\n{\nConsole.WriteLine(0);\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor (int i = 0; i < 2 * n; i++)\n{\nfor (int j = 0; j < n + 1; j++)\n{\nConsole.WriteLine(0);\n}\n}\n}\n
func algorithm(n: Int) {\nvar a = 1 // +0\uff08\u6280\u5de7 1\uff09\na = a + n // +0\uff08\u6280\u5de7 1\uff09\n// +n\uff08\u6280\u5de7 2\uff09\nfor _ in 0 ..< (5 * n + 1) {\nprint(0)\n}\n// +n*n\uff08\u6280\u5de7 3\uff09\nfor _ in 0 ..< (2 * n) {\nfor _ in 0 ..< (n + 1) {\nprint(0)\n}\n}\n}\n
\n
"},{"location":"chapter_computational_complexity/time_complexity/#2","title":"2) \u5224\u65ad\u6e10\u8fd1\u4e0a\u754c","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\u7531\u591a\u9879\u5f0f \\(T(n)\\) \u4e2d\u6700\u9ad8\u9636\u7684\u9879\u6765\u51b3\u5b9a\u3002\u8fd9\u662f\u56e0\u4e3a\u5728 \\(n\\) \u8d8b\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\u6700\u9ad8\u9636\u7684\u9879\u5c06\u5904\u4e8e\u4e3b\u5bfc\u4f5c\u7528\uff0c\u5176\u5b83\u9879\u7684\u5f71\u54cd\u90fd\u53ef\u4ee5\u88ab\u5ffd\u7565\u3002

\u4ee5\u4e0b\u8868\u683c\u7ed9\u51fa\u4e86\u4e00\u4e9b\u4f8b\u5b50\uff0c\u5176\u4e2d\u6709\u4e00\u4e9b\u5938\u5f20\u7684\u503c\uff0c\u662f\u60f3\u8981\u5411\u5927\u5bb6\u5f3a\u8c03 \u7cfb\u6570\u65e0\u6cd5\u64bc\u52a8\u9636\u6570 \u8fd9\u4e00\u7ed3\u8bba\u3002\u5728 \\(n\\) \u8d8b\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\u8fd9\u4e9b\u5e38\u6570\u90fd\u662f\u201c\u6d6e\u4e91\u201d\u3002

\u64cd\u4f5c\u6570\u91cf \\(T(n)\\) \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(f(n))\\) \\(100000\\) \\(O(1)\\) \\(3n + 2\\) \\(O(n)\\) \\(2n^2 + 3n + 2\\) \\(O(n^2)\\) \\(n^3 + 10000n^2\\) \\(O(n^3)\\) \\(2^n + 10000n^{10000}\\) \\(O(2^n)\\)"},{"location":"chapter_computational_complexity/time_complexity/#225","title":"2.2.5. \u00a0 \u5e38\u89c1\u7c7b\u578b","text":"

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u5e38\u89c1\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7c7b\u578b\u6709\uff08\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\uff09

\\[ \\begin{aligned} O(1) < O(\\log n) < O(n) < O(n \\log n) < O(n^2) < O(2^n) < O(n!) \\newline \\text{\u5e38\u6570\u9636} < \\text{\u5bf9\u6570\u9636} < \\text{\u7ebf\u6027\u9636} < \\text{\u7ebf\u6027\u5bf9\u6570\u9636} < \\text{\u5e73\u65b9\u9636} < \\text{\u6307\u6570\u9636} < \\text{\u9636\u4e58\u9636} \\end{aligned} \\]

Fig. \u65f6\u95f4\u590d\u6742\u5ea6\u7684\u5e38\u89c1\u7c7b\u578b

Tip

\u90e8\u5206\u793a\u4f8b\u4ee3\u7801\u9700\u8981\u4e00\u4e9b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5305\u62ec\u6570\u7ec4\u3001\u9012\u5f52\u7b97\u6cd5\u7b49\u3002\u5982\u679c\u9047\u5230\u770b\u4e0d\u61c2\u7684\u5730\u65b9\u65e0\u9700\u62c5\u5fc3\uff0c\u53ef\u4ee5\u5728\u5b66\u4e60\u5b8c\u540e\u9762\u7ae0\u8282\u540e\u518d\u6765\u590d\u4e60\uff0c\u73b0\u9636\u6bb5\u5148\u805a\u7126\u5728\u7406\u89e3\u65f6\u95f4\u590d\u6742\u5ea6\u542b\u4e49\u548c\u63a8\u7b97\u65b9\u6cd5\u4e0a\u3002

"},{"location":"chapter_computational_complexity/time_complexity/#o1","title":"\u5e38\u6570\u9636 \\(O(1)\\)","text":"

\u5e38\u6570\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u4e0e\u8f93\u5165\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\uff0c\u5373\u4e0d\u968f\u7740 \\(n\\) \u7684\u53d8\u5316\u800c\u53d8\u5316\u3002

\u5bf9\u4e8e\u4ee5\u4e0b\u7b97\u6cd5\uff0c\u65e0\u8bba\u64cd\u4f5c\u6570\u91cf size \u6709\u591a\u5927\uff0c\u53ea\u8981\u4e0e\u6570\u636e\u5927\u5c0f \\(n\\) \u65e0\u5173\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5c31\u4ecd\u4e3a \\(O(1)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e38\u6570\u9636 */\nint constant(int n) {\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.cpp
/* \u5e38\u6570\u9636 */\nint constant(int n) {\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.py
def constant(n: int) -> int:\n\"\"\" \u5e38\u6570\u9636 \"\"\"\ncount: int = 0\nsize: int = 100000\nfor _ in range(size):\ncount += 1\nreturn count\n
time_complexity.go
/* \u5e38\u6570\u9636 */\nfunc constant(n int) int {\ncount := 0\nsize := 100000\nfor i := 0; i < size; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u5e38\u6570\u9636 */\nfunction constant(n) {\nlet count = 0;\nconst size = 100000;\nfor (let i = 0; i < size; i++) count++;\nreturn count;\n}\n
time_complexity.ts
/* \u5e38\u6570\u9636 */\nfunction constant(n: number): number {\nlet count = 0;\nconst size = 100000;\nfor (let i = 0; i < size; i++) count++;\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{constant}\n
time_complexity.cs
/* \u5e38\u6570\u9636 */\nint constant(int n)\n{\nint count = 0;\nint size = 100000;\nfor (int i = 0; i < size; i++)\ncount++;\nreturn count;\n}\n
time_complexity.swift
/* \u5e38\u6570\u9636 */\nfunc constant(n: Int) -> Int {\nvar count = 0\nlet size = 100_000\nfor _ in 0 ..< size {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u5e38\u6570\u9636\nfn constant(n: i32) i32 {\n_ = n;\nvar count: i32 = 0;\nconst size: i32 = 100_000;\nvar i: i32 = 0;\nwhile(i<size) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on","title":"\u7ebf\u6027\u9636 \\(O(n)\\)","text":"

\u7ebf\u6027\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u76f8\u5bf9\u8f93\u5165\u6570\u636e\u5927\u5c0f\u6210\u7ebf\u6027\u7ea7\u522b\u589e\u957f\u3002\u7ebf\u6027\u9636\u5e38\u51fa\u73b0\u4e8e\u5355\u5c42\u5faa\u73af\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u9636 */\nint linear(int n) {\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u9636 */\nint linear(int n) {\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.py
def linear(n: int) -> int:\n\"\"\" \u7ebf\u6027\u9636 \"\"\"\ncount: int = 0\nfor _ in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u9636 */\nfunc linear(n int) int {\ncount := 0\nfor i := 0; i < n; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u9636 */\nfunction linear(n) {\nlet count = 0;\nfor (let i = 0; i < n; i++) count++;\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u9636 */\nfunction linear(n: number): number {\nlet count = 0;\nfor (let i = 0; i < n; i++) count++;\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{linear}\n
time_complexity.cs
/* \u7ebf\u6027\u9636 */\nint linear(int n)\n{\nint count = 0;\nfor (int i = 0; i < n; i++)\ncount++;\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u9636 */\nfunc linear(n: Int) -> Int {\nvar count = 0\nfor _ in 0 ..< n {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u9636\nfn linear(n: i32) i32 {\nvar count: i32 = 0;\nvar i: i32 = 0;\nwhile (i < n) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n

\u300c\u904d\u5386\u6570\u7ec4\u300d\u548c\u300c\u904d\u5386\u94fe\u8868\u300d\u7b49\u64cd\u4f5c\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(n)\\) \uff0c\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u7684\u957f\u5ea6\u3002

Tip

\u6570\u636e\u5927\u5c0f \\(n\\) \u662f\u6839\u636e\u8f93\u5165\u6570\u636e\u7684\u7c7b\u578b\u6765\u786e\u5b9a\u7684\u3002\u6bd4\u5982\uff0c\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u76f4\u63a5\u5c06 \\(n\\) \u770b\u4f5c\u8f93\u5165\u6570\u636e\u5927\u5c0f\uff1b\u4ee5\u4e0b\u904d\u5386\u6570\u7ec4\u793a\u4f8b\u4e2d\uff0c\u6570\u636e\u5927\u5c0f \\(n\\) \u4e3a\u6570\u7ec4\u7684\u957f\u5ea6\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(int[] nums) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (int num : nums) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(vector<int>& nums) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (int num : nums) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def array_traversal(nums: List[int]) -> int:\n\"\"\" \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09\"\"\"\ncount: int = 0\n# \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor num in nums:\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunc arrayTraversal(nums []int) int {\ncount := 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor range nums {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunction arrayTraversal(nums) {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunction arrayTraversal(nums: number[]): number {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (let i = 0; i < nums.length; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{arrayTraversal}\n
time_complexity.cs
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nint arrayTraversal(int[] nums)\n{\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nforeach (int num in nums)\n{\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09 */\nfunc arrayTraversal(nums: [Int]) -> Int {\nvar count = 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor _ in nums {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u9636\uff08\u904d\u5386\u6570\u7ec4\uff09\nfn arrayTraversal(nums: []i32) i32 {\nvar count: i32 = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u6b63\u6bd4\nfor (nums) |_| {\ncount += 1;\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on2","title":"\u5e73\u65b9\u9636 \\(O(n^2)\\)","text":"

\u5e73\u65b9\u9636\u7684\u64cd\u4f5c\u6570\u91cf\u76f8\u5bf9\u8f93\u5165\u6570\u636e\u5927\u5c0f\u6210\u5e73\u65b9\u7ea7\u522b\u589e\u957f\u3002\u5e73\u65b9\u9636\u5e38\u51fa\u73b0\u4e8e\u5d4c\u5957\u5faa\u73af\uff0c\u5916\u5c42\u5faa\u73af\u548c\u5185\u5c42\u5faa\u73af\u90fd\u4e3a \\(O(n)\\) \uff0c\u603b\u4f53\u4e3a \\(O(n^2)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e73\u65b9\u9636 */\nint quadratic(int n) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5e73\u65b9\u9636 */\nint quadratic(int n) {\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.py
def quadratic(n: int) -> int:\n\"\"\" \u5e73\u65b9\u9636 \"\"\"\ncount: int = 0\n# \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor i in range(n):\nfor j in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n int) int {\ncount := 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor i := 0; i < n; i++ {\nfor j := 0; j < n; j++ {\ncount++\n}\n}\nreturn count\n}\n
time_complexity.js
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n) {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5e73\u65b9\u9636 */\nfunction quadratic(n: number): number {\nlet count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < n; j++) {\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{quadratic}\n
time_complexity.cs
/* \u5e73\u65b9\u9636 */\nint quadratic(int n)\n{\nint count = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor (int i = 0; i < n; i++)\n{\nfor (int j = 0; j < n; j++)\n{\ncount++;\n}\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5e73\u65b9\u9636 */\nfunc quadratic(n: Int) -> Int {\nvar count = 0\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nfor _ in 0 ..< n {\nfor _ in 0 ..< n {\ncount += 1\n}\n}\nreturn count\n}\n
time_complexity.zig
// \u5e73\u65b9\u9636\nfn quadratic(n: i32) i32 {\nvar count: i32 = 0;\nvar i: i32 = 0;\n// \u5faa\u73af\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6\u6210\u5e73\u65b9\u5173\u7cfb\nwhile (i < n) : (i += 1) {\nvar j: i32 = 0;\nwhile (j < n) : (j += 1) {\ncount += 1;\n}\n}\nreturn count;\n}\n

Fig. \u5e38\u6570\u9636\u3001\u7ebf\u6027\u9636\u3001\u5e73\u65b9\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u4ee5\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u4e3a\u4f8b\uff0c\u5916\u5c42\u5faa\u73af \\(n - 1\\) \u6b21\uff0c\u5185\u5c42\u5faa\u73af \\(n-1, n-2, \\cdots, 2, 1\\) \u6b21\uff0c\u5e73\u5747\u4e3a \\(\\frac{n}{2}\\) \u6b21\uff0c\u56e0\u6b64\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \u3002

\\[ O((n - 1) \\frac{n}{2}) = O(n^2) \\] JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(int[] nums) {\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(vector<int>& nums) {\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.py
def bubble_sort(nums: List[int]) -> int:\n\"\"\" \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09\"\"\"\ncount: int = 0  # \u8ba1\u6570\u5668\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(len(nums) - 1, 0, -1):\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\ntmp: int = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\ncount += 3  # \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\nreturn count\n
time_complexity.go
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunc bubbleSort(nums []int) int {\ncount := 0 // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\ntmp := nums[j]\nnums[j] = nums[j+1]\nnums[j+1] = tmp\ncount += 3 // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count\n}\n
time_complexity.js
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunction bubbleSort(nums) {\nlet count = 0; // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3; // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunction bubbleSort(nums: number[]): number {\nlet count = 0; // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3; // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{bubbleSort}\n
time_complexity.cs
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nint bubbleSort(int[] nums)\n{\nint count = 0;  // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09 */\nfunc bubbleSort(nums: inout [Int]) -> Int {\nvar count = 0 // \u8ba1\u6570\u5668\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in sequence(first: nums.count - 1, next: { $0 > 0 + 1 ? $0 - 1 : nil }) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in 0 ..< i {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\ncount += 3 // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count\n}\n
time_complexity.zig
// \u5e73\u65b9\u9636\uff08\u5192\u6ce1\u6392\u5e8f\uff09\nfn bubbleSort(nums: []i32) i32 {\nvar count: i32 = 0;  // \u8ba1\u6570\u5668 \n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: i32 = @intCast(i32, nums.len ) - 1;\nwhile (i > 0) : (i -= 1) {\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\ncount += 3;  // \u5143\u7d20\u4ea4\u6362\u5305\u542b 3 \u4e2a\u5355\u5143\u64cd\u4f5c\n}\n}\n}\nreturn count;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#o2n","title":"\u6307\u6570\u9636 \\(O(2^n)\\)","text":"

Note

\u751f\u7269\u5b66\u79d1\u4e2d\u7684\u201c\u7ec6\u80de\u5206\u88c2\u201d\u5373\u662f\u6307\u6570\u9636\u589e\u957f\uff1a\u521d\u59cb\u72b6\u6001\u4e3a \\(1\\) \u4e2a\u7ec6\u80de\uff0c\u5206\u88c2\u4e00\u8f6e\u540e\u4e3a \\(2\\) \u4e2a\uff0c\u5206\u88c2\u4e24\u8f6e\u540e\u4e3a \\(4\\) \u4e2a\uff0c\u2026\u2026\uff0c\u5206\u88c2 \\(n\\) \u8f6e\u540e\u6709 \\(2^n\\) \u4e2a\u7ec6\u80de\u3002

\u6307\u6570\u9636\u589e\u957f\u5f97\u975e\u5e38\u5feb\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u4e00\u822c\u662f\u4e0d\u80fd\u88ab\u63a5\u53d7\u7684\u3002\u82e5\u4e00\u4e2a\u95ee\u9898\u4f7f\u7528\u300c\u66b4\u529b\u679a\u4e3e\u300d\u6c42\u89e3\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f \\(O(2^n)\\) \uff0c\u90a3\u4e48\u4e00\u822c\u90fd\u9700\u8981\u4f7f\u7528\u300c\u52a8\u6001\u89c4\u5212\u300d\u6216\u300c\u8d2a\u5fc3\u7b97\u6cd5\u300d\u7b49\u7b97\u6cd5\u6765\u6c42\u89e3\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n) {\nint count = 0, base = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.cpp
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n) {\nint count = 0, base = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++) {\nfor (int j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.py
def exponential(n: int) -> int:\n\"\"\" \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\"\"\"\ncount: int = 0\nbase: int = 1\n# cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor _ in range(n):\nfor _ in range(base):\ncount += 1\nbase *= 2\n# count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n
time_complexity.go
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09*/\nfunc exponential(n int) int {\ncount, base := 0, 1\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor i := 0; i < n; i++ {\nfor j := 0; j < base; j++ {\ncount++\n}\nbase *= 2\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n}\n
time_complexity.js
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction exponential(n) {\nlet count = 0,\nbase = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.ts
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction exponential(n: number): number {\nlet count = 0,\nbase = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (let i = 0; i < n; i++) {\nfor (let j = 0; j < base; j++) {\ncount++;\n}\nbase *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{exponential}\n
time_complexity.cs
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint exponential(int n)\n{\nint count = 0, bas = 1;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor (int i = 0; i < n; i++)\n{\nfor (int j = 0; j < bas; j++)\n{\ncount++;\n}\nbas *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n
time_complexity.swift
/* \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunc exponential(n: Int) -> Int {\nvar count = 0\nvar base = 1\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nfor _ in 0 ..< n {\nfor _ in 0 ..< base {\ncount += 1\n}\nbase *= 2\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count\n}\n
time_complexity.zig
// \u6307\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\nfn exponential(n: i32) i32 {\nvar count: i32 = 0;\nvar bas: i32 = 1;\nvar i: i32 = 0;\n// cell \u6bcf\u8f6e\u4e00\u5206\u4e3a\u4e8c\uff0c\u5f62\u6210\u6570\u5217 1, 2, 4, 8, ..., 2^(n-1)\nwhile (i < n) : (i += 1) {\nvar j: i32 = 0;\nwhile (j < bas) : (j += 1) {\ncount += 1;\n}\nbas *= 2;\n}\n// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1\nreturn count;\n}\n

Fig. \u6307\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u5728\u5b9e\u9645\u7b97\u6cd5\u4e2d\uff0c\u6307\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u9012\u5f52\u51fd\u6570\u3002\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u4e0d\u65ad\u5730\u4e00\u5206\u4e3a\u4e8c\uff0c\u5206\u88c2 \\(n\\) \u6b21\u540e\u505c\u6b62\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.cpp
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.py
def exp_recur(n: int) -> int:\n\"\"\" \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n == 1: return 1\nreturn exp_recur(n - 1) + exp_recur(n - 1) + 1\n
time_complexity.go
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09*/\nfunc expRecur(n int) int {\nif n == 1 {\nreturn 1\n}\nreturn expRecur(n-1) + expRecur(n-1) + 1\n}\n
time_complexity.js
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction expRecur(n) {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.ts
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction expRecur(n: number): number {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.c
[class]{}-[func]{expRecur}\n
time_complexity.cs
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint expRecur(int n)\n{\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
time_complexity.swift
/* \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc expRecur(n: Int) -> Int {\nif n == 1 {\nreturn 1\n}\nreturn expRecur(n: n - 1) + expRecur(n: n - 1) + 1\n}\n
time_complexity.zig
// \u6307\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn expRecur(n: i32) i32 {\nif (n == 1) return 1;\nreturn expRecur(n - 1) + expRecur(n - 1) + 1;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#olog-n","title":"\u5bf9\u6570\u9636 \\(O(\\log n)\\)","text":"

\u5bf9\u6570\u9636\u4e0e\u6307\u6570\u9636\u6b63\u597d\u76f8\u53cd\uff0c\u540e\u8005\u53cd\u6620\u201c\u6bcf\u8f6e\u589e\u52a0\u5230\u4e24\u500d\u7684\u60c5\u51b5\u201d\uff0c\u800c\u524d\u8005\u53cd\u6620\u201c\u6bcf\u8f6e\u7f29\u51cf\u5230\u4e00\u534a\u7684\u60c5\u51b5\u201d\u3002\u5bf9\u6570\u9636\u4ec5\u6b21\u4e8e\u5e38\u6570\u9636\uff0c\u65f6\u95f4\u589e\u957f\u5f97\u5f88\u6162\uff0c\u662f\u7406\u60f3\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u3002

\u5bf9\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u300c\u4e8c\u5206\u67e5\u627e\u300d\u548c\u300c\u5206\u6cbb\u7b97\u6cd5\u300d\u4e2d\uff0c\u4f53\u73b0\u201c\u4e00\u5206\u4e3a\u591a\u201d\u3001\u201c\u5316\u7e41\u4e3a\u7b80\u201d\u7684\u7b97\u6cd5\u601d\u60f3\u3002

\u8bbe\u8f93\u5165\u6570\u636e\u5927\u5c0f\u4e3a \\(n\\) \uff0c\u7531\u4e8e\u6bcf\u8f6e\u7f29\u51cf\u5230\u4e00\u534a\uff0c\u56e0\u6b64\u5faa\u73af\u6b21\u6570\u662f \\(\\log_2 n\\) \uff0c\u5373 \\(2^n\\) \u7684\u53cd\u51fd\u6570\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n) {\nint count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n) {\nint count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def logarithmic(n: float) -> int:\n\"\"\" \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\"\"\"\ncount: int = 0\nwhile n > 1:\nn = n / 2\ncount += 1\nreturn count\n
time_complexity.go
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09*/\nfunc logarithmic(n float64) int {\ncount := 0\nfor n > 1 {\nn = n / 2\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction logarithmic(n) {\nlet count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunction logarithmic(n: number): number {\nlet count = 0;\nwhile (n > 1) {\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{logarithmic}\n
time_complexity.cs
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nint logarithmic(float n)\n{\nint count = 0;\nwhile (n > 1)\n{\nn = n / 2;\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09 */\nfunc logarithmic(n: Double) -> Int {\nvar count = 0\nvar n = n\nwhile n > 1 {\nn = n / 2\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u5bf9\u6570\u9636\uff08\u5faa\u73af\u5b9e\u73b0\uff09\nfn logarithmic(n: f32) i32 {\nvar count: i32 = 0;\nvar n_var = n;\nwhile (n_var > 1)\n{\nn_var = n_var / 2;\ncount +=1;\n}\nreturn count;\n}\n

Fig. \u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

\u4e0e\u6307\u6570\u9636\u7c7b\u4f3c\uff0c\u5bf9\u6570\u9636\u4e5f\u5e38\u51fa\u73b0\u4e8e\u9012\u5f52\u51fd\u6570\u3002\u4ee5\u4e0b\u4ee3\u7801\u5f62\u6210\u4e86\u4e00\u4e2a\u9ad8\u5ea6\u4e3a \\(\\log_2 n\\) \u7684\u9012\u5f52\u6811\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.cpp
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.py
def log_recur(n: float) -> int:\n\"\"\" \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n <= 1: return 0\nreturn log_recur(n / 2) + 1\n
time_complexity.go
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09*/\nfunc logRecur(n float64) int {\nif n <= 1 {\nreturn 0\n}\nreturn logRecur(n/2) + 1\n}\n
time_complexity.js
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction logRecur(n) {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.ts
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction logRecur(n: number): number {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.c
[class]{}-[func]{logRecur}\n
time_complexity.cs
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint logRecur(float n)\n{\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
time_complexity.swift
/* \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc logRecur(n: Double) -> Int {\nif n <= 1 {\nreturn 0\n}\nreturn logRecur(n: n / 2) + 1\n}\n
time_complexity.zig
// \u5bf9\u6570\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn logRecur(n: f32) i32 {\nif (n <= 1) return 0;\nreturn logRecur(n / 2) + 1;\n}\n
"},{"location":"chapter_computational_complexity/time_complexity/#on-log-n","title":"\u7ebf\u6027\u5bf9\u6570\u9636 \\(O(n \\log n)\\)","text":"

\u7ebf\u6027\u5bf9\u6570\u9636\u5e38\u51fa\u73b0\u4e8e\u5d4c\u5957\u5faa\u73af\u4e2d\uff0c\u4e24\u5c42\u5faa\u73af\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u522b\u4e3a \\(O(\\log n)\\) \u548c \\(O(n)\\) \u3002

\u4e3b\u6d41\u6392\u5e8f\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f \\(O(n \\log n )\\) \uff0c\u4f8b\u5982\u5feb\u901f\u6392\u5e8f\u3001\u5f52\u5e76\u6392\u5e8f\u3001\u5806\u6392\u5e8f\u7b49\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n) {\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (int i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n) {\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (int i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.py
def linear_log_recur(n: float) -> int:\n\"\"\" \u7ebf\u6027\u5bf9\u6570\u9636 \"\"\"\nif n <= 1: return 1\ncount: int = linear_log_recur(n // 2) + \\\n                 linear_log_recur(n // 2)\nfor _ in range(n):\ncount += 1\nreturn count\n
time_complexity.go
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunc linearLogRecur(n float64) int {\nif n <= 1 {\nreturn 1\n}\ncount := linearLogRecur(n/2) +\nlinearLogRecur(n/2)\nfor i := 0.0; i < n; i++ {\ncount++\n}\nreturn count\n}\n
time_complexity.js
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunction linearLogRecur(n) {\nif (n <= 1) return 1;\nlet count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (let i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.ts
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunction linearLogRecur(n: number): number {\nif (n <= 1) return 1;\nlet count = linearLogRecur(n / 2) + linearLogRecur(n / 2);\nfor (let i = 0; i < n; i++) {\ncount++;\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{linearLogRecur}\n
time_complexity.cs
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nint linearLogRecur(float n)\n{\nif (n <= 1) return 1;\nint count = linearLogRecur(n / 2) +\nlinearLogRecur(n / 2);\nfor (int i = 0; i < n; i++)\n{\ncount++;\n}\nreturn count;\n}\n
time_complexity.swift
/* \u7ebf\u6027\u5bf9\u6570\u9636 */\nfunc linearLogRecur(n: Double) -> Int {\nif n <= 1 {\nreturn 1\n}\nvar count = linearLogRecur(n: n / 2) + linearLogRecur(n: n / 2)\nfor _ in sequence(first: 0, next: { $0 < n - 1 ? $0 + 1 : nil }) {\ncount += 1\n}\nreturn count\n}\n
time_complexity.zig
// \u7ebf\u6027\u5bf9\u6570\u9636\nfn linearLogRecur(n: f32) i32 {\nif (n <= 1) return 1;\nvar count: i32 = linearLogRecur(n / 2) +\nlinearLogRecur(n / 2);\nvar i: f32 = 0;\nwhile (i < n) : (i += 1) {\ncount += 1;\n}\nreturn count;\n}\n

Fig. \u7ebf\u6027\u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/time_complexity/#on_1","title":"\u9636\u4e58\u9636 \\(O(n!)\\)","text":"

\u9636\u4e58\u9636\u5bf9\u5e94\u6570\u5b66\u4e0a\u7684\u300c\u5168\u6392\u5217\u300d\u3002\u5373\u7ed9\u5b9a \\(n\\) \u4e2a\u4e92\u4e0d\u91cd\u590d\u7684\u5143\u7d20\uff0c\u6c42\u5176\u6240\u6709\u53ef\u80fd\u7684\u6392\u5217\u65b9\u6848\uff0c\u5219\u65b9\u6848\u6570\u91cf\u4e3a

\\[ n! = n \\times (n - 1) \\times (n - 2) \\times \\cdots \\times 2 \\times 1 \\]

\u9636\u4e58\u5e38\u4f7f\u7528\u9012\u5f52\u5b9e\u73b0\u3002\u4f8b\u5982\u4ee5\u4e0b\u4ee3\u7801\uff0c\u7b2c\u4e00\u5c42\u5206\u88c2\u51fa \\(n\\) \u4e2a\uff0c\u7b2c\u4e8c\u5c42\u5206\u88c2\u51fa \\(n - 1\\) \u4e2a\uff0c\u2026\u2026 \uff0c\u76f4\u81f3\u5230\u7b2c \\(n\\) \u5c42\u65f6\u7ec8\u6b62\u5206\u88c2\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig time_complexity.java
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n) {\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.cpp
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n) {\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.py
def factorial_recur(n: int) -> int:\n\"\"\" \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\"\"\"\nif n == 0: return 1\ncount: int = 0\n# \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor _ in range(n):\ncount += factorial_recur(n - 1)\nreturn count\n
time_complexity.go
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc factorialRecur(n int) int {\nif n == 0 {\nreturn 1\n}\ncount := 0\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor i := 0; i < n; i++ {\ncount += factorialRecur(n - 1)\n}\nreturn count\n}\n
time_complexity.js
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction factorialRecur(n) {\nif (n == 0) return 1;\nlet count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (let i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.ts
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunction factorialRecur(n: number): number {\nif (n == 0) return 1;\nlet count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (let i = 0; i < n; i++) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.c
[class]{}-[func]{factorialRecur}\n
time_complexity.cs
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nint factorialRecur(int n)\n{\nif (n == 0) return 1;\nint count = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor (int i = 0; i < n; i++)\n{\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n
time_complexity.swift
/* \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09 */\nfunc factorialRecur(n: Int) -> Int {\nif n == 0 {\nreturn 1\n}\nvar count = 0\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nfor _ in 0 ..< n {\ncount += factorialRecur(n: n - 1)\n}\nreturn count\n}\n
time_complexity.zig
// \u9636\u4e58\u9636\uff08\u9012\u5f52\u5b9e\u73b0\uff09\nfn factorialRecur(n: i32) i32 {\nif (n == 0) return 1;\nvar count: i32 = 0;\nvar i: i32 = 0;\n// \u4ece 1 \u4e2a\u5206\u88c2\u51fa n \u4e2a\nwhile (i < n) : (i += 1) {\ncount += factorialRecur(n - 1);\n}\nreturn count;\n}\n

Fig. \u9636\u4e58\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6

"},{"location":"chapter_computational_complexity/time_complexity/#226","title":"2.2.6. \u00a0 \u6700\u5dee\u3001\u6700\u4f73\u3001\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6","text":"

\u67d0\u4e9b\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u662f\u6052\u5b9a\u7684\uff0c\u800c\u662f\u4e0e\u8f93\u5165\u6570\u636e\u7684\u5206\u5e03\u6709\u5173\u3002\u4e3e\u4e00\u4e2a\u4f8b\u5b50\uff0c\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6\u4e3a \\(n\\) \u6570\u7ec4 nums \uff0c\u5176\u4e2d nums \u7531\u4ece \\(1\\) \u81f3 \\(n\\) \u7684\u6570\u5b57\u7ec4\u6210\uff0c\u4f46\u5143\u7d20\u987a\u5e8f\u662f\u968f\u673a\u6253\u4e71\u7684\uff1b\u7b97\u6cd5\u7684\u4efb\u52a1\u662f\u8fd4\u56de\u5143\u7d20 \\(1\\) \u7684\u7d22\u5f15\u3002\u6211\u4eec\u53ef\u4ee5\u5f97\u51fa\u4ee5\u4e0b\u7ed3\u8bba\uff1a

  • \u5f53 nums = [?, ?, ..., 1]\uff0c\u5373\u5f53\u672b\u5c3e\u5143\u7d20\u662f \\(1\\) \u65f6\uff0c\u5219\u9700\u5b8c\u6574\u904d\u5386\u6570\u7ec4\uff0c\u6b64\u65f6\u8fbe\u5230 \u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1b
  • \u5f53 nums = [1, ?, ?, ...] \uff0c\u5373\u5f53\u9996\u4e2a\u6570\u5b57\u4e3a \\(1\\) \u65f6\uff0c\u65e0\u8bba\u6570\u7ec4\u591a\u957f\u90fd\u4e0d\u9700\u8981\u7ee7\u7eed\u904d\u5386\uff0c\u6b64\u65f6\u8fbe\u5230 \u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 \\(\\Omega(1)\\) \uff1b

\u300c\u51fd\u6570\u6e10\u8fd1\u4e0a\u754c\u300d\u4f7f\u7528\u5927 \\(O\\) \u8bb0\u53f7\u8868\u793a\uff0c\u4ee3\u8868\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u3002\u4e0e\u4e4b\u5bf9\u5e94\uff0c\u300c\u51fd\u6570\u6e10\u8fd1\u4e0b\u754c\u300d\u7528 \\(\\Omega\\) \u8bb0\u53f7\uff08Omega Notation\uff09\u6765\u8868\u793a\uff0c\u4ee3\u8868\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig worst_best_time_complexity.java
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nint[] randomNumbers(int n) {\nInteger[] nums = new Integer[n];\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nCollections.shuffle(Arrays.asList(nums));\n// Integer[] -> int[]\nint[] res = new int[n];\nfor (int i = 0; i < n; i++) {\nres[i] = nums[i];\n}\nreturn res;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(int[] nums) {\nfor (int i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.cpp
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nvector<int> randomNumbers(int n) {\nvector<int> nums(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u4f7f\u7528\u7cfb\u7edf\u65f6\u95f4\u751f\u6210\u968f\u673a\u79cd\u5b50\nunsigned seed = chrono::system_clock::now().time_since_epoch().count();\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nshuffle(nums.begin(), nums.end(), default_random_engine(seed));\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(vector<int>& nums) {\nfor (int i = 0; i < nums.size(); i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.py
def random_numbers(n: int) -> List[int]:\n\"\"\" \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a: 1, 2, ..., n \uff0c\u987a\u5e8f\u88ab\u6253\u4e71 \"\"\"\n# \u751f\u6210\u6570\u7ec4 nums =: 1, 2, 3, ..., n\nnums: List[int] = [i for i in range(1, n + 1)]\n# \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nrandom.shuffle(nums)\nreturn nums\ndef find_one(nums: List[int]) -> int:\n\"\"\" \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 \"\"\"\nfor i in range(len(nums)):\n# \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n# \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1:\nreturn i\nreturn -1\n
worst_best_time_complexity.go
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunc randomNumbers(n int) []int {\nnums := make([]int, n)\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor i := 0; i < n; i++ {\nnums[i] = i + 1\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nrand.Shuffle(len(nums), func(i, j int) {\nnums[i], nums[j] = nums[j], nums[i]\n})\nreturn nums\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunc findOne(nums []int) int {\nfor i := 0; i < len(nums); i++ {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1 {\nreturn i\n}\n}\nreturn -1\n}\n
worst_best_time_complexity.js
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunction randomNumbers(n) {\nconst nums = Array(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (let i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (let i = 0; i < n; i++) {\nconst r = Math.floor(Math.random() * (i + 1));\nconst temp = nums[i];\nnums[i] = nums[r];\nnums[r] = temp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunction findOne(nums) {\nfor (let i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] === 1) {\nreturn i;\n}\n}\nreturn -1;\n}\n
worst_best_time_complexity.ts
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunction randomNumbers(n: number): number[] {\nconst nums = Array(n);\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (let i = 0; i < n; i++) {\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (let i = 0; i < n; i++) {\nconst r = Math.floor(Math.random() * (i + 1));\nconst temp = nums[i];\nnums[i] = nums[r];\nnums[r] = temp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunction findOne(nums: number[]): number {\nfor (let i = 0; i < nums.length; i++) {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] === 1) {\nreturn i;\n}\n}\nreturn -1;\n}\n
worst_best_time_complexity.c
[class]{}-[func]{randomNumbers}\n[class]{}-[func]{findOne}\n
worst_best_time_complexity.cs
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nint[] randomNumbers(int n)\n{\nint[] nums = new int[n];\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (int i = 0; i < n; i++)\n{\nnums[i] = i + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nfor (int i = 0; i < nums.Length; i++)\n{\nvar index = new Random().Next(i, nums.Length);\nvar tmp = nums[i];\nvar ran = nums[index];\nnums[i] = ran;\nnums[index] = tmp;\n}\nreturn nums;\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nint findOne(int[] nums)\n{\nfor (int i = 0; i < nums.Length; i++)\n{\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (nums[i] == 1)\nreturn i;\n}\nreturn -1;\n}\n
worst_best_time_complexity.swift
/* \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71 */\nfunc randomNumbers(n: Int) -> [Int] {\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nvar nums = Array(1 ... n)\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nnums.shuffle()\nreturn nums\n}\n/* \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15 */\nfunc findOne(nums: [Int]) -> Int {\nfor i in nums.indices {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif nums[i] == 1 {\nreturn i\n}\n}\nreturn -1\n}\n
worst_best_time_complexity.zig
// \u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u5143\u7d20\u4e3a { 1, 2, ..., n }\uff0c\u987a\u5e8f\u88ab\u6253\u4e71\npub fn randomNumbers(comptime n: usize) [n]i32 {\nvar nums: [n]i32 = undefined;\n// \u751f\u6210\u6570\u7ec4 nums = { 1, 2, 3, ..., n }\nfor (nums) |*num, i| {\nnum.* = @intCast(i32, i) + 1;\n}\n// \u968f\u673a\u6253\u4e71\u6570\u7ec4\u5143\u7d20\nconst rand = std.crypto.random;\nrand.shuffle(i32, &nums);\nreturn nums;\n}\n// \u67e5\u627e\u6570\u7ec4 nums \u4e2d\u6570\u5b57 1 \u6240\u5728\u7d22\u5f15\npub fn findOne(nums: []i32) i32 {\nfor (nums) |num, i| {\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5934\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 O(1)\n// \u5f53\u5143\u7d20 1 \u5728\u6570\u7ec4\u5c3e\u90e8\u65f6\uff0c\u8fbe\u5230\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 O(n)\nif (num == 1) return @intCast(i32, i);\n}\nreturn -1;\n}\n

Tip

\u6211\u4eec\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u5f88\u5c11\u4f7f\u7528\u300c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u300d\uff0c\u56e0\u4e3a\u5f80\u5f80\u53ea\u6709\u5f88\u5c0f\u6982\u7387\u4e0b\u624d\u80fd\u8fbe\u5230\uff0c\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u8bef\u5bfc\u6027\u3002\u53cd\u4e4b\uff0c\u300c\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u6700\u4e3a\u5b9e\u7528\uff0c\u56e0\u4e3a\u5b83\u7ed9\u51fa\u4e86\u4e00\u4e2a\u201c\u6548\u7387\u5b89\u5168\u503c\u201d\uff0c\u8ba9\u6211\u4eec\u53ef\u4ee5\u653e\u5fc3\u5730\u4f7f\u7528\u7b97\u6cd5\u3002

\u4ece\u4e0a\u8ff0\u793a\u4f8b\u53ef\u4ee5\u770b\u51fa\uff0c\u6700\u5dee\u6216\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u53ea\u51fa\u73b0\u5728\u201c\u7279\u6b8a\u5206\u5e03\u7684\u6570\u636e\u201d\u4e2d\uff0c\u8fd9\u4e9b\u60c5\u51b5\u7684\u51fa\u73b0\u6982\u7387\u5f80\u5f80\u5f88\u5c0f\uff0c\u56e0\u6b64\u5e76\u4e0d\u80fd\u6700\u771f\u5b9e\u5730\u53cd\u6620\u7b97\u6cd5\u8fd0\u884c\u6548\u7387\u3002\u76f8\u5bf9\u5730\uff0c\u300c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u300d\u53ef\u4ee5\u4f53\u73b0\u7b97\u6cd5\u5728\u968f\u673a\u8f93\u5165\u6570\u636e\u4e0b\u7684\u8fd0\u884c\u6548\u7387\uff0c\u7528 \\(\\Theta\\) \u8bb0\u53f7\uff08Theta Notation\uff09\u6765\u8868\u793a\u3002

\u5bf9\u4e8e\u90e8\u5206\u7b97\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u5730\u63a8\u7b97\u51fa\u968f\u673a\u6570\u636e\u5206\u5e03\u4e0b\u7684\u5e73\u5747\u60c5\u51b5\u3002\u6bd4\u5982\u4e0a\u8ff0\u793a\u4f8b\uff0c\u7531\u4e8e\u8f93\u5165\u6570\u7ec4\u662f\u88ab\u6253\u4e71\u7684\uff0c\u56e0\u6b64\u5143\u7d20 \\(1\\) \u51fa\u73b0\u5728\u4efb\u610f\u7d22\u5f15\u7684\u6982\u7387\u90fd\u662f\u76f8\u7b49\u7684\uff0c\u90a3\u4e48\u7b97\u6cd5\u7684\u5e73\u5747\u5faa\u73af\u6b21\u6570\u5219\u662f\u6570\u7ec4\u957f\u5ea6\u7684\u4e00\u534a \\(\\frac{n}{2}\\) \uff0c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(\\Theta(\\frac{n}{2}) = \\Theta(n)\\) \u3002

\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5c24\u5176\u662f\u8f83\u4e3a\u590d\u6742\u7684\u7b97\u6cd5\uff0c\u8ba1\u7b97\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u6bd4\u8f83\u56f0\u96be\uff0c\u56e0\u4e3a\u5f88\u96be\u7b80\u4fbf\u5730\u5206\u6790\u51fa\u5728\u6570\u636e\u5206\u5e03\u4e0b\u7684\u6574\u4f53\u6570\u5b66\u671f\u671b\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u4f5c\u4e3a\u7b97\u6cd5\u6548\u7387\u7684\u8bc4\u5224\u6807\u51c6\u3002

\u4e3a\u4ec0\u4e48\u5f88\u5c11\u770b\u5230 \\(\\Theta\\) \u7b26\u53f7\uff1f

\u5b9e\u9645\u4e2d\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u300c\u5927 \\(O\\) \u7b26\u53f7\u300d\u6765\u8868\u793a\u300c\u5e73\u5747\u590d\u6742\u5ea6\u300d\uff0c\u8fd9\u6837\u4e25\u683c\u610f\u4e49\u4e0a\u6765\u8bf4\u662f\u4e0d\u89c4\u8303\u7684\u3002\u8fd9\u53ef\u80fd\u662f\u56e0\u4e3a \\(O\\) \u7b26\u53f7\u5b9e\u5728\u662f\u592a\u6717\u6717\u4e0a\u53e3\u4e86\u3002\u5982\u679c\u5728\u672c\u4e66\u548c\u5176\u4ed6\u8d44\u6599\u4e2d\u770b\u5230\u7c7b\u4f3c \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \u7684\u8868\u8ff0\uff0c\u8bf7\u4f60\u76f4\u63a5\u7406\u89e3\u4e3a \\(\\Theta(n)\\) \u5373\u53ef\u3002

"},{"location":"chapter_data_structure/classification_of_data_structure/","title":"3.2. \u00a0 \u6570\u636e\u7ed3\u6784\u5206\u7c7b","text":"

\u6570\u636e\u7ed3\u6784\u4e3b\u8981\u53ef\u6839\u636e\u300c\u903b\u8f91\u7ed3\u6784\u300d\u548c\u300c\u7269\u7406\u7ed3\u6784\u300d\u4e24\u79cd\u89d2\u5ea6\u8fdb\u884c\u5206\u7c7b\u3002

"},{"location":"chapter_data_structure/classification_of_data_structure/#321","title":"3.2.1. \u00a0 \u903b\u8f91\u7ed3\u6784\uff1a\u7ebf\u6027\u4e0e\u975e\u7ebf\u6027","text":"

\u300c\u903b\u8f91\u7ed3\u6784\u300d\u53cd\u6620\u4e86\u6570\u636e\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u3002\u6570\u7ec4\u548c\u94fe\u8868\u7684\u6570\u636e\u6309\u7167\u987a\u5e8f\u4f9d\u6b21\u6392\u5217\uff0c\u53cd\u6620\u4e86\u6570\u636e\u95f4\u7684\u7ebf\u6027\u5173\u7cfb\uff1b\u6811\u4ece\u9876\u81f3\u5e95\u6309\u5c42\u7ea7\u6392\u5217\uff0c\u53cd\u6620\u4e86\u7956\u5148\u4e0e\u540e\u4ee3\u4e4b\u95f4\u7684\u6d3e\u751f\u5173\u7cfb\uff1b\u56fe\u7531\u7ed3\u70b9\u548c\u8fb9\u7ec4\u6210\uff0c\u53cd\u6620\u4e86\u590d\u6742\u7f51\u7edc\u5173\u7cfb\u3002

\u6211\u4eec\u4e00\u822c\u5c06\u903b\u8f91\u7ed3\u6784\u5206\u4e3a\u300c\u7ebf\u6027\u300d\u548c\u300c\u975e\u7ebf\u6027\u300d\u4e24\u79cd\u3002\u201c\u7ebf\u6027\u201d\u8fd9\u4e2a\u6982\u5ff5\u5f88\u76f4\u89c2\uff0c\u5373\u8868\u660e\u6570\u636e\u5728\u903b\u8f91\u5173\u7cfb\u4e0a\u662f\u6392\u6210\u4e00\u6761\u7ebf\u7684\uff1b\u800c\u5982\u679c\u6570\u636e\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\u662f\u975e\u7ebf\u6027\u7684\uff08\u4f8b\u5982\u662f\u7f51\u72b6\u6216\u6811\u72b6\u7684\uff09\uff0c\u90a3\u4e48\u5c31\u662f\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002

  • \u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff1a\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\uff1b
  • \u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff1a\u6811\u3001\u56fe\u3001\u5806\u3001\u54c8\u5e0c\u8868\uff1b

Fig. \u7ebf\u6027\u4e0e\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784

"},{"location":"chapter_data_structure/classification_of_data_structure/#322","title":"3.2.2. \u00a0 \u7269\u7406\u7ed3\u6784\uff1a\u8fde\u7eed\u4e0e\u79bb\u6563","text":"

Note

\u82e5\u611f\u5230\u9605\u8bfb\u56f0\u96be\uff0c\u5efa\u8bae\u5148\u770b\u5b8c\u4e0b\u4e2a\u7ae0\u8282\u300c\u6570\u7ec4\u4e0e\u94fe\u8868\u300d\uff0c\u518d\u56de\u8fc7\u5934\u6765\u7406\u89e3\u7269\u7406\u7ed3\u6784\u7684\u542b\u4e49\u3002

\u300c\u7269\u7406\u7ed3\u6784\u300d\u53cd\u6620\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u65b9\u5f0f\u3002\u4ece\u672c\u8d28\u4e0a\u770b\uff0c\u5206\u522b\u662f \u6570\u7ec4\u7684\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8 \u548c \u94fe\u8868\u7684\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\u3002\u7269\u7406\u7ed3\u6784\u4ece\u5e95\u5c42\u4e0a\u51b3\u5b9a\u4e86\u6570\u636e\u7684\u8bbf\u95ee\u3001\u66f4\u65b0\u3001\u589e\u5220\u7b49\u64cd\u4f5c\u65b9\u6cd5\uff0c\u5728\u65f6\u95f4\u6548\u7387\u548c\u7a7a\u95f4\u6548\u7387\u65b9\u9762\u5448\u73b0\u51fa\u6b64\u6d88\u5f7c\u957f\u7684\u7279\u6027\u3002

Fig. \u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\u4e0e\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8

\u6240\u6709\u6570\u636e\u7ed3\u6784\u90fd\u662f\u57fa\u4e8e\u6570\u7ec4\u3001\u6216\u94fe\u8868\u3001\u6216\u4e24\u8005\u7ec4\u5408\u5b9e\u73b0\u7684\u3002\u4f8b\u5982\u6808\u548c\u961f\u5217\uff0c\u65e2\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u5b9e\u73b0\u3001\u4e5f\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u5b9e\u73b0\uff0c\u800c\u4f8b\u5982\u54c8\u5e0c\u8868\uff0c\u5176\u5b9e\u73b0\u540c\u65f6\u5305\u542b\u4e86\u6570\u7ec4\u548c\u94fe\u8868\u3002

  • \u57fa\u4e8e\u6570\u7ec4\u53ef\u5b9e\u73b0\uff1a\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u3001\u77e9\u9635\u3001\u5f20\u91cf\uff08\u7ef4\u5ea6 \\(\\geq 3\\) \u7684\u6570\u7ec4\uff09\u7b49\uff1b
  • \u57fa\u4e8e\u94fe\u8868\u53ef\u5b9e\u73b0\uff1a\u6808\u3001\u961f\u5217\u3001\u54c8\u5e0c\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u7b49\uff1b

\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u4e5f\u88ab\u79f0\u4e3a\u300c\u9759\u6001\u6570\u636e\u7ed3\u6784\u300d\uff0c\u8fd9\u610f\u5473\u7740\u8be5\u6570\u636e\u7ed3\u6784\u5728\u5728\u88ab\u521d\u59cb\u5316\u540e\uff0c\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u76f8\u53cd\u5730\uff0c\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u88ab\u79f0\u4e3a\u300c\u52a8\u6001\u6570\u636e\u7ed3\u6784\u300d\uff0c\u8be5\u6570\u636e\u7ed3\u6784\u5728\u88ab\u521d\u59cb\u5316\u540e\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5728\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u4fee\u6539\u5176\u957f\u5ea6\u3002

Tip

\u6570\u7ec4\u4e0e\u94fe\u8868\u662f\u5176\u4ed6\u6240\u6709\u6570\u636e\u7ed3\u6784\u7684\u201c\u5e95\u5c42\u79ef\u6728\u201d\uff0c\u5efa\u8bae\u8bfb\u8005\u4e00\u5b9a\u8981\u591a\u82b1\u4e9b\u65f6\u95f4\u4e86\u89e3\u3002

"},{"location":"chapter_data_structure/data_and_memory/","title":"3.1. \u00a0 \u6570\u636e\u4e0e\u5185\u5b58","text":""},{"location":"chapter_data_structure/data_and_memory/#311","title":"3.1.1. \u00a0 \u57fa\u672c\u6570\u636e\u7c7b\u578b","text":"

\u8c08\u5230\u8ba1\u7b97\u673a\u4e2d\u7684\u6570\u636e\uff0c\u6211\u4eec\u80fd\u591f\u60f3\u5230\u6587\u672c\u3001\u56fe\u7247\u3001\u89c6\u9891\u3001\u8bed\u97f3\u30013D \u6a21\u578b\u7b49\u7b49\uff0c\u8fd9\u4e9b\u6570\u636e\u867d\u7136\u7ec4\u7ec7\u5f62\u5f0f\u4e0d\u540c\uff0c\u4f46\u90fd\u662f\u7531\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u6784\u6210\u7684\u3002

\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u662f CPU \u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u8fd0\u7b97\u7684\u7c7b\u578b\uff0c\u5728\u7b97\u6cd5\u4e2d\u76f4\u63a5\u88ab\u4f7f\u7528\u3002

  • \u300c\u6574\u6570\u300d\u6839\u636e\u4e0d\u540c\u7684\u957f\u5ea6\u5206\u4e3a byte, short, int, long \uff0c\u6839\u636e\u7b97\u6cd5\u9700\u6c42\u9009\u7528\uff0c\u5373\u5728\u6ee1\u8db3\u53d6\u503c\u8303\u56f4\u7684\u60c5\u51b5\u4e0b\u5c3d\u91cf\u51cf\u5c0f\u5185\u5b58\u7a7a\u95f4\u5360\u7528\uff1b
  • \u300c\u6d6e\u70b9\u6570\u300d\u4ee3\u8868\u5c0f\u6570\uff0c\u6839\u636e\u957f\u5ea6\u5206\u4e3a float, double \uff0c\u540c\u6837\u6839\u636e\u7b97\u6cd5\u7684\u5b9e\u9645\u9700\u6c42\u9009\u7528\uff1b
  • \u300c\u5b57\u7b26\u300d\u5728\u8ba1\u7b97\u673a\u4e2d\u662f\u4ee5\u5b57\u7b26\u96c6\u7684\u5f62\u5f0f\u4fdd\u5b58\u7684\uff0cchar \u7684\u503c\u5b9e\u9645\u4e0a\u662f\u6570\u5b57\uff0c\u4ee3\u8868\u5b57\u7b26\u96c6\u4e2d\u7684\u7f16\u53f7\uff0c\u8ba1\u7b97\u673a\u901a\u8fc7\u5b57\u7b26\u96c6\u67e5\u8868\u6765\u5b8c\u6210\u7f16\u53f7\u5230\u5b57\u7b26\u7684\u8f6c\u6362\u3002\u5360\u7528\u7a7a\u95f4\u901a\u5e38\u4e3a 2 bytes \u6216 1 byte \uff1b
  • \u300c\u5e03\u5c14\u300d\u4ee3\u8868\u903b\u8f91\u4e2d\u7684\u201c\u662f\u201d\u4e0e\u201c\u5426\u201d\uff0c\u5176\u5360\u7528\u7a7a\u95f4\u9700\u6839\u636e\u7f16\u7a0b\u8bed\u8a00\u786e\u5b9a\uff0c\u901a\u5e38\u4e3a 1 byte \u6216 1 bit \uff1b
\u7c7b\u522b \u7b26\u53f7 \u5360\u7528\u7a7a\u95f4 \u53d6\u503c\u8303\u56f4 \u9ed8\u8ba4\u503c \u6574\u6570 byte 1 byte \\(-2^7\\) ~ \\(2^7 - 1\\) ( \\(-128\\) ~ \\(127\\) ) \\(0\\) short 2 bytes \\(-2^{15}\\) ~ \\(2^{15} - 1\\) \\(0\\) int 4 bytes \\(-2^{31}\\) ~ \\(2^{31} - 1\\) \\(0\\) long 8 bytes \\(-2^{63}\\) ~ \\(2^{63} - 1\\) \\(0\\) \u6d6e\u70b9\u6570 float 4 bytes \\(-3.4 \\times 10^{38}\\) ~ \\(3.4 \\times 10^{38}\\) \\(0.0\\) f double 8 bytes \\(-1.7 \\times 10^{308}\\) ~ \\(1.7 \\times 10^{308}\\) \\(0.0\\) \u5b57\u7b26 char 2 bytes / 1 byte \\(0\\) ~ \\(2^{16} - 1\\) \\(0\\) \u5e03\u5c14 bool 1 byte / 1 bit \\(\\text{true}\\) \u6216 \\(\\text{false}\\) \\(\\text{false}\\)

Tip

\u4ee5\u4e0a\u8868\u683c\u4e2d\uff0c\u52a0\u7c97\u9879\u5728\u300c\u7b97\u6cd5\u9898\u300d\u4e2d\u6700\u4e3a\u5e38\u7528\u3002\u6b64\u8868\u683c\u65e0\u9700\u786c\u80cc\uff0c\u5927\u81f4\u7406\u89e3\u5373\u53ef\uff0c\u9700\u8981\u65f6\u53ef\u4ee5\u901a\u8fc7\u67e5\u8868\u6765\u56de\u5fc6\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_1","title":"\u6574\u6570\u8868\u793a\u65b9\u5f0f","text":"

\u6574\u6570\u7684\u53d6\u503c\u8303\u56f4\u53d6\u51b3\u4e8e\u53d8\u91cf\u4f7f\u7528\u7684\u5185\u5b58\u957f\u5ea6\uff0c\u5373\u5b57\u8282\uff08\u6216\u6bd4\u7279\uff09\u6570\u3002\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c 1 \u5b57\u8282 (byte) = 8 \u6bd4\u7279 (bit) \uff0c 1 \u6bd4\u7279\u5373 1 \u4e2a\u4e8c\u8fdb\u5236\u4f4d\u3002\u4ee5 int \u7c7b\u578b\u4e3a\u4f8b\uff1a

  1. \u6574\u6570\u7c7b\u578b int \u5360\u7528 4 bytes = 32 bits \uff0c\u56e0\u6b64\u53ef\u4ee5\u8868\u793a \\(2^{32}\\) \u4e2a\u4e0d\u540c\u7684\u6570\u5b57\uff1b
  2. \u5c06\u6700\u9ad8\u4f4d\u770b\u4f5c\u7b26\u53f7\u4f4d\uff0c\\(0\\) \u4ee3\u8868\u6b63\u6570\uff0c\\(1\\) \u4ee3\u8868\u8d1f\u6570\uff0c\u4ece\u800c\u53ef\u4ee5\u8868\u793a \\(2^{31}\\) \u4e2a\u6b63\u6570\u548c \\(2^{31}\\) \u4e2a\u8d1f\u6570\uff1b
  3. \u5f53\u6240\u6709 bits \u4e3a 0 \u65f6\u4ee3\u8868\u6570\u5b57 \\(0\\) \uff0c\u4ece\u96f6\u5f00\u59cb\u589e\u5927\uff0c\u53ef\u5f97\u6700\u5927\u6b63\u6570\u4e3a \\(2^{31} - 1\\) \uff1b
  4. \u5269\u4f59 \\(2^{31}\\) \u4e2a\u6570\u5b57\u5168\u90e8\u7528\u6765\u8868\u793a\u8d1f\u6570\uff0c\u56e0\u6b64\u6700\u5c0f\u8d1f\u6570\u4e3a \\(-2^{31}\\) \uff1b\u5177\u4f53\u7ec6\u8282\u6d89\u53ca\u5230\u5230\u201c\u6e90\u7801\u3001\u53cd\u7801\u3001\u8865\u7801\u201d\u77e5\u8bc6\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u67e5\u9605\u5b66\u4e60\uff1b

\u5176\u5b83\u6574\u6570\u7c7b\u578b byte, short, long \u53d6\u503c\u8303\u56f4\u7684\u8ba1\u7b97\u65b9\u6cd5\u4e0e int \u7c7b\u4f3c\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_2","title":"\u6d6e\u70b9\u6570\u8868\u793a\u65b9\u5f0f *","text":"

Note

\u5728\u672c\u4e66\u4e2d\uff0c\u6807\u9898\u540e\u7684 * \u7b26\u53f7\u4ee3\u8868\u9009\u8bfb\u7ae0\u8282\uff0c\u5982\u679c\u4f60\u89c9\u5f97\u7406\u89e3\u56f0\u96be\uff0c\u5efa\u8bae\u5148\u8df3\u8fc7\uff0c\u7b49\u5b66\u5b8c\u5fc5\u8bfb\u7ae0\u8282\u540e\u7eed\u518d\u5355\u72ec\u653b\u514b\u3002

\u7ec6\u5fc3\u7684\u4f60\u53ef\u80fd\u4f1a\u7591\u60d1\uff1a int \u548c float \u957f\u5ea6\u76f8\u540c\uff0c\u90fd\u662f 4 bytes \uff0c\u4f46\u4e3a\u4ec0\u4e48 float \u7684\u53d6\u503c\u8303\u56f4\u8fdc\u5927\u4e8e int \uff1f\u6309\u8bf4 float \u9700\u8981\u8868\u793a\u5c0f\u6570\uff0c\u53d6\u503c\u8303\u56f4\u5e94\u8be5\u53d8\u5c0f\u624d\u5bf9\u3002

\u5176\u5b9e\uff0c\u8fd9\u662f\u56e0\u4e3a\u6d6e\u70b9\u6570 float \u91c7\u7528\u4e86\u4e0d\u540c\u7684\u8868\u793a\u65b9\u5f0f\u3002IEEE 754 \u6807\u51c6\u89c4\u5b9a\uff0c32-bit \u957f\u5ea6\u7684 float \u7531\u4ee5\u4e0b\u90e8\u5206\u6784\u6210\uff1a

  • \u7b26\u53f7\u4f4d \\(\\mathrm{S}\\) \uff1a\u5360 1 bit \uff1b
  • \u6307\u6570\u4f4d \\(\\mathrm{E}\\) \uff1a\u5360 8 bits \uff1b
  • \u5206\u6570\u4f4d \\(\\mathrm{N}\\) \uff1a\u5360 24 bits \uff0c\u5176\u4e2d 23 \u4f4d\u663e\u5f0f\u5b58\u50a8\uff1b

\u8bbe 32-bit \u4e8c\u8fdb\u5236\u6570\u7684\u7b2c \\(i\\) \u4f4d\u4e3a \\(b_i\\) \uff0c\u5219 float \u503c\u7684\u8ba1\u7b97\u65b9\u6cd5\u5b9a\u4e49\u4e3a

\\[ \\text { val } = (-1)^{b_{31}} \\times 2^{\\left(b_{30} b_{29} \\ldots b_{23}\\right)_2-127} \\times\\left(1 . b_{22} b_{21} \\ldots b_0\\right)_2 \\]

\u8f6c\u5316\u5230\u5341\u8fdb\u5236\u4e0b\u7684\u8ba1\u7b97\u516c\u5f0f\u4e3a

\\[ \\text { val }=(-1)^{\\mathrm{S}} \\times 2^{\\mathrm{E} -127} \\times (1 + \\mathrm{N}) \\]

\u5176\u4e2d\u5404\u9879\u7684\u53d6\u503c\u8303\u56f4\u4e3a

\\[ \\begin{aligned} \\mathrm{S} \\in & \\{ 0, 1\\} , \\quad \\mathrm{E} \\in \\{ 1, 2, \\dots, 254 \\} \\newline (1 + \\mathrm{N}) = & (1 + \\sum_{i=1}^{23} b_{23-i} 2^{-i}) \\subset [1, 2 - 2^{-23}] \\end{aligned} \\]

Fig. IEEE 754 \u6807\u51c6\u4e0b\u7684 float \u8868\u793a\u65b9\u5f0f

\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\\(\\mathrm{S} = 0\\) \uff0c \\(\\mathrm{E} = 124\\) \uff0c\\(\\mathrm{N} = 2^{-2} + 2^{-3} = 0.375\\) \uff0c\u6613\u5f97

\\[ \\text { val } = (-1)^0 \\times 2^{124 - 127} \\times (1 + 0.375) = 0.171875 \\]

\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u56de\u7b54\u5f00\u59cb\u7684\u95ee\u9898\uff1afloat \u7684\u8868\u793a\u65b9\u5f0f\u5305\u542b\u6307\u6570\u4f4d\uff0c\u5bfc\u81f4\u5176\u53d6\u503c\u8303\u56f4\u8fdc\u5927\u4e8e int \u3002\u6839\u636e\u4ee5\u4e0a\u8ba1\u7b97\uff0c float \u53ef\u8868\u793a\u7684\u6700\u5927\u6b63\u6570\u4e3a \\(2^{254 - 127} \\times (2 - 2^{-23}) \\approx 3.4 \\times 10^{38}\\) \uff0c\u5207\u6362\u7b26\u53f7\u4f4d\u4fbf\u53ef\u5f97\u5230\u6700\u5c0f\u8d1f\u6570\u3002

\u6d6e\u70b9\u6570 float \u867d\u7136\u62d3\u5c55\u4e86\u53d6\u503c\u8303\u56f4\uff0c\u4f46\u526f\u4f5c\u7528\u662f\u727a\u7272\u4e86\u7cbe\u5ea6\u3002\u6574\u6570\u7c7b\u578b int \u5c06\u5168\u90e8 32 \u4f4d\u7528\u4e8e\u8868\u793a\u6570\u5b57\uff0c\u6570\u5b57\u662f\u5747\u5300\u5206\u5e03\u7684\uff1b\u800c\u7531\u4e8e\u6307\u6570\u4f4d\u7684\u5b58\u5728\uff0c\u6d6e\u70b9\u6570 float \u7684\u6570\u503c\u8d8a\u5927\uff0c\u76f8\u90bb\u4e24\u4e2a\u6570\u5b57\u4e4b\u95f4\u7684\u5dee\u503c\u5c31\u4f1a\u8d8b\u5411\u8d8a\u5927\u3002

\u8fdb\u4e00\u6b65\u5730\uff0c\u6307\u6570\u4f4d \\(E = 0\\) \u548c \\(E = 255\\) \u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u7528\u4e8e\u8868\u793a\u96f6\u3001\u65e0\u7a77\u5927\u3001\\(\\mathrm{NaN}\\) \u7b49\u3002

\u6307\u6570\u4f4d E \u5206\u6570\u4f4d \\(\\mathrm{N} = 0\\) \u5206\u6570\u4f4d \\(\\mathrm{N} \\ne 0\\) \u8ba1\u7b97\u516c\u5f0f \\(0\\) \\(\\pm 0\\) \u6b21\u6b63\u89c4\u6570 \\((-1)^{\\mathrm{S}} \\times 2^{-126} \\times (0.\\mathrm{N})\\) \\(1, 2, \\dots, 254\\) \u6b63\u89c4\u6570 \u6b63\u89c4\u6570 \\((-1)^{\\mathrm{S}} \\times 2^{(\\mathrm{E} -127)} \\times (1.\\mathrm{N})\\) \\(255\\) \\(\\pm \\infty\\) \\(\\mathrm{NaN}\\)

\u7279\u522b\u5730\uff0c\u6b21\u6b63\u89c4\u6570\u663e\u8457\u63d0\u5347\u4e86\u5c0f\u6570\u7cbe\u5ea6\uff1a

  • \u6700\u5c0f\u6b63\u6b63\u89c4\u6570\u4e3a \\(2^{-126} \\approx 1.18 \\times 10^{-38}\\) \uff1b
  • \u6700\u5c0f\u6b63\u6b21\u6b63\u89c4\u6570\u4e3a \\(2^{-126} \\times 2^{-23} \\approx 1.4 \\times 10^{-45}\\) \uff1b

\u53cc\u7cbe\u5ea6 double \u4e5f\u91c7\u7528\u7c7b\u4f3c float \u7684\u8868\u793a\u65b9\u6cd5\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_data_structure/data_and_memory/#_3","title":"\u57fa\u672c\u6570\u636e\u7c7b\u578b\u4e0e\u6570\u636e\u7ed3\u6784\u7684\u5173\u7cfb","text":"

\u6211\u4eec\u77e5\u9053\uff0c\u6570\u636e\u7ed3\u6784\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\uff0c\u5b83\u7684\u4e3b\u8bed\u662f\u201c\u7ed3\u6784\u201d\uff0c\u800c\u4e0d\u662f\u201c\u6570\u636e\u201d\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u8868\u793a\u201c\u4e00\u6392\u6570\u5b57\u201d\uff0c\u81ea\u7136\u60f3\u5230\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u6570\u636e\u7ed3\u6784\u3002\u6570\u7ec4\u7684\u5b58\u50a8\u65b9\u5f0f\u53ef\u4ee5\u8868\u793a\u6570\u5b57\u7684\u76f8\u90bb\u5173\u7cfb\u3001\u987a\u5e8f\u5173\u7cfb\uff0c\u4f46\u81f3\u4e8e\u5176\u4e2d\u5b58\u50a8\u7684\u662f\u6574\u6570 int \uff0c\u8fd8\u662f\u5c0f\u6570 float \uff0c\u6216\u662f\u5b57\u7b26 char \uff0c\u5219\u4e0e\u6240\u8c13\u7684\u6570\u636e\u7684\u7ed3\u6784\u65e0\u5173\u4e86\u3002

\u6362\u8a00\u4e4b\uff0c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u63d0\u4f9b\u4e86\u6570\u636e\u7684\u201c\u5185\u5bb9\u7c7b\u578b\u201d\uff0c\u800c\u6570\u636e\u7ed3\u6784\u63d0\u4f9b\u6570\u636e\u7684\u201c\u7ec4\u7ec7\u65b9\u5f0f\u201d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint[] numbers = new int[5];\nfloat[] decimals = new float[5];\nchar[] characters = new char[5];\nboolean[] booleans = new boolean[5];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint numbers[5];\nfloat decimals[5];\nchar characters[5];\nbool booleans[5];\n
\"\"\" Python \u7684 list \u53ef\u4ee5\u81ea\u7531\u5b58\u50a8\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5bf9\u8c61 \"\"\"\nlist = [0, 0.0, 'a', False]\n
// \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d\nvar numbers = [5]int{}\nvar decimals = [5]float64{}\nvar characters = [5]byte{}\nvar booleans = [5]bool{}\n
/* JavaScript \u7684\u6570\u7ec4\u53ef\u4ee5\u81ea\u7531\u5b58\u50a8\u5404\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5bf9\u8c61 */\nconst array = [0, 0.0, 'a', false];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nconst numbers: number[] = [];\nconst characters: string[] = [];\nconst booleans: boolean[] = [];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint numbers[10];\nfloat decimals[10];\nchar characters[10];\nbool booleans[10];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nint[] numbers = new int[5];\nfloat[] decimals = new float[5];\nchar[] characters = new char[5];\nbool[] booleans = new bool[5];\n
/* \u4f7f\u7528\u591a\u79cd\u300c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u300d\u6765\u521d\u59cb\u5316\u300c\u6570\u7ec4\u300d */\nlet numbers = Array(repeating: Int(), count: 5)\nlet decimals = Array(repeating: Double(), count: 5)\nlet characters = Array(repeating: Character(\"a\"), count: 5)\nlet booleans = Array(repeating: Bool(), count: 5)\n
\n
"},{"location":"chapter_data_structure/data_and_memory/#312","title":"3.1.2. \u00a0 \u8ba1\u7b97\u673a\u5185\u5b58","text":"

\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c\u5185\u5b58\u548c\u786c\u76d8\u662f\u4e24\u79cd\u4e3b\u8981\u7684\u5b58\u50a8\u786c\u4ef6\u8bbe\u5907\u3002\u300c\u786c\u76d8\u300d\u4e3b\u8981\u7528\u4e8e\u957f\u671f\u5b58\u50a8\u6570\u636e\uff0c\u5bb9\u91cf\u8f83\u5927\uff08\u901a\u5e38\u53ef\u8fbe\u5230 TB \u7ea7\u522b\uff09\u3001\u901f\u5ea6\u8f83\u6162\u3002\u300c\u5185\u5b58\u300d\u7528\u4e8e\u8fd0\u884c\u7a0b\u5e8f\u65f6\u6682\u5b58\u6570\u636e\uff0c\u901f\u5ea6\u8f83\u5feb\uff0c\u4f46\u5bb9\u91cf\u8f83\u5c0f\uff08\u901a\u5e38\u4e3a GB \u7ea7\u522b\uff09\u3002

\u7b97\u6cd5\u8fd0\u884c\u4e2d\uff0c\u76f8\u5173\u6570\u636e\u90fd\u88ab\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\u3002\u4e0b\u56fe\u5c55\u793a\u4e86\u4e00\u4e2a\u8ba1\u7b97\u673a\u5185\u5b58\u6761\uff0c\u5176\u4e2d\u6bcf\u4e2a\u9ed1\u8272\u65b9\u5757\u90fd\u5305\u542b\u4e00\u5757\u5185\u5b58\u7a7a\u95f4\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u5185\u5b58\u60f3\u8c61\u6210\u4e00\u4e2a\u5de8\u5927\u7684 Excel \u8868\u683c\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5355\u5143\u683c\u90fd\u53ef\u4ee5\u5b58\u50a8 1 byte \u7684\u6570\u636e\uff0c\u5728\u7b97\u6cd5\u8fd0\u884c\u65f6\uff0c\u6240\u6709\u6570\u636e\u90fd\u88ab\u5b58\u50a8\u5728\u8fd9\u4e9b\u5355\u5143\u683c\u4e2d\u3002

\u7cfb\u7edf\u901a\u8fc7\u300c\u5185\u5b58\u5730\u5740 Memory Location\u300d\u6765\u8bbf\u95ee\u76ee\u6807\u5185\u5b58\u4f4d\u7f6e\u7684\u6570\u636e\u3002\u8ba1\u7b97\u673a\u6839\u636e\u7279\u5b9a\u89c4\u5219\u7ed9\u8868\u683c\u4e2d\u6bcf\u4e2a\u5355\u5143\u683c\u7f16\u53f7\uff0c\u4fdd\u8bc1\u6bcf\u5757\u5185\u5b58\u7a7a\u95f4\u90fd\u6709\u72ec\u7acb\u7684\u5185\u5b58\u5730\u5740\u3002\u81ea\u6b64\uff0c\u7a0b\u5e8f\u4fbf\u901a\u8fc7\u8fd9\u4e9b\u5730\u5740\uff0c\u8bbf\u95ee\u5185\u5b58\u4e2d\u7684\u6570\u636e\u3002

Fig. \u5185\u5b58\u6761\u3001\u5185\u5b58\u7a7a\u95f4\u3001\u5185\u5b58\u5730\u5740

\u5185\u5b58\u8d44\u6e90\u662f\u8bbe\u8ba1\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u91cd\u8981\u8003\u8651\u56e0\u7d20\u3002\u5185\u5b58\u662f\u6240\u6709\u7a0b\u5e8f\u7684\u516c\u5171\u8d44\u6e90\uff0c\u5f53\u5185\u5b58\u88ab\u67d0\u7a0b\u5e8f\u5360\u7528\u65f6\uff0c\u4e0d\u80fd\u88ab\u5176\u5b83\u7a0b\u5e8f\u540c\u65f6\u4f7f\u7528\u3002\u6211\u4eec\u9700\u8981\u6839\u636e\u5269\u4f59\u5185\u5b58\u8d44\u6e90\u7684\u60c5\u51b5\u6765\u8bbe\u8ba1\u7b97\u6cd5\u3002\u4f8b\u5982\uff0c\u82e5\u5269\u4f59\u5185\u5b58\u7a7a\u95f4\u6709\u9650\uff0c\u5219\u8981\u6c42\u7b97\u6cd5\u5360\u7528\u7684\u5cf0\u503c\u5185\u5b58\u4e0d\u80fd\u8d85\u8fc7\u7cfb\u7edf\u5269\u4f59\u5185\u5b58\uff1b\u82e5\u8fd0\u884c\u7684\u7a0b\u5e8f\u5f88\u591a\u3001\u7f3a\u5c11\u5927\u5757\u8fde\u7eed\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u5219\u8981\u6c42\u9009\u53d6\u7684\u6570\u636e\u7ed3\u6784\u5fc5\u987b\u80fd\u591f\u5b58\u50a8\u5728\u79bb\u6563\u7684\u5185\u5b58\u7a7a\u95f4\u5185\u3002

"},{"location":"chapter_data_structure/summary/","title":"3.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u6574\u6570 byte, short, int, long \u3001\u6d6e\u70b9\u6570 float, double \u3001\u5b57\u7b26 char \u3001\u5e03\u5c14 boolean \u662f\u8ba1\u7b97\u673a\u4e2d\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u5360\u7528\u7a7a\u95f4\u7684\u5927\u5c0f\u51b3\u5b9a\u4e86\u5b83\u4eec\u7684\u53d6\u503c\u8303\u56f4\u3002
  • \u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u6570\u636e\u5b58\u50a8\u5728\u8ba1\u7b97\u673a\u7684\u5185\u5b58\u4e2d\u3002\u5185\u5b58\u4e2d\u6bcf\u5757\u7a7a\u95f4\u90fd\u6709\u72ec\u7acb\u7684\u5185\u5b58\u5730\u5740\uff0c\u7a0b\u5e8f\u662f\u901a\u8fc7\u5185\u5b58\u5730\u5740\u6765\u8bbf\u95ee\u6570\u636e\u7684\u3002
  • \u6570\u636e\u7ed3\u6784\u4e3b\u8981\u53ef\u4ee5\u4ece\u903b\u8f91\u7ed3\u6784\u548c\u7269\u7406\u7ed3\u6784\u4e24\u4e2a\u89d2\u5ea6\u8fdb\u884c\u5206\u7c7b\u3002\u903b\u8f91\u7ed3\u6784\u53cd\u6620\u4e86\u6570\u636e\u4e2d\u5143\u7d20\u4e4b\u95f4\u7684\u903b\u8f91\u5173\u7cfb\uff0c\u7269\u7406\u7ed3\u6784\u53cd\u6620\u4e86\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u5f62\u5f0f\u3002
  • \u5e38\u89c1\u7684\u903b\u8f91\u7ed3\u6784\u6709\u7ebf\u6027\u3001\u6811\u72b6\u3001\u7f51\u72b6\u7b49\u3002\u6211\u4eec\u4e00\u822c\u6839\u636e\u903b\u8f91\u7ed3\u6784\u5c06\u6570\u636e\u7ed3\u6784\u5206\u4e3a\u7ebf\u6027\uff08\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\uff09\u548c\u975e\u7ebf\u6027\uff08\u6811\u3001\u56fe\u3001\u5806\uff09\u4e24\u79cd\u3002\u6839\u636e\u5b9e\u73b0\u65b9\u5f0f\u7684\u4e0d\u540c\uff0c\u54c8\u5e0c\u8868\u53ef\u80fd\u662f\u7ebf\u6027\u6216\u975e\u7ebf\u6027\u3002
  • \u7269\u7406\u7ed3\u6784\u4e3b\u8981\u6709\u4e24\u79cd\uff0c\u5206\u522b\u662f\u8fde\u7eed\u7a7a\u95f4\u5b58\u50a8\uff08\u6570\u7ec4\uff09\u548c\u79bb\u6563\u7a7a\u95f4\u5b58\u50a8\uff08\u94fe\u8868\uff09\uff0c\u6240\u6709\u7684\u6570\u636e\u7ed3\u6784\u90fd\u662f\u7531\u6570\u7ec4\u3001\u6216\u94fe\u8868\u3001\u6216\u4e24\u8005\u7ec4\u5408\u5b9e\u73b0\u7684\u3002
"},{"location":"chapter_graph/graph/","title":"9.1. \u00a0 \u56fe","text":"

\u300c\u56fe Graph\u300d\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u7531\u300c\u9876\u70b9 Vertex\u300d\u548c\u300c\u8fb9 Edge\u300d\u7ec4\u6210\u3002\u6211\u4eec\u53ef\u5c06\u56fe \\(G\\) \u62bd\u8c61\u5730\u8868\u793a\u4e3a\u4e00\u7ec4\u9876\u70b9 \\(V\\) \u548c\u4e00\u7ec4\u8fb9 \\(E\\) \u7684\u96c6\u5408\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u8868\u793a\u4e00\u4e2a\u5305\u542b 5 \u4e2a\u9876\u70b9\u548c 7 \u6761\u8fb9\u7684\u56fe

\\[ \\begin{aligned} V & = \\{ 1, 2, 3, 4, 5 \\} \\newline E & = \\{ (1,2), (1,3), (1,5), (2,3), (2,4), (2,5), (4,5) \\} \\newline G & = \\{ V, E \\} \\newline \\end{aligned} \\]

Fig. \u94fe\u8868\u3001\u6811\u3001\u56fe\u4e4b\u95f4\u7684\u5173\u7cfb

\u90a3\u4e48\uff0c\u56fe\u4e0e\u5176\u4ed6\u6570\u636e\u7ed3\u6784\u7684\u5173\u7cfb\u662f\u4ec0\u4e48\uff1f\u5982\u679c\u6211\u4eec\u628a\u300c\u9876\u70b9\u300d\u770b\u4f5c\u7ed3\u70b9\uff0c\u628a\u300c\u8fb9\u300d\u770b\u4f5c\u8fde\u63a5\u5404\u4e2a\u7ed3\u70b9\u7684\u6307\u9488\uff0c\u5219\u53ef\u5c06\u300c\u56fe\u300d\u770b\u6210\u4e00\u79cd\u4ece\u300c\u94fe\u8868\u300d\u62d3\u5c55\u800c\u6765\u7684\u6570\u636e\u7ed3\u6784\u3002\u76f8\u6bd4\u7ebf\u6027\u5173\u7cfb\uff08\u94fe\u8868\uff09\u548c\u5206\u6cbb\u5173\u7cfb\uff08\u6811\uff09\uff0c\u7f51\u7edc\u5173\u7cfb\uff08\u56fe\uff09\u7684\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u4e5f\u4ece\u800c\u66f4\u4e3a\u590d\u6742\u3002

"},{"location":"chapter_graph/graph/#911","title":"9.1.1. \u00a0 \u56fe\u5e38\u89c1\u7c7b\u578b","text":"

\u6839\u636e\u8fb9\u662f\u5426\u6709\u65b9\u5411\uff0c\u5206\u4e3a\u300c\u65e0\u5411\u56fe Undirected Graph\u300d\u548c\u300c\u6709\u5411\u56fe Directed Graph\u300d\u3002

  • \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u8fb9\u8868\u793a\u4e24\u9876\u70b9\u4e4b\u95f4\u201c\u53cc\u5411\u201d\u7684\u8fde\u63a5\u5173\u7cfb\uff0c\u4f8b\u5982\u5fae\u4fe1\u6216 QQ \u4e2d\u7684\u201c\u597d\u53cb\u5173\u7cfb\u201d\uff1b
  • \u5728\u6709\u5411\u56fe\u4e2d\uff0c\u8fb9\u662f\u6709\u65b9\u5411\u7684\uff0c\u5373 \\(A \\rightarrow B\\) \u548c \\(A \\leftarrow B\\) \u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u662f\u76f8\u4e92\u72ec\u7acb\u7684\uff0c\u4f8b\u5982\u5fae\u535a\u6216\u6296\u97f3\u4e0a\u7684\u201c\u5173\u6ce8\u201d\u4e0e\u201c\u88ab\u5173\u6ce8\u201d\u5173\u7cfb\uff1b

Fig. \u6709\u5411\u56fe\u4e0e\u65e0\u5411\u56fe

\u6839\u636e\u6240\u6709\u9876\u70b9\u662f\u5426\u8fde\u901a\uff0c\u5206\u4e3a\u300c\u8fde\u901a\u56fe Connected Graph\u300d\u548c\u300c\u975e\u8fde\u901a\u56fe Disconnected Graph\u300d\u3002

  • \u5bf9\u4e8e\u8fde\u901a\u56fe\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u53ef\u4ee5\u5230\u8fbe\u5176\u4f59\u4efb\u610f\u9876\u70b9\uff1b
  • \u5bf9\u4e8e\u975e\u8fde\u901a\u56fe\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u81f3\u5c11\u6709\u4e00\u4e2a\u9876\u70b9\u65e0\u6cd5\u5230\u8fbe\uff1b

Fig. \u8fde\u901a\u56fe\u4e0e\u975e\u8fde\u901a\u56fe

\u6211\u4eec\u53ef\u4ee5\u7ed9\u8fb9\u6dfb\u52a0\u201c\u6743\u91cd\u201d\u53d8\u91cf\uff0c\u5f97\u5230\u300c\u6709\u6743\u56fe Weighted Graph\u300d\u3002\u4f8b\u5982\uff0c\u5728\u738b\u8005\u8363\u8000\u7b49\u6e38\u620f\u4e2d\uff0c\u7cfb\u7edf\u4f1a\u6839\u636e\u5171\u540c\u6e38\u620f\u65f6\u95f4\u6765\u8ba1\u7b97\u73a9\u5bb6\u4e4b\u95f4\u7684\u201c\u4eb2\u5bc6\u5ea6\u201d\uff0c\u8fd9\u79cd\u4eb2\u5bc6\u5ea6\u7f51\u7edc\u5c31\u53ef\u4ee5\u4f7f\u7528\u6709\u6743\u56fe\u6765\u8868\u793a\u3002

Fig. \u6709\u6743\u56fe\u4e0e\u65e0\u6743\u56fe

"},{"location":"chapter_graph/graph/#912","title":"9.1.2. \u00a0 \u56fe\u5e38\u7528\u672f\u8bed","text":"
  • \u300c\u90bb\u63a5 Adjacency\u300d\uff1a\u5f53\u4e24\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u76f8\u8fde\u65f6\uff0c\u79f0\u6b64\u4e24\u9876\u70b9\u201c\u90bb\u63a5\u201d\u3002\u4f8b\u5982\uff0c\u4e0a\u56fe\u4e2d\u9876\u70b9 1 \u7684\u90bb\u63a5\u9876\u70b9\u4e3a\u9876\u70b9 2, 3, 5 \u3002
  • \u300c\u8def\u5f84 Path\u300d\uff1a\u4ece\u9876\u70b9 A \u5230\u9876\u70b9 B \u8d70\u8fc7\u7684\u8fb9\u6784\u6210\u7684\u5e8f\u5217\uff0c\u88ab\u79f0\u4e3a\u4ece A \u5230 B \u7684\u201c\u8def\u5f84\u201d\u3002\u4f8b\u5982\uff0c\u4e0a\u56fe\u4e2d 1, 5, 2, 4 \u662f\u9876\u70b9 1 \u5230\u9876\u70b9 4 \u7684\u4e00\u4e2a\u8def\u5f84\u3002
  • \u300c\u5ea6 Degree\u300d\u8868\u793a\u4e00\u4e2a\u9876\u70b9\u5177\u6709\u591a\u5c11\u6761\u8fb9\u3002\u5bf9\u4e8e\u6709\u5411\u56fe\uff0c\u300c\u5165\u5ea6 In-Degree\u300d\u8868\u793a\u6709\u591a\u5c11\u6761\u8fb9\u6307\u5411\u8be5\u9876\u70b9\uff0c\u300c\u51fa\u5ea6 Out-Degree\u300d\u8868\u793a\u6709\u591a\u5c11\u6761\u8fb9\u4ece\u8be5\u9876\u70b9\u6307\u51fa\u3002
"},{"location":"chapter_graph/graph/#913","title":"9.1.3. \u00a0 \u56fe\u7684\u8868\u793a","text":"

\u56fe\u7684\u5e38\u7528\u8868\u793a\u65b9\u6cd5\u6709\u300c\u90bb\u63a5\u77e9\u9635\u300d\u548c\u300c\u90bb\u63a5\u8868\u300d\u3002\u4ee5\u4e0b\u4f7f\u7528\u300c\u65e0\u5411\u56fe\u300d\u6765\u4e3e\u4f8b\u3002

"},{"location":"chapter_graph/graph/#_1","title":"\u90bb\u63a5\u77e9\u9635","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u6570\u91cf\u4e3a \\(n\\) \uff0c\u300c\u90bb\u63a5\u77e9\u9635 Adjacency Matrix\u300d\u4f7f\u7528\u4e00\u4e2a \\(n \\times n\\) \u5927\u5c0f\u7684\u77e9\u9635\u6765\u8868\u793a\u56fe\uff0c\u6bcf\u4e00\u884c\uff08\u5217\uff09\u4ee3\u8868\u4e00\u4e2a\u9876\u70b9\uff0c\u77e9\u9635\u5143\u7d20\u4ee3\u8868\u8fb9\uff0c\u4f7f\u7528 \\(1\\) \u6216 \\(0\\) \u6765\u8868\u793a\u4e24\u4e2a\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u6216\u65e0\u8fb9\u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8bb0\u90bb\u63a5\u77e9\u9635\u4e3a \\(M\\) \u3001\u9876\u70b9\u5217\u8868\u4e3a \\(V\\) \uff0c\u5219\u77e9\u9635\u5143\u7d20 \\(M[i][j] = 1\\) \u4ee3\u8868\u7740\u9876\u70b9 \\(V[i]\\) \u5230\u9876\u70b9 \\(V[j]\\) \u4e4b\u95f4\u6709\u8fb9\uff0c\u76f8\u53cd\u5730 \\(M[i][j] = 0\\) \u4ee3\u8868\u4e24\u9876\u70b9\u4e4b\u95f4\u65e0\u8fb9\u3002

Fig. \u56fe\u7684\u90bb\u63a5\u77e9\u9635\u8868\u793a

\u90bb\u63a5\u77e9\u9635\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a

  • \u9876\u70b9\u4e0d\u80fd\u4e0e\u81ea\u8eab\u76f8\u8fde\uff0c\u56e0\u800c\u90bb\u63a5\u77e9\u9635\u4e3b\u5bf9\u89d2\u7ebf\u5143\u7d20\u6ca1\u6709\u610f\u4e49\u3002
  • \u300c\u65e0\u5411\u56fe\u300d\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u7b49\u4ef7\uff0c\u6b64\u65f6\u90bb\u63a5\u77e9\u9635\u5173\u4e8e\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\u3002
  • \u5c06\u90bb\u63a5\u77e9\u9635\u7684\u5143\u7d20\u4ece \\(1\\) , \\(0\\) \u66ff\u6362\u4e3a\u6743\u91cd\uff0c\u5219\u80fd\u591f\u8868\u793a\u300c\u6709\u6743\u56fe\u300d\u3002

\u4f7f\u7528\u90bb\u63a5\u77e9\u9635\u8868\u793a\u56fe\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u8bbf\u95ee\u77e9\u9635\u5143\u7d20\u6765\u83b7\u53d6\u8fb9\uff0c\u56e0\u6b64\u589e\u5220\u67e5\u64cd\u4f5c\u7684\u6548\u7387\u5f88\u9ad8\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u4e3a \\(O(1)\\) \u3002\u7136\u800c\uff0c\u77e9\u9635\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff0c\u5185\u5b58\u5360\u7528\u8f83\u5927\u3002

"},{"location":"chapter_graph/graph/#_2","title":"\u90bb\u63a5\u8868","text":"

\u300c\u90bb\u63a5\u8868 Adjacency List\u300d\u4f7f\u7528 \\(n\\) \u4e2a\u94fe\u8868\u6765\u8868\u793a\u56fe\uff0c\u94fe\u8868\u7ed3\u70b9\u8868\u793a\u9876\u70b9\u3002\u7b2c \\(i\\) \u6761\u94fe\u8868\u5bf9\u5e94\u9876\u70b9 \\(i\\) \uff0c\u5176\u4e2d\u5b58\u50a8\u4e86\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff08\u5373\u4e0e\u8be5\u9876\u70b9\u76f8\u8fde\u7684\u9876\u70b9\uff09\u3002

Fig. \u56fe\u7684\u90bb\u63a5\u8868\u8868\u793a

\u90bb\u63a5\u8868\u4ec5\u5b58\u50a8\u5b58\u5728\u7684\u8fb9\uff0c\u800c\u8fb9\u7684\u603b\u6570\u5f80\u5f80\u8fdc\u5c0f\u4e8e \\(n^2\\) \uff0c\u56e0\u6b64\u66f4\u52a0\u8282\u7701\u7a7a\u95f4\u3002\u4f46\u662f\uff0c\u56e0\u4e3a\u5728\u90bb\u63a5\u8868\u4e2d\u9700\u8981\u901a\u8fc7\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u8fb9\uff0c\u6240\u4ee5\u5176\u65f6\u95f4\u6548\u7387\u4e0d\u5982\u90bb\u63a5\u77e9\u9635\u3002

\u89c2\u5bdf\u4e0a\u56fe\u53d1\u73b0\uff0c\u90bb\u63a5\u8868\u7ed3\u6784\u4e0e\u54c8\u5e0c\u8868\u300c\u94fe\u5730\u5740\u6cd5\u300d\u975e\u5e38\u76f8\u4f3c\uff0c\u56e0\u6b64\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528\u7c7b\u4f3c\u65b9\u6cd5\u6765\u4f18\u5316\u6548\u7387\u3002\u6bd4\u5982\uff0c\u5f53\u94fe\u8868\u8f83\u957f\u65f6\uff0c\u53ef\u4ee5\u628a\u94fe\u8868\u8f6c\u5316\u4e3a AVL \u6811\u6216\u7ea2\u9ed1\u6811\uff0c\u4ece\u800c\u5c06\u65f6\u95f4\u6548\u7387\u4ece \\(O(n)\\) \u4f18\u5316\u81f3 \\(O(\\log n)\\) \uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e2d\u5e8f\u904d\u5386\u83b7\u53d6\u6709\u5e8f\u5e8f\u5217\uff1b\u8fd8\u53ef\u4ee5\u5c06\u94fe\u8868\u8f6c\u5316\u4e3a\u54c8\u5e0c\u8868\uff0c\u5c06\u65f6\u95f4\u590d\u6742\u5ea6\u964d\u4f4e\u81f3 \\(O(1)\\) \u3002

"},{"location":"chapter_graph/graph/#914","title":"9.1.4. \u00a0 \u56fe\u5e38\u89c1\u5e94\u7528","text":"

\u73b0\u5b9e\u4e2d\u7684\u8bb8\u591a\u7cfb\u7edf\u90fd\u53ef\u4ee5\u4f7f\u7528\u56fe\u6765\u5efa\u6a21\uff0c\u5bf9\u5e94\u7684\u5f85\u6c42\u89e3\u95ee\u9898\u4e5f\u53ef\u4ee5\u88ab\u7ea6\u5316\u4e3a\u56fe\u8ba1\u7b97\u95ee\u9898\u3002

\u9876\u70b9 \u8fb9 \u56fe\u8ba1\u7b97\u95ee\u9898 \u793e\u4ea4\u7f51\u7edc \u7528\u6237 \u597d\u53cb\u5173\u7cfb \u6f5c\u5728\u597d\u53cb\u63a8\u8350 \u5730\u94c1\u7ebf\u8def \u7ad9\u70b9 \u7ad9\u70b9\u95f4\u7684\u8fde\u901a\u6027 \u6700\u77ed\u8def\u7ebf\u63a8\u8350 \u592a\u9633\u7cfb \u661f\u4f53 \u661f\u4f53\u95f4\u7684\u4e07\u6709\u5f15\u529b\u4f5c\u7528 \u884c\u661f\u8f68\u9053\u8ba1\u7b97"},{"location":"chapter_graph/graph_operations/","title":"9.2. \u00a0 \u56fe\u57fa\u7840\u64cd\u4f5c","text":"

\u56fe\u7684\u57fa\u7840\u64cd\u4f5c\u5206\u4e3a\u5bf9\u300c\u8fb9\u300d\u7684\u64cd\u4f5c\u548c\u5bf9\u300c\u9876\u70b9\u300d\u7684\u64cd\u4f5c\uff0c\u5728\u300c\u90bb\u63a5\u77e9\u9635\u300d\u548c\u300c\u90bb\u63a5\u8868\u300d\u8fd9\u4e24\u79cd\u8868\u793a\u4e0b\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u540c\u3002

"},{"location":"chapter_graph/graph_operations/#921","title":"9.2.1. \u00a0 \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u7684\u5b9e\u73b0","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u6709\uff1a

  • \u6dfb\u52a0\u6216\u5220\u9664\u8fb9\uff1a\u76f4\u63a5\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u4fee\u6539\u6307\u5b9a\u8fb9\u7684\u5bf9\u5e94\u5143\u7d20\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002\u800c\u7531\u4e8e\u662f\u65e0\u5411\u56fe\uff0c\u56e0\u6b64\u9700\u8981\u540c\u65f6\u66f4\u65b0\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u6dfb\u52a0\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u77e9\u9635\u7684\u5c3e\u90e8\u6dfb\u52a0\u4e00\u884c\u4e00\u5217\uff0c\u5e76\u5168\u90e8\u586b \\(0\\) \u5373\u53ef\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\u3002
  • \u5220\u9664\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u4e00\u884c\u4e00\u5217\u3002\u5f53\u5220\u9664\u9996\u884c\u9996\u5217\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u9700\u8981\u5c06 \\((n-1)^2\\) \u4e2a\u5143\u7d20\u201c\u5411\u5de6\u4e0a\u79fb\u52a8\u201d\uff0c\u4ece\u800c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002
  • \u521d\u59cb\u5316\uff1a\u4f20\u5165 \\(n\\) \u4e2a\u9876\u70b9\uff0c\u521d\u59cb\u5316\u957f\u5ea6\u4e3a \\(n\\) \u7684\u9876\u70b9\u5217\u8868 vertices \uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b\u521d\u59cb\u5316 \\(n \\times n\\) \u5927\u5c0f\u7684\u90bb\u63a5\u77e9\u9635 adjMat \uff0c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002
\u521d\u59cb\u5316\u90bb\u63a5\u77e9\u9635\u6dfb\u52a0\u8fb9\u5220\u9664\u8fb9\u6dfb\u52a0\u9876\u70b9\u5220\u9664\u9876\u70b9

\u4ee5\u4e0b\u662f\u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u8868\u793a\u56fe\u7684\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_adjacency_matrix.java
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nList<Integer> vertices;     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nList<List<Integer>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u65b9\u6cd5 */\npublic GraphAdjMat(int[] vertices, int[][] edges) {\nthis.vertices = new ArrayList<>();\nthis.adjMat = new ArrayList<>();\n// \u6dfb\u52a0\u9876\u70b9\nfor (int val : vertices) {\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (int[] e : edges) {\naddEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size() {\nreturn vertices.size();\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(int val) {\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.add(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nList<Integer> newRow = new ArrayList<>(n);\nfor (int j = 0; j < n; j++) {\nnewRow.add(0);\n}\nadjMat.add(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (List<Integer> row : adjMat) {\nrow.add(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(int index) {\nif (index >= size())\nthrow new IndexOutOfBoundsException();\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.remove(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.remove(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (List<Integer> row : adjMat) {\nrow.remove(index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void addEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfBoundsException();\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat.get(i).set(j, 1);\nadjMat.get(j).set(i, 1);\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void removeEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfBoundsException();\nadjMat.get(i).set(j, 0);\nadjMat.get(j).set(i, 0);\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\npublic void print() {\nSystem.out.print(\"\u9876\u70b9\u5217\u8868 = \");\nSystem.out.println(vertices);\nSystem.out.println(\"\u90bb\u63a5\u77e9\u9635 =\");\nPrintUtil.printMatrix(adjMat);\n}\n}\n
graph_adjacency_matrix.cpp
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvector<int> vertices;       // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvector<vector<int>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nGraphAdjMat(const vector<int>& vertices, const vector<vector<int>>& edges) {\n// \u6dfb\u52a0\u9876\u70b9\nfor (int val : vertices) {\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const vector<int>& edge : edges) {\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nint size() const {\nreturn vertices.size();\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nvoid addVertex(int val) {\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.push_back(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nadjMat.emplace_back(n, 0);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (vector<int>& row : adjMat) {\nrow.push_back(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nvoid removeVertex(int index) {\nif (index >= size()) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.erase(vertices.begin() + index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.erase(adjMat.begin() + index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (vector<int>& row : adjMat) {\nrow.erase(row.begin() + index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nvoid addEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1;\nadjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nvoid removeEdge(int i, int j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j) {\nthrow out_of_range(\"\u9876\u70b9\u4e0d\u5b58\u5728\");\n}\nadjMat[i][j] = 0;\nadjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nvoid print() {\ncout << \"\u9876\u70b9\u5217\u8868 = \";\nPrintUtil::printVector(vertices);\ncout << \"\u90bb\u63a5\u77e9\u9635 =\" << endl;\nPrintUtil::printVectorMatrix(adjMat);\n}\n};\n
graph_adjacency_matrix.py
class GraphAdjMat:\n\"\"\" \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b \"\"\"\n# \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvertices: List[int] = []\n# \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadj_mat: List[List[int]] = []\ndef __init__(self, vertices: List[int], edges: List[List[int]]) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.vertices: List[int] = []\nself.adj_mat: List[List[int]] = []\n# \u6dfb\u52a0\u9876\u70b9\nfor val in vertices:\nself.add_vertex(val)\n# \u6dfb\u52a0\u8fb9\n# \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor e in edges:\nself.add_edge(e[0], e[1])\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u9876\u70b9\u6570\u91cf \"\"\"\nreturn len(self.vertices)\ndef add_vertex(self, val: int) -> None:\n\"\"\" \u6dfb\u52a0\u9876\u70b9 \"\"\"\nn = self.size()\n# \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nself.vertices.append(val)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nnew_row = [0] * n\nself.adj_mat.append(new_row)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor row in self.adj_mat:\nrow.append(0)\ndef remove_vertex(self, index: int) -> None:\n\"\"\" \u5220\u9664\u9876\u70b9 \"\"\"\nif index >= self.size():\nraise IndexError()\n# \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nself.vertices.pop(index)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nself.adj_mat.pop(index)\n# \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor row in self.adj_mat:\nrow.pop(index)\ndef add_edge(self, i: int, j: int) -> None:\n\"\"\" \u6dfb\u52a0\u8fb9 \"\"\"\n# \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\n# \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 or j < 0 or i >= self.size() or j >= self.size() or i == j:\nraise IndexError()\n# \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nself.adj_mat[i][j] = 1\nself.adj_mat[j][i] = 1\ndef remove_edge(self, i: int, j: int) -> None:\n\"\"\" \u5220\u9664\u8fb9 \"\"\"\n# \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\n# \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 or j < 0 or i >= self.size() or j >= self.size() or i == j:\nraise IndexError()\nself.adj_mat[i][j] = 0\nself.adj_mat[j][i] = 0\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u90bb\u63a5\u77e9\u9635 \"\"\"\nprint(\"\u9876\u70b9\u5217\u8868 =\", self.vertices)\nprint(\"\u90bb\u63a5\u77e9\u9635 =\")\nprint_matrix(self.adj_mat)\n
graph_adjacency_matrix.go
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\ntype graphAdjMat struct {\n// \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nvertices []int\n// \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat [][]int\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newGraphAdjMat(vertices []int, edges [][]int) *graphAdjMat {\n// \u6dfb\u52a0\u9876\u70b9\nn := len(vertices)\nadjMat := make([][]int, n)\nfor i := range adjMat {\nadjMat[i] = make([]int, n)\n}\n// \u521d\u59cb\u5316\u56fe\ng := &graphAdjMat{\nvertices: vertices,\nadjMat:   adjMat,\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor i := range edges {\ng.addEdge(edges[i][0], edges[i][1])\n}\nreturn g\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc (g *graphAdjMat) size() int {\nreturn len(g.vertices)\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc (g *graphAdjMat) addVertex(val int) {\nn := g.size()\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\ng.vertices = append(g.vertices, val)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nnewRow := make([]int, n)\ng.adjMat = append(g.adjMat, newRow)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor i := range g.adjMat {\ng.adjMat[i] = append(g.adjMat[i], 0)\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc (g *graphAdjMat) removeVertex(index int) {\nif index >= g.size() {\nreturn\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\ng.vertices = append(g.vertices[:index], g.vertices[index+1:]...)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\ng.adjMat = append(g.adjMat[:index], g.adjMat[index+1:]...)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor i := range g.adjMat {\ng.adjMat[i] = append(g.adjMat[i][:index], g.adjMat[i][index+1:]...)\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc (g *graphAdjMat) addEdge(i, j int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= g.size() || j >= g.size() || i == j {\nfmt.Errorf(\"%s\", \"Index Out Of Bounds Exception\")\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\ng.adjMat[i][j] = 1\ng.adjMat[j][i] = 1\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc (g *graphAdjMat) removeEdge(i, j int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= g.size() || j >= g.size() || i == j {\nfmt.Errorf(\"%s\", \"Index Out Of Bounds Exception\")\n}\ng.adjMat[i][j] = 0\ng.adjMat[j][i] = 0\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nfunc (g *graphAdjMat) print() {\nfmt.Printf(\"\\t\u9876\u70b9\u5217\u8868 = %v\\n\", g.vertices)\nfmt.Printf(\"\\t\u90bb\u63a5\u77e9\u9635 = \\n\")\nfor i := range g.adjMat {\nfmt.Printf(\"\\t\\t\\t%v\\n\", g.adjMat[i])\n}\n}\n
graph_adjacency_matrix.js
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvertices;   // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat;     // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\nconstructor(vertices, edges) {\nthis.vertices = [];\nthis.adjMat = [];\n// \u6dfb\u52a0\u9876\u70b9\nfor (const val of vertices) {\nthis.addVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const e of edges) {\nthis.addEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize() {\nreturn this.vertices.length;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(val) {\nconst n = this.size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nthis.vertices.push(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nconst newRow = [];\nfor (let j = 0; j < n; j++) {\nnewRow.push(0);\n}\nthis.adjMat.push(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (const row of this.adjMat) {\nrow.push(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(index) {\nif (index >= this.size()) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nthis.vertices.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nthis.adjMat.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (const row of this.adjMat) {\nrow.splice(index, 1);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\naddEdge(i, j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nthis.adjMat[i][j] = 1;\nthis.adjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nremoveEdge(i, j) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\nthis.adjMat[i][j] = 0;\nthis.adjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nprint() {\nconsole.log(\"\u9876\u70b9\u5217\u8868 = \", this.vertices);\nconsole.log(\"\u90bb\u63a5\u77e9\u9635 =\", this.adjMat);\n}\n}\n
graph_adjacency_matrix.ts
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nvertices: number[];     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nadjMat: number[][];     // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\nconstructor(vertices: number[], edges: number[][]) {\nthis.vertices = [];\nthis.adjMat = [];\n// \u6dfb\u52a0\u9876\u70b9\nfor (const val of vertices) {\nthis.addVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor (const e of edges) {\nthis.addEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize(): number {\nreturn this.vertices.length;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(val: number): void {\nconst n: number = this.size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nthis.vertices.push(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nconst newRow: number[] = [];\nfor (let j: number = 0; j < n; j++) {\nnewRow.push(0);\n}\nthis.adjMat.push(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor (const row of this.adjMat) {\nrow.push(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(index: number): void {\nif (index >= this.size()) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nthis.vertices.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nthis.adjMat.splice(index, 1);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor (const row of this.adjMat) {\nrow.splice(index, 1);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\naddEdge(i: number, j: number): void {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nthis.adjMat[i][j] = 1;\nthis.adjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nremoveEdge(i: number, j: number): void {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {\nthrow new RangeError(\"Index Out Of Bounds Exception\");\n}\nthis.adjMat[i][j] = 0;\nthis.adjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nprint(): void {\nconsole.log(\"\u9876\u70b9\u5217\u8868 = \", this.vertices);\nconsole.log(\"\u90bb\u63a5\u77e9\u9635 =\", this.adjMat);\n}\n}\n
graph_adjacency_matrix.c
[class]{graphAdjMat}-[func]{}\n
graph_adjacency_matrix.cs
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat\n{\nList<int> vertices;     // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nList<List<int>> adjMat; // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u51fd\u6570 */\npublic GraphAdjMat(int[] vertices, int[][] edges)\n{\nthis.vertices = new List<int>();\nthis.adjMat = new List<List<int>>();\n// \u6dfb\u52a0\u9876\u70b9\nforeach (int val in vertices)\n{\naddVertex(val);\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nforeach (int[] e in edges)\n{\naddEdge(e[0], e[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size()\n{\nreturn vertices.Count;\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(int val)\n{\nint n = size();\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.Add(val);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nList<int> newRow = new List<int>(n);\nfor (int j = 0; j < n; j++)\n{\nnewRow.Add(0);\n}\nadjMat.Add(newRow);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nforeach (List<int> row in adjMat)\n{\nrow.Add(0);\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(int index)\n{\nif (index >= size())\nthrow new IndexOutOfRangeException();\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.RemoveAt(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.RemoveAt(index);\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nforeach (List<int> row in adjMat)\n{\nrow.RemoveAt(index);\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void addEdge(int i, int j)\n{\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfRangeException();\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1;\nadjMat[j][i] = 1;\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\npublic void removeEdge(int i, int j)\n{\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif (i < 0 || j < 0 || i >= size() || j >= size() || i == j)\nthrow new IndexOutOfRangeException();\nadjMat[i][j] = 0;\nadjMat[j][i] = 0;\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\npublic void print()\n{\nConsole.Write(\"\u9876\u70b9\u5217\u8868 = \");\nPrintUtil.PrintList(vertices);\nConsole.WriteLine(\"\u90bb\u63a5\u77e9\u9635 =\");\nPrintUtil.printMatrix(adjMat);\n}\n}\n
graph_adjacency_matrix.swift
/* \u57fa\u4e8e\u90bb\u63a5\u77e9\u9635\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjMat {\nprivate var vertices: [Int] // \u9876\u70b9\u5217\u8868\uff0c\u5143\u7d20\u4ee3\u8868\u201c\u9876\u70b9\u503c\u201d\uff0c\u7d22\u5f15\u4ee3\u8868\u201c\u9876\u70b9\u7d22\u5f15\u201d\nprivate var adjMat: [[Int]] // \u90bb\u63a5\u77e9\u9635\uff0c\u884c\u5217\u7d22\u5f15\u5bf9\u5e94\u201c\u9876\u70b9\u7d22\u5f15\u201d\n/* \u6784\u9020\u65b9\u6cd5 */\ninit(vertices: [Int], edges: [[Int]]) {\nself.vertices = []\nadjMat = []\n// \u6dfb\u52a0\u9876\u70b9\nfor val in vertices {\naddVertex(val: val)\n}\n// \u6dfb\u52a0\u8fb9\n// \u8bf7\u6ce8\u610f\uff0cedges \u5143\u7d20\u4ee3\u8868\u9876\u70b9\u7d22\u5f15\uff0c\u5373\u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfor e in edges {\naddEdge(i: e[0], j: e[1])\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc size() -> Int {\nvertices.count\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc addVertex(val: Int) {\nlet n = size()\n// \u5411\u9876\u70b9\u5217\u8868\u4e2d\u6dfb\u52a0\u65b0\u9876\u70b9\u7684\u503c\nvertices.append(val)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u884c\nlet newRow = Array(repeating: 0, count: n)\nadjMat.append(newRow)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e00\u5217\nfor i in adjMat.indices {\nadjMat[i].append(0)\n}\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc removeVertex(index: Int) {\nif index >= size() {\nfatalError(\"\u8d8a\u754c\")\n}\n// \u5728\u9876\u70b9\u5217\u8868\u4e2d\u79fb\u9664\u7d22\u5f15 index \u7684\u9876\u70b9\nvertices.remove(at: index)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u884c\nadjMat.remove(at: index)\n// \u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u5220\u9664\u7d22\u5f15 index \u7684\u5217\nfor i in adjMat.indices {\nadjMat[i].remove(at: index)\n}\n}\n/* \u6dfb\u52a0\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc addEdge(i: Int, j: Int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= size() || j >= size() || i == j {\nfatalError(\"\u8d8a\u754c\")\n}\n// \u5728\u65e0\u5411\u56fe\u4e2d\uff0c\u90bb\u63a5\u77e9\u9635\u6cbf\u4e3b\u5bf9\u89d2\u7ebf\u5bf9\u79f0\uff0c\u5373\u6ee1\u8db3 (i, j) == (j, i)\nadjMat[i][j] = 1\nadjMat[j][i] = 1\n}\n/* \u5220\u9664\u8fb9 */\n// \u53c2\u6570 i, j \u5bf9\u5e94 vertices \u5143\u7d20\u7d22\u5f15\nfunc removeEdge(i: Int, j: Int) {\n// \u7d22\u5f15\u8d8a\u754c\u4e0e\u76f8\u7b49\u5904\u7406\nif i < 0 || j < 0 || i >= size() || j >= size() || i == j {\nfatalError(\"\u8d8a\u754c\")\n}\nadjMat[i][j] = 0\nadjMat[j][i] = 0\n}\n/* \u6253\u5370\u90bb\u63a5\u77e9\u9635 */\nfunc print() {\nSwift.print(\"\u9876\u70b9\u5217\u8868 = \", terminator: \"\")\nSwift.print(vertices)\nSwift.print(\"\u90bb\u63a5\u77e9\u9635 =\")\nPrintUtil.printMatrix(matrix: adjMat)\n}\n}\n
graph_adjacency_matrix.zig
\n
"},{"location":"chapter_graph/graph_operations/#922","title":"9.2.2. \u00a0 \u57fa\u4e8e\u90bb\u63a5\u8868\u7684\u5b9e\u73b0","text":"

\u8bbe\u56fe\u7684\u9876\u70b9\u603b\u6570\u4e3a \\(n\\) \u3001\u8fb9\u603b\u6570\u4e3a \\(m\\) \uff0c\u5219\u6709\uff1a

  • \u6dfb\u52a0\u8fb9\uff1a\u5728\u9876\u70b9\u5bf9\u5e94\u94fe\u8868\u7684\u5c3e\u90e8\u6dfb\u52a0\u8fb9\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002\u56e0\u4e3a\u662f\u65e0\u5411\u56fe\uff0c\u6240\u4ee5\u9700\u8981\u540c\u65f6\u6dfb\u52a0\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u5220\u9664\u8fb9\uff1a\u5728\u9876\u70b9\u5bf9\u5e94\u94fe\u8868\u4e2d\u67e5\u8be2\u4e0e\u5220\u9664\u6307\u5b9a\u8fb9\uff0c\u4f7f\u7528 \\(O(m)\\) \u65f6\u95f4\u3002\u4e0e\u6dfb\u52a0\u8fb9\u4e00\u6837\uff0c\u9700\u8981\u540c\u65f6\u5220\u9664\u4e24\u4e2a\u65b9\u5411\u7684\u8fb9\u3002
  • \u6dfb\u52a0\u9876\u70b9\uff1a\u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u94fe\u8868\u5373\u53ef\uff0c\u5e76\u4ee5\u65b0\u589e\u9876\u70b9\u4e3a\u94fe\u8868\u5934\u7ed3\u70b9\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002
  • \u5220\u9664\u9876\u70b9\uff1a\u9700\u8981\u904d\u5386\u6574\u4e2a\u90bb\u63a5\u8868\uff0c\u5220\u9664\u5305\u542b\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u8fb9\uff0c\u4f7f\u7528 \\(O(n + m)\\) \u65f6\u95f4\u3002
  • \u521d\u59cb\u5316\uff1a\u9700\u8981\u5728\u90bb\u63a5\u8868\u4e2d\u5efa\u7acb \\(n\\) \u4e2a\u7ed3\u70b9\u548c \\(2m\\) \u6761\u8fb9\uff0c\u4f7f\u7528 \\(O(n + m)\\) \u65f6\u95f4\u3002
\u521d\u59cb\u5316\u90bb\u63a5\u8868\u6dfb\u52a0\u8fb9\u5220\u9664\u8fb9\u6dfb\u52a0\u9876\u70b9\u5220\u9664\u9876\u70b9

\u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u56fe\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u6ce8\u610f\u5230\uff0c\u6211\u4eec\u5728\u90bb\u63a5\u8868\u4e2d\u4f7f\u7528 Vertex \u7ed3\u70b9\u7c7b\u6765\u8868\u793a\u9876\u70b9\uff0c\u8fd9\u6837\u505a\u7684\u539f\u56e0\u662f\uff1a

  • \u5982\u679c\u6211\u4eec\u9009\u62e9\u901a\u8fc7\u9876\u70b9\u503c\u6765\u533a\u5206\u4e0d\u540c\u9876\u70b9\uff0c\u90a3\u4e48\u503c\u91cd\u590d\u7684\u9876\u70b9\u5c06\u65e0\u6cd5\u88ab\u533a\u5206\u3002
  • \u5982\u679c\u7c7b\u4f3c\u90bb\u63a5\u77e9\u9635\u90a3\u6837\uff0c\u4f7f\u7528\u9876\u70b9\u5217\u8868\u7d22\u5f15\u6765\u533a\u5206\u4e0d\u540c\u9876\u70b9\u3002\u90a3\u4e48\uff0c\u5047\u8bbe\u6211\u4eec\u60f3\u8981\u5220\u9664\u7d22\u5f15\u4e3a \\(i\\) \u7684\u9876\u70b9\uff0c\u5219\u9700\u8981\u904d\u5386\u6574\u4e2a\u90bb\u63a5\u8868\uff0c\u5c06\u5176\u4e2d \\(> i\\) \u7684\u7d22\u5f15\u5168\u90e8\u6267\u884c \\(-1\\) \uff0c\u8fd9\u6837\u64cd\u4f5c\u6548\u7387\u592a\u4f4e\u3002
  • \u56e0\u6b64\u6211\u4eec\u8003\u8651\u5f15\u5165\u9876\u70b9\u7c7b Vertex \uff0c\u4f7f\u5f97\u6bcf\u4e2a\u9876\u70b9\u90fd\u662f\u552f\u4e00\u7684\u5bf9\u8c61\uff0c\u6b64\u65f6\u5220\u9664\u9876\u70b9\u65f6\u5c31\u65e0\u9700\u6539\u52a8\u5176\u4f59\u9876\u70b9\u4e86\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_adjacency_list.java
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nMap<Vertex, List<Vertex>> adjList;\n/* \u6784\u9020\u65b9\u6cd5 */\npublic GraphAdjList(Vertex[][] edges) {\nthis.adjList = new HashMap<>();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (Vertex[] edge : edges) {\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size() {\nreturn adjList.size();\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic void addEdge(Vertex vet1, Vertex vet2) {\nif (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)\nthrow new IllegalArgumentException();\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList.get(vet1).add(vet2);\nadjList.get(vet2).add(vet1);\n}\n/* \u5220\u9664\u8fb9 */\npublic void removeEdge(Vertex vet1, Vertex vet2) {\nif (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)\nthrow new IllegalArgumentException();\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList.get(vet1).remove(vet2);\nadjList.get(vet2).remove(vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(Vertex vet) {\nif (adjList.containsKey(vet))\nreturn;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList.put(vet, new ArrayList<>());\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(Vertex vet) {\nif (!adjList.containsKey(vet))\nthrow new IllegalArgumentException();\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.remove(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (List<Vertex> list : adjList.values()) {\nlist.remove(vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic void print() {\nSystem.out.println(\"\u90bb\u63a5\u8868 =\");\nfor (Map.Entry<Vertex, List<Vertex>> entry : adjList.entrySet()) {\nList<Integer> tmp = new ArrayList<>();\nfor (Vertex vertex : entry.getValue())\ntmp.add(vertex.val);\nSystem.out.println(entry.getKey().val + \": \" + tmp + \",\");\n}\n}\n}\n
graph_adjacency_list.cpp
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\npublic:\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nunordered_map<Vertex*, vector<Vertex*>> adjList;\n/* \u5728 vector \u4e2d\u5220\u9664\u6307\u5b9a\u7ed3\u70b9 */\nvoid remove(vector<Vertex*> &vec, Vertex *vet) {\nfor (int i = 0; i < vec.size(); i++) {\nif (vec[i] == vet) {\nvec.erase(vec.begin() + i);\nbreak;\n}\n}\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nGraphAdjList(const vector<vector<Vertex*>>& edges) {\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const vector<Vertex*>& edge : edges) {\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nint size() { return adjList.size(); }\n/* \u6dfb\u52a0\u8fb9 */\nvoid addEdge(Vertex* vet1, Vertex* vet2) {\nif (!adjList.count(vet1) || !adjList.count(vet2) || vet1 == vet2)\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1].push_back(vet2);\nadjList[vet2].push_back(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nvoid removeEdge(Vertex* vet1, Vertex* vet2) {\nif (!adjList.count(vet1) || !adjList.count(vet2) || vet1 == vet2)\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u5220\u9664\u8fb9 vet1 - vet2\nremove(adjList[vet1], vet2);\nremove(adjList[vet2], vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nvoid addVertex(Vertex* vet) {\nif (adjList.count(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList[vet] = vector<Vertex*>();\n}\n/* \u5220\u9664\u9876\u70b9 */\nvoid removeVertex(Vertex* vet) {\nif (!adjList.count(vet))\nthrow invalid_argument(\"\u4e0d\u5b58\u5728\u9876\u70b9\");\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.erase(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (auto& [key, vec] : adjList) {\nremove(vec, vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nvoid print() {\ncout << \"\u90bb\u63a5\u8868 =\" << endl;\nfor (auto& [key, vec] : adjList) {\ncout << key->val << \": \";\nPrintUtil::printVector(vetsToVals(vec));\n}\n}\n};\n
graph_adjacency_list.py
class GraphAdjList:\n\"\"\" \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b \"\"\"\ndef __init__(self, edges: List[List[Vertex]]) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nself.adj_list: Dict = {}\n# \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor edge in edges:\nself.add_vertex(edge[0])\nself.add_vertex(edge[1])\nself.add_edge(edge[0], edge[1])\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u9876\u70b9\u6570\u91cf \"\"\"\nreturn len(self.adj_list)\ndef add_edge(self, vet1: Vertex, vet2: Vertex) -> None:\n\"\"\" \u6dfb\u52a0\u8fb9 \"\"\"\nif vet1 not in self.adj_list or vet2 not in self.adj_list or vet1 == vet2:\nraise ValueError\n# \u6dfb\u52a0\u8fb9 vet1 - vet2\nself.adj_list[vet1].append(vet2)\nself.adj_list[vet2].append(vet1)\ndef remove_edge(self, vet1: Vertex, vet2: Vertex) -> None:\n\"\"\" \u5220\u9664\u8fb9 \"\"\"\nif vet1 not in self.adj_list or vet2 not in self.adj_list or vet1 == vet2:\nraise ValueError\n# \u5220\u9664\u8fb9 vet1 - vet2\nself.adj_list[vet1].remove(vet2)\nself.adj_list[vet2].remove(vet1)\ndef add_vertex(self, vet: Vertex) -> None:\n\"\"\" \u6dfb\u52a0\u9876\u70b9 \"\"\"\nif vet in self.adj_list:\nreturn\n# \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nself.adj_list[vet] = []\ndef remove_vertex(self, vet: Vertex) -> None:\n\"\"\" \u5220\u9664\u9876\u70b9 \"\"\"\nif vet not in self.adj_list:\nraise ValueError\n# \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nself.adj_list.pop(vet)\n# \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor vertex in self.adj_list:\nif vet in self.adj_list[vertex]:\nself.adj_list[vertex].remove(vet)\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u90bb\u63a5\u8868 \"\"\"\nprint(\"\u90bb\u63a5\u8868 =\")\nfor vertex in self.adj_list:\ntmp = [v.val for v in self.adj_list[vertex]]\nprint(f\"{vertex.val}: {tmp},\")\n
graph_adjacency_list.go
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\ntype graphAdjList struct {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList map[Vertex][]Vertex\n}\n/* \u6784\u9020\u65b9\u6cd5 */\nfunc newGraphAdjList(edges [][]Vertex) *graphAdjList {\ng := &graphAdjList{\nadjList: make(map[Vertex][]Vertex),\n}\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor _, edge := range edges {\ng.addVertex(edge[0])\ng.addVertex(edge[1])\ng.addEdge(edge[0], edge[1])\n}\nreturn g\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nfunc (g *graphAdjList) size() int {\nreturn len(g.adjList)\n}\n/* \u6dfb\u52a0\u8fb9 */\nfunc (g *graphAdjList) addEdge(vet1 Vertex, vet2 Vertex) {\n_, ok1 := g.adjList[vet1]\n_, ok2 := g.adjList[vet2]\nif !ok1 || !ok2 || vet1 == vet2 {\npanic(\"error\")\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2, \u6dfb\u52a0\u533f\u540d struct{},\ng.adjList[vet1] = append(g.adjList[vet1], vet2)\ng.adjList[vet2] = append(g.adjList[vet2], vet1)\n}\n/* \u5220\u9664\u8fb9 */\nfunc (g *graphAdjList) removeEdge(vet1 Vertex, vet2 Vertex) {\n_, ok1 := g.adjList[vet1]\n_, ok2 := g.adjList[vet2]\nif !ok1 || !ok2 || vet1 == vet2 {\npanic(\"error\")\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nDeleteSliceElms(g.adjList[vet1], vet2)\nDeleteSliceElms(g.adjList[vet2], vet1)\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\nfunc (g *graphAdjList) addVertex(vet Vertex) {\n_, ok := g.adjList[vet]\nif ok {\nreturn\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\ng.adjList[vet] = make([]Vertex, 0)\n}\n/* \u5220\u9664\u9876\u70b9 */\nfunc (g *graphAdjList) removeVertex(vet Vertex) {\n_, ok := g.adjList[vet]\nif !ok {\npanic(\"error\")\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\ndelete(g.adjList, vet)\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor _, list := range g.adjList {\nDeleteSliceElms(list, vet)\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nfunc (g *graphAdjList) print() {\nvar builder strings.Builder\nfmt.Printf(\"\u90bb\u63a5\u8868 = \\n\")\nfor k, v := range g.adjList {\nbuilder.WriteString(\"\\t\\t\" + strconv.Itoa(k.Val) + \": \")\nfor _, vet := range v {\nbuilder.WriteString(strconv.Itoa(vet.Val) + \" \")\n}\nfmt.Println(builder.String())\nbuilder.Reset()\n}\n}\n
graph_adjacency_list.js
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList;\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(edges) {\nthis.adjList = new Map();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const edge of edges) {\nthis.addVertex(edge[0]);\nthis.addVertex(edge[1]);\nthis.addEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize() {\nreturn this.adjList.size;\n}\n/* \u6dfb\u52a0\u8fb9 */\naddEdge(vet1, vet2) {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).push(vet2);\nthis.adjList.get(vet2).push(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nremoveEdge(vet1, vet2) {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).splice(this.adjList.get(vet1).indexOf(vet2), 1);\nthis.adjList.get(vet2).splice(this.adjList.get(vet2).indexOf(vet1), 1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(vet) {\nif (this.adjList.has(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nthis.adjList.set(vet, []);\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(vet) {\nif (!this.adjList.has(vet)) {\nthrow new Error(\"Illegal Argument Exception\");\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nthis.adjList.delete(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (let set of this.adjList.values()) {\nconst index = set.indexOf(vet);\nif (index > -1) {\nset.splice(index, 1);\n}\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nprint() {\nconsole.log(\"\u90bb\u63a5\u8868 =\");\nfor (const [key, value] of this.adjList) {\nconst tmp = [];\nfor (const vertex of value) {\ntmp.push(vertex.val);\n}\nconsole.log(key.val + \": \" + tmp.join());\n}\n}\n}\n
graph_adjacency_list.ts
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nadjList: Map<Vertex, Vertex[]>;\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(edges: Vertex[][]) {\nthis.adjList = new Map();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor (const edge of edges) {\nthis.addVertex(edge[0]);\nthis.addVertex(edge[1]);\nthis.addEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\nsize(): number {\nreturn this.adjList.size;\n}\n/* \u6dfb\u52a0\u8fb9 */\naddEdge(vet1: Vertex, vet2: Vertex): void {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).push(vet2);\nthis.adjList.get(vet2).push(vet1);\n}\n/* \u5220\u9664\u8fb9 */\nremoveEdge(vet1: Vertex, vet2: Vertex): void {\nif (!this.adjList.has(vet1) || !this.adjList.has(vet2) || vet1 === vet2) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nthis.adjList.get(vet1).splice(this.adjList.get(vet1).indexOf(vet2), 1);\nthis.adjList.get(vet2).splice(this.adjList.get(vet2).indexOf(vet1), 1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\naddVertex(vet: Vertex): void {\nif (this.adjList.has(vet)) return;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nthis.adjList.set(vet, []);\n}\n/* \u5220\u9664\u9876\u70b9 */\nremoveVertex(vet: Vertex): void {\nif (!this.adjList.has(vet)) {\nthrow new Error('Illegal Argument Exception');\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nthis.adjList.delete(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor (let set of this.adjList.values()) {\nconst index: number = set.indexOf(vet);\nif (index > -1) {\nset.splice(index, 1);\n}\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\nprint(): void {\nconsole.log('\u90bb\u63a5\u8868 =');\nfor (const [key, value] of this.adjList.entries()) {\nconst tmp = [];\nfor (const vertex of value) {\ntmp.push(vertex.val);\n}\nconsole.log(key.val + ': ' + tmp.join());\n}\n}\n}\n
graph_adjacency_list.c
[class]{graphAdjList}-[func]{}\n
graph_adjacency_list.cs
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList\n{\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\npublic Dictionary<Vertex, List<Vertex>> adjList;\n/* \u6784\u9020\u51fd\u6570 */\npublic GraphAdjList(Vertex[][] edges)\n{\nthis.adjList = new Dictionary<Vertex, List<Vertex>>();\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nforeach (Vertex[] edge in edges)\n{\naddVertex(edge[0]);\naddVertex(edge[1]);\naddEdge(edge[0], edge[1]);\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic int size()\n{\nreturn adjList.Count;\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic void addEdge(Vertex vet1, Vertex vet2)\n{\nif (!adjList.ContainsKey(vet1) || !adjList.ContainsKey(vet2) || vet1 == vet2)\nthrow new InvalidOperationException();\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1].Add(vet2);\nadjList[vet2].Add(vet1);\n}\n/* \u5220\u9664\u8fb9 */\npublic void removeEdge(Vertex vet1, Vertex vet2)\n{\nif (!adjList.ContainsKey(vet1) || !adjList.ContainsKey(vet2) || vet1 == vet2)\nthrow new InvalidOperationException();\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList[vet1].Remove(vet2);\nadjList[vet2].Remove(vet1);\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic void addVertex(Vertex vet)\n{\nif (adjList.ContainsKey(vet))\nreturn;\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList.Add(vet, new List<Vertex>());\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic void removeVertex(Vertex vet)\n{\nif (!adjList.ContainsKey(vet))\nthrow new InvalidOperationException();\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.Remove(vet);\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nforeach (List<Vertex> list in adjList.Values)\n{\nlist.Remove(vet);\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic void print()\n{\nConsole.WriteLine(\"\u90bb\u63a5\u8868 =\");\nforeach (KeyValuePair<Vertex, List<Vertex>> entry in adjList)\n{\nList<int> tmp = new List<int>();\nforeach (Vertex vertex in entry.Value)\ntmp.Add(vertex.Val);\nConsole.WriteLine(entry.Key.Val + \": [\" + string.Join(\", \", tmp) + \"],\");\n}\n}\n}\n
graph_adjacency_list.swift
/* \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0\u7684\u65e0\u5411\u56fe\u7c7b */\nclass GraphAdjList {\n// \u90bb\u63a5\u8868\uff0ckey: \u9876\u70b9\uff0cvalue\uff1a\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\npublic private(set) var adjList: [Vertex: [Vertex]]\n/* \u6784\u9020\u65b9\u6cd5 */\npublic init(edges: [[Vertex]]) {\nadjList = [:]\n// \u6dfb\u52a0\u6240\u6709\u9876\u70b9\u548c\u8fb9\nfor edge in edges {\naddVertex(vet: edge[0])\naddVertex(vet: edge[1])\naddEdge(vet1: edge[0], vet2: edge[1])\n}\n}\n/* \u83b7\u53d6\u9876\u70b9\u6570\u91cf */\npublic func size() -> Int {\nadjList.count\n}\n/* \u6dfb\u52a0\u8fb9 */\npublic func addEdge(vet1: Vertex, vet2: Vertex) {\nif adjList[vet1] == nil || adjList[vet2] == nil || vet1 == vet2 {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u6dfb\u52a0\u8fb9 vet1 - vet2\nadjList[vet1]?.append(vet2)\nadjList[vet2]?.append(vet1)\n}\n/* \u5220\u9664\u8fb9 */\npublic func removeEdge(vet1: Vertex, vet2: Vertex) {\nif adjList[vet1] == nil || adjList[vet2] == nil || vet1 == vet2 {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u5220\u9664\u8fb9 vet1 - vet2\nadjList[vet1]?.removeAll(where: { $0 == vet2 })\nadjList[vet2]?.removeAll(where: { $0 == vet1 })\n}\n/* \u6dfb\u52a0\u9876\u70b9 */\npublic func addVertex(vet: Vertex) {\nif adjList[vet] != nil {\nreturn\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u94fe\u8868\nadjList[vet] = []\n}\n/* \u5220\u9664\u9876\u70b9 */\npublic func removeVertex(vet: Vertex) {\nif adjList[vet] == nil {\nfatalError(\"\u53c2\u6570\u9519\u8bef\")\n}\n// \u5728\u90bb\u63a5\u8868\u4e2d\u5220\u9664\u9876\u70b9 vet \u5bf9\u5e94\u7684\u94fe\u8868\nadjList.removeValue(forKey: vet)\n// \u904d\u5386\u5176\u5b83\u9876\u70b9\u7684\u94fe\u8868\uff0c\u5220\u9664\u6240\u6709\u5305\u542b vet \u7684\u8fb9\nfor key in adjList.keys {\nadjList[key]?.removeAll(where: { $0 == vet })\n}\n}\n/* \u6253\u5370\u90bb\u63a5\u8868 */\npublic func print() {\nSwift.print(\"\u90bb\u63a5\u8868 =\")\nfor entry in adjList {\nvar tmp: [Int] = []\nfor vertex in entry.value {\ntmp.append(vertex.val)\n}\nSwift.print(\"\\(entry.key.val): \\(tmp),\")\n}\n}\n}\n
graph_adjacency_list.zig
[class]{GraphAdjList}-[func]{}\n
"},{"location":"chapter_graph/graph_operations/#923","title":"9.2.3. \u00a0 \u6548\u7387\u5bf9\u6bd4","text":"

\u8bbe\u56fe\u4e2d\u5171\u6709 \\(n\\) \u4e2a\u9876\u70b9\u548c \\(m\\) \u6761\u8fb9\uff0c\u4e0b\u8868\u4e3a\u90bb\u63a5\u77e9\u9635\u548c\u90bb\u63a5\u8868\u7684\u65f6\u95f4\u548c\u7a7a\u95f4\u6548\u7387\u5bf9\u6bd4\u3002

\u90bb\u63a5\u77e9\u9635 \u90bb\u63a5\u8868\uff08\u94fe\u8868\uff09 \u90bb\u63a5\u8868\uff08\u54c8\u5e0c\u8868\uff09 \u5224\u65ad\u662f\u5426\u90bb\u63a5 \\(O(1)\\) \\(O(m)\\) \\(O(1)\\) \u6dfb\u52a0\u8fb9 \\(O(1)\\) \\(O(1)\\) \\(O(1)\\) \u5220\u9664\u8fb9 \\(O(1)\\) \\(O(m)\\) \\(O(1)\\) \u6dfb\u52a0\u9876\u70b9 \\(O(n)\\) \\(O(1)\\) \\(O(1)\\) \u5220\u9664\u9876\u70b9 \\(O(n^2)\\) \\(O(n + m)\\) \\(O(n)\\) \u5185\u5b58\u7a7a\u95f4\u5360\u7528 \\(O(n^2)\\) \\(O(n + m)\\) \\(O(n + m)\\)

\u89c2\u5bdf\u4e0a\u8868\uff0c\u8c8c\u4f3c\u90bb\u63a5\u8868\uff08\u54c8\u5e0c\u8868\uff09\u7684\u65f6\u95f4\u4e0e\u7a7a\u95f4\u6548\u7387\u6700\u4f18\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u64cd\u4f5c\u8fb9\u7684\u6548\u7387\u66f4\u9ad8\uff0c\u53ea\u9700\u8981\u4e00\u6b21\u6570\u7ec4\u8bbf\u95ee\u6216\u8d4b\u503c\u64cd\u4f5c\u5373\u53ef\u3002\u603b\u7ed3\u4ee5\u4e0a\uff0c\u90bb\u63a5\u77e9\u9635\u4f53\u73b0\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\uff0c\u90bb\u63a5\u8868\u4f53\u73b0\u201c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u201d\u3002

"},{"location":"chapter_graph/graph_traversal/","title":"9.3. \u00a0 \u56fe\u7684\u904d\u5386","text":"

\u56fe\u4e0e\u6811\u7684\u5173\u7cfb

\u6811\u4ee3\u8868\u7684\u662f\u201c\u4e00\u5bf9\u591a\u201d\u7684\u5173\u7cfb\uff0c\u800c\u56fe\u5219\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u53ef\u4ee5\u4ee3\u8868\u4efb\u610f\u201c\u591a\u5bf9\u591a\u201d\u5173\u7cfb\u3002\u672c\u8d28\u4e0a\uff0c\u53ef\u4ee5\u628a\u6811\u770b\u4f5c\u662f\u56fe\u7684\u4e00\u7c7b\u7279\u4f8b\u3002\u90a3\u4e48\u663e\u7136\uff0c\u6811\u904d\u5386\u64cd\u4f5c\u4e5f\u662f\u56fe\u904d\u5386\u64cd\u4f5c\u7684\u4e00\u4e2a\u7279\u4f8b\uff0c\u4e24\u8005\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u7c7b\u4f3c\u7684\uff0c\u5efa\u8bae\u4f60\u5728\u5b66\u4e60\u672c\u7ae0\u8282\u7684\u8fc7\u7a0b\u4e2d\u5c06\u4e24\u8005\u878d\u4f1a\u8d2f\u901a\u3002

\u300c\u56fe\u300d\u4e0e\u300c\u6811\u300d\u90fd\u662f\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u90fd\u9700\u8981\u4f7f\u7528\u300c\u641c\u7d22\u7b97\u6cd5\u300d\u6765\u5b9e\u73b0\u904d\u5386\u64cd\u4f5c\u3002

\u7c7b\u4f3c\u5730\uff0c\u56fe\u7684\u904d\u5386\u65b9\u5f0f\u4e5f\u5206\u4e3a\u4e24\u79cd\uff0c\u5373\u300c\u5e7f\u5ea6\u4f18\u5148\u904d\u5386 Breadth-First Traversal\u300d\u548c\u300c\u6df1\u5ea6\u4f18\u5148\u904d\u5386 Depth-First Travsersal\u300d\uff0c\u4e5f\u79f0\u300c\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22 Breadth-First Search\u300d\u548c\u300c\u6df1\u5ea6\u4f18\u5148\u641c\u7d22 Depth-First Search\u300d\uff0c\u7b80\u79f0\u4e3a BFS \u548c DFS \u3002

"},{"location":"chapter_graph/graph_traversal/#931","title":"9.3.1. \u00a0 \u5e7f\u5ea6\u4f18\u5148\u904d\u5386","text":"

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u4f18\u662f\u4e00\u79cd\u7531\u8fd1\u53ca\u8fdc\u7684\u904d\u5386\u65b9\u5f0f\uff0c\u4ece\u8ddd\u79bb\u6700\u8fd1\u7684\u9876\u70b9\u5f00\u59cb\u8bbf\u95ee\uff0c\u5e76\u4e00\u5c42\u5c42\u5411\u5916\u6269\u5f20\u3002\u5177\u4f53\u5730\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u5148\u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff0c\u968f\u540e\u904d\u5386\u4e0b\u4e2a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026

Fig. \u56fe\u7684\u5e7f\u5ea6\u4f18\u5148\u904d\u5386

"},{"location":"chapter_graph/graph_traversal/#_1","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

BFS \u5e38\u501f\u52a9\u300c\u961f\u5217\u300d\u6765\u5b9e\u73b0\u3002\u961f\u5217\u5177\u6709\u201c\u5148\u5165\u5148\u51fa\u201d\u7684\u6027\u8d28\uff0c\u8fd9\u4e0e BFS \u201c\u7531\u8fd1\u53ca\u8fdc\u201d\u7684\u601d\u60f3\u662f\u5f02\u66f2\u540c\u5de5\u7684\u3002

  1. \u5c06\u904d\u5386\u8d77\u59cb\u9876\u70b9 startVet \u52a0\u5165\u961f\u5217\uff0c\u5e76\u5f00\u542f\u5faa\u73af\uff1b
  2. \u5728\u5faa\u73af\u7684\u6bcf\u8f6e\u8fed\u4ee3\u4e2d\uff0c\u5f39\u51fa\u961f\u9996\u9876\u70b9\u5f39\u51fa\u5e76\u8bb0\u5f55\u8bbf\u95ee\uff0c\u5e76\u5c06\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\u52a0\u5165\u5230\u961f\u5217\u5c3e\u90e8\uff1b
  3. \u5faa\u73af 2. \uff0c\u76f4\u5230\u6240\u6709\u9876\u70b9\u8bbf\u95ee\u5b8c\u6210\u540e\u7ed3\u675f\uff1b

\u4e3a\u4e86\u9632\u6b62\u91cd\u590d\u904d\u5386\u9876\u70b9\uff0c\u6211\u4eec\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868 visited \u6765\u8bb0\u5f55\u54ea\u4e9b\u7ed3\u70b9\u5df2\u88ab\u8bbf\u95ee\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_bfs.java
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nList<Vertex> graphBFS(GraphAdjList graph, Vertex startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nList<Vertex> res = new ArrayList<>();\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nSet<Vertex> visited = new HashSet<>() {{ add(startVet); }};\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nQueue<Vertex> que = new LinkedList<>() {{ offer(startVet); }};\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (!que.isEmpty()) {\nVertex vet = que.poll(); // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.add(vet);            // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex adjVet : graph.adjList.get(vet)) {\nif (visited.contains(adjVet))\ncontinue;        // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.offer(adjVet);   // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.cpp
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nvector<Vertex*> graphBFS(GraphAdjList &graph, Vertex *startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvector<Vertex*> res;\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nunordered_set<Vertex*> visited = { startVet };\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nqueue<Vertex*> que;\nque.push(startVet);\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (!que.empty()) {\nVertex *vet = que.front();\nque.pop();          // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push_back(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (auto adjVet : graph.adjList[vet]) {\nif (visited.count(adjVet))\ncontinue;           // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.push(adjVet);       // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.emplace(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.py
def graph_bfs(graph: GraphAdjList, start_vet: Vertex) -> List[Vertex]:\n\"\"\" \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS \"\"\"\n# \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\n# \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres = []\n# \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited = set([start_vet])\n# \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nque = collections.deque([start_vet])\n# \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile len(que) > 0:\nvet = que.popleft()  # \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.append(vet)      # \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n# \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adj_vet in graph.adj_list[vet]:\nif adj_vet in visited:\ncontinue         # \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nque.append(adj_vet)  # \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adj_vet) # \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n# \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n
graph_bfs.go
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphBFS(g *graphAdjList, startVet Vertex) []Vertex {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres := make([]Vertex, 0)\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited := make(map[Vertex]struct{})\nvisited[startVet] = struct{}{}\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS, \u4f7f\u7528\u5207\u7247\u6a21\u62df\u961f\u5217\nqueue := make([]Vertex, 0)\nqueue = append(queue, startVet)\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nfor len(queue) > 0 {\n// \u961f\u9996\u9876\u70b9\u51fa\u961f\nvet := queue[0]\nqueue = queue[1:]\n// \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nres = append(res, vet)\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor _, adjVet := range g.adjList[vet] {\n_, isExist := visited[adjVet]\n// \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nif !isExist {\nqueue = append(queue, adjVet)\nvisited[adjVet] = struct{}{}\n}\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_bfs.js
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphBFS(graph, startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited = new Set();\nvisited.add(startVet);\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nconst que = [startVet];\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (que.length) {\nconst vet = que.shift();    // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push(vet);              // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet) ?? []) {\nif (visited.has(adjVet)) {\ncontinue;           // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.push(adjVet);       // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.add(adjVet);    // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.ts
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphBFS(graph: GraphAdjList, startVet: Vertex): Vertex[] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res: Vertex[] = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited: Set<Vertex> = new Set();\nvisited.add(startVet);\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nconst que = [startVet];\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile (que.length) {\nconst vet = que.shift(); // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.push(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet) ?? []) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.push(adjVet); // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\nvisited.add(adjVet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res;\n}\n
graph_bfs.c
[class]{}-[func]{graphBFS}\n
graph_bfs.cs
[class]{graph_bfs}-[func]{graphBFS}\n
graph_bfs.swift
/* \u5e7f\u5ea6\u4f18\u5148\u904d\u5386 BFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphBFS(graph: GraphAdjList, startVet: Vertex) -> [Vertex] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvar res: [Vertex] = []\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvar visited: Set<Vertex> = [startVet]\n// \u961f\u5217\u7528\u4e8e\u5b9e\u73b0 BFS\nvar que: [Vertex] = [startVet]\n// \u4ee5\u9876\u70b9 vet \u4e3a\u8d77\u70b9\uff0c\u5faa\u73af\u76f4\u81f3\u8bbf\u95ee\u5b8c\u6240\u6709\u9876\u70b9\nwhile !que.isEmpty {\nlet vet = que.removeFirst() // \u961f\u9996\u9876\u70b9\u51fa\u961f\nres.append(vet) // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adjList[vet] ?? [] {\nif visited.contains(adjVet) {\ncontinue // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\nque.append(adjVet) // \u53ea\u5165\u961f\u672a\u8bbf\u95ee\u7684\u9876\u70b9\nvisited.insert(adjVet) // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n}\n}\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_bfs.zig
[class]{}-[func]{graphBFS}\n

\u4ee3\u7801\u76f8\u5bf9\u62bd\u8c61\uff0c\u5efa\u8bae\u5bf9\u7167\u4ee5\u4e0b\u52a8\u753b\u56fe\u793a\u6765\u52a0\u6df1\u7406\u89e3\u3002

<1><2><3><4><5><6><7><8><9><10><11>

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7684\u5e8f\u5217\u662f\u5426\u552f\u4e00\uff1f

\u4e0d\u552f\u4e00\u3002\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u53ea\u8981\u6c42\u201c\u7531\u8fd1\u53ca\u8fdc\u201d\uff0c\u800c\u591a\u4e2a\u76f8\u540c\u8ddd\u79bb\u7684\u9876\u70b9\u7684\u904d\u5386\u987a\u5e8f\u5141\u8bb8\u88ab\u4efb\u610f\u6253\u4e71\u3002\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\u9876\u70b9 \\(1\\) , \\(3\\) \u7684\u8bbf\u95ee\u987a\u5e8f\u53ef\u4ee5\u4ea4\u6362\u3001\u9876\u70b9 \\(2\\) , \\(4\\) , \\(6\\) \u7684\u8bbf\u95ee\u987a\u5e8f\u4e5f\u53ef\u4ee5\u4efb\u610f\u4ea4\u6362\u3001\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026

"},{"location":"chapter_graph/graph_traversal/#_2","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a \u6240\u6709\u9876\u70b9\u90fd\u4f1a\u5165\u961f\u3001\u51fa\u961f\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(|V|)\\) \u65f6\u95f4\uff1b\u5728\u904d\u5386\u90bb\u63a5\u9876\u70b9\u7684\u8fc7\u7a0b\u4e2d\uff0c\u7531\u4e8e\u662f\u65e0\u5411\u56fe\uff0c\u56e0\u6b64\u6240\u6709\u8fb9\u90fd\u4f1a\u88ab\u8bbf\u95ee \\(2\\) \u6b21\uff0c\u4f7f\u7528 \\(O(2|E|)\\) \u65f6\u95f4\uff1b\u603b\u4f53\u4f7f\u7528 \\(O(|V| + |E|)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a \u5217\u8868 res \uff0c\u54c8\u5e0c\u8868 visited \uff0c\u961f\u5217 que \u4e2d\u7684\u9876\u70b9\u6570\u91cf\u6700\u591a\u4e3a \\(|V|\\) \uff0c\u4f7f\u7528 \\(O(|V|)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_graph/graph_traversal/#932","title":"9.3.2. \u00a0 \u6df1\u5ea6\u4f18\u5148\u904d\u5386","text":"

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u4f18\u5148\u8d70\u5230\u5e95\u3001\u65e0\u8def\u53ef\u8d70\u518d\u56de\u5934\u7684\u904d\u5386\u65b9\u5f0f\u3002\u5177\u4f53\u5730\uff0c\u4ece\u67d0\u4e2a\u9876\u70b9\u51fa\u53d1\uff0c\u4e0d\u65ad\u5730\u8bbf\u95ee\u5f53\u524d\u7ed3\u70b9\u7684\u67d0\u4e2a\u90bb\u63a5\u9876\u70b9\uff0c\u76f4\u5230\u8d70\u5230\u5c3d\u5934\u65f6\u56de\u6eaf\uff0c\u518d\u7ee7\u7eed\u8d70\u5230\u5e95 + \u56de\u6eaf\uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u76f4\u81f3\u6240\u6709\u9876\u70b9\u904d\u5386\u5b8c\u6210\u65f6\u7ed3\u675f\u3002

Fig. \u56fe\u7684\u6df1\u5ea6\u4f18\u5148\u904d\u5386

"},{"location":"chapter_graph/graph_traversal/#_3","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

\u8fd9\u79cd\u201c\u8d70\u5230\u5934 + \u56de\u6eaf\u201d\u7684\u7b97\u6cd5\u5f62\u5f0f\u4e00\u822c\u57fa\u4e8e\u9012\u5f52\u6765\u5b9e\u73b0\u3002\u4e0e BFS \u7c7b\u4f3c\uff0c\u5728 DFS \u4e2d\u6211\u4eec\u4e5f\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868 visited \u6765\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u7684\u9876\u70b9\uff0c\u4ee5\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u9876\u70b9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig graph_dfs.java
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nvoid dfs(GraphAdjList graph, Set<Vertex> visited, List<Vertex> res, Vertex vet) {\nres.add(vet);     // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex adjVet : graph.adjList.get(vet)) {\nif (visited.contains(adjVet))\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nList<Vertex> graphDFS(GraphAdjList graph, Vertex startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nList<Vertex> res = new ArrayList<>();\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nSet<Vertex> visited = new HashSet<>();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.cpp
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nvoid dfs(GraphAdjList& graph, unordered_set<Vertex*>& visited, vector<Vertex*>& res, Vertex* vet) {\nres.push_back(vet);   // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.emplace(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (Vertex* adjVet : graph.adjList[vet]) {\nif (visited.count(adjVet))\ncontinue;     // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nvector<Vertex*> graphDFS(GraphAdjList& graph, Vertex* startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvector<Vertex*> res;\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nunordered_set<Vertex*> visited;\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.py
def dfs(graph: GraphAdjList, visited: Set[Vertex], res: List[Vertex], vet: Vertex):\n\"\"\" \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 \"\"\"\nres.append(vet)     # \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet) # \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n# \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adj_list[vet]:\nif adjVet in visited:\ncontinue # \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n# \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet)\ndef graph_dfs(graph: GraphAdjList, start_vet: Vertex) -> List[Vertex]:\n\"\"\" \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \"\"\"\n# \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres = []\n# \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited = set()\ndfs(graph, visited, res, start_vet)\nreturn res\n
graph_dfs.go
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunc dfs(g *graphAdjList, visited map[Vertex]struct{}, res *[]Vertex, vet Vertex) {\n// append \u64cd\u4f5c\u4f1a\u8fd4\u56de\u65b0\u7684\u7684\u5f15\u7528\uff0c\u5fc5\u987b\u8ba9\u539f\u5f15\u7528\u91cd\u65b0\u8d4b\u503c\u4e3a\u65b0slice\u7684\u5f15\u7528\n*res = append(*res, vet)\nvisited[vet] = struct{}{}\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor _, adjVet := range g.adjList[vet] {\n_, isExist := visited[adjVet]\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\nif !isExist {\ndfs(g, visited, res, adjVet)\n}\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphDFS(g *graphAdjList, startVet Vertex) []Vertex {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nres := make([]Vertex, 0)\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvisited := make(map[Vertex]struct{})\ndfs(g, visited, &res, startVet)\n// \u8fd4\u56de\u9876\u70b9\u904d\u5386\u5e8f\u5217\nreturn res\n}\n
graph_dfs.js
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction dfs(graph, visited, res, vet) {\nres.push(vet);      // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet);   // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet)) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphDFS(graph, startVet) {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited = new Set();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.ts
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunction dfs(graph: GraphAdjList, visited: Set<Vertex>, res: Vertex[], vet: Vertex): void {\nres.push(vet); // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.add(vet); // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor (const adjVet of graph.adjList.get(vet)) {\nif (visited.has(adjVet)) {\ncontinue; // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph, visited, res, adjVet);\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunction graphDFS(graph: GraphAdjList, startVet: Vertex): Vertex[] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nconst res: Vertex[] = [];\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nconst visited: Set<Vertex> = new Set();\ndfs(graph, visited, res, startVet);\nreturn res;\n}\n
graph_dfs.c
[class]{}-[func]{dfs}\n[class]{}-[func]{graphDFS}\n
graph_dfs.cs
[class]{graph_dfs}-[func]{dfs}\n[class]{graph_dfs}-[func]{graphDFS}\n
graph_dfs.swift
/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS \u8f85\u52a9\u51fd\u6570 */\nfunc dfs(graph: GraphAdjList, visited: inout Set<Vertex>, res: inout [Vertex], vet: Vertex) {\nres.append(vet) // \u8bb0\u5f55\u8bbf\u95ee\u9876\u70b9\nvisited.insert(vet) // \u6807\u8bb0\u8be5\u9876\u70b9\u5df2\u88ab\u8bbf\u95ee\n// \u904d\u5386\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfor adjVet in graph.adjList[vet] ?? [] {\nif visited.contains(adjVet) {\ncontinue // \u8df3\u8fc7\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\n}\n// \u9012\u5f52\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9\ndfs(graph: graph, visited: &visited, res: &res, vet: adjVet)\n}\n}\n/* \u6df1\u5ea6\u4f18\u5148\u904d\u5386 DFS */\n// \u4f7f\u7528\u90bb\u63a5\u8868\u6765\u8868\u793a\u56fe\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6307\u5b9a\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\nfunc graphDFS(graph: GraphAdjList, startVet: Vertex) -> [Vertex] {\n// \u9876\u70b9\u904d\u5386\u5e8f\u5217\nvar res: [Vertex] = []\n// \u54c8\u5e0c\u8868\uff0c\u7528\u4e8e\u8bb0\u5f55\u5df2\u88ab\u8bbf\u95ee\u8fc7\u7684\u9876\u70b9\nvar visited: Set<Vertex> = []\ndfs(graph: graph, visited: &visited, res: &res, vet: startVet)\nreturn res\n}\n
graph_dfs.zig
[class]{}-[func]{dfs}\n[class]{}-[func]{graphDFS}\n

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u7b97\u6cd5\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5176\u4e2d

  • \u76f4\u865a\u7ebf\u4ee3\u8868\u5411\u4e0b\u9012\u63a8\uff0c\u4ee3\u8868\u5f00\u542f\u4e86\u4e00\u4e2a\u65b0\u7684\u9012\u5f52\u65b9\u6cd5\u6765\u8bbf\u95ee\u65b0\u9876\u70b9\uff1b
  • \u66f2\u865a\u7ebf\u4ee3\u8868\u5411\u4e0a\u56de\u6eaf\uff0c\u4ee3\u8868\u6b64\u9012\u5f52\u65b9\u6cd5\u5df2\u7ecf\u8fd4\u56de\uff0c\u56de\u6eaf\u5230\u4e86\u5f00\u542f\u6b64\u9012\u5f52\u65b9\u6cd5\u7684\u4f4d\u7f6e\uff1b

\u4e3a\u4e86\u52a0\u6df1\u7406\u89e3\uff0c\u8bf7\u4f60\u5c06\u56fe\u793a\u4e0e\u4ee3\u7801\u7ed3\u5408\u8d77\u6765\uff0c\u5728\u8111\u4e2d\uff08\u6216\u8005\u7528\u7b14\u753b\u4e0b\u6765\uff09\u6a21\u62df\u6574\u4e2a DFS \u8fc7\u7a0b\uff0c\u5305\u62ec\u6bcf\u4e2a\u9012\u5f52\u65b9\u6cd5\u4f55\u65f6\u5f00\u542f\u3001\u4f55\u65f6\u8fd4\u56de\u3002

<1><2><3><4><5><6><7><8><9><10><11>

\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u5e8f\u5217\u662f\u5426\u552f\u4e00\uff1f

\u4e0e\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7c7b\u4f3c\uff0c\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u5e8f\u5217\u7684\u987a\u5e8f\u4e5f\u4e0d\u662f\u552f\u4e00\u7684\u3002\u7ed9\u5b9a\u67d0\u9876\u70b9\uff0c\u5148\u5f80\u54ea\u4e2a\u65b9\u5411\u63a2\u7d22\u90fd\u884c\uff0c\u90fd\u662f\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u3002

\u4ee5\u6811\u7684\u904d\u5386\u4e3a\u4f8b\uff0c\u201c\u6839 \\(\\rightarrow\\) \u5de6 \\(\\rightarrow\\) \u53f3\u201d\u3001\u201c\u5de6 \\(\\rightarrow\\) \u6839 \\(\\rightarrow\\) \u53f3\u201d\u3001\u201c\u5de6 \\(\\rightarrow\\) \u53f3 \\(\\rightarrow\\) \u6839\u201d\u5206\u522b\u5bf9\u5e94\u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386\uff0c\u4f53\u73b0\u4e09\u79cd\u4e0d\u540c\u7684\u904d\u5386\u4f18\u5148\u7ea7\uff0c\u800c\u4e09\u8005\u90fd\u5c5e\u4e8e\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u3002

"},{"location":"chapter_graph/graph_traversal/#_4","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a \u6240\u6709\u9876\u70b9\u90fd\u88ab\u8bbf\u95ee\u4e00\u6b21\uff1b\u6240\u6709\u8fb9\u90fd\u88ab\u8bbf\u95ee\u4e86 \\(2\\) \u6b21\uff0c\u4f7f\u7528 \\(O(2|E|)\\) \u65f6\u95f4\uff1b\u603b\u4f53\u4f7f\u7528 \\(O(|V| + |E|)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a \u5217\u8868 res \uff0c\u54c8\u5e0c\u8868 visited \u9876\u70b9\u6570\u91cf\u6700\u591a\u4e3a \\(|V|\\) \uff0c\u9012\u5f52\u6df1\u5ea6\u6700\u5927\u4e3a \\(|V|\\) \uff0c\u56e0\u6b64\u4f7f\u7528 \\(O(|V|)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_graph/summary/","title":"9.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u56fe\u7531\u9876\u70b9\u548c\u8fb9\u7ec4\u6210\uff0c\u53ef\u4ee5\u8868\u793a\u4e3a\u4e00\u7ec4\u9876\u70b9\u548c\u4e00\u7ec4\u8fb9\u6784\u6210\u7684\u96c6\u5408\u3002
  • \u76f8\u6bd4\u7ebf\u6027\u5173\u7cfb\uff08\u94fe\u8868\uff09\u548c\u5206\u6cbb\u5173\u7cfb\uff08\u6811\uff09\uff0c\u7f51\u7edc\u5173\u7cfb\uff08\u56fe\uff09\u7684\u81ea\u7531\u5ea6\u66f4\u9ad8\uff0c\u4e5f\u4ece\u800c\u66f4\u4e3a\u590d\u6742\u3002
  • \u6709\u5411\u56fe\u7684\u8fb9\u5b58\u5728\u65b9\u5411\uff0c\u8fde\u901a\u56fe\u4e2d\u7684\u4efb\u610f\u9876\u70b9\u90fd\u53ef\u8fbe\uff0c\u6709\u6743\u56fe\u7684\u6bcf\u6761\u8fb9\u90fd\u5305\u542b\u6743\u91cd\u53d8\u91cf\u3002
  • \u90bb\u63a5\u77e9\u9635\u4f7f\u7528\u65b9\u9635\u6765\u8868\u793a\u56fe\uff0c\u6bcf\u4e00\u884c\uff08\u5217\uff09\u4ee3\u8868\u4e00\u4e2a\u9876\u70b9\uff0c\u77e9\u9635\u5143\u7d20\u4ee3\u8868\u8fb9\uff0c\u4f7f\u7528 \\(1\\) \u6216 \\(0\\) \u6765\u8868\u793a\u4e24\u4e2a\u9876\u70b9\u4e4b\u95f4\u6709\u8fb9\u6216\u65e0\u8fb9\u3002\u90bb\u63a5\u77e9\u9635\u7684\u589e\u5220\u67e5\u64cd\u4f5c\u6548\u7387\u5f88\u9ad8\uff0c\u4f46\u5360\u7528\u7a7a\u95f4\u5927\u3002
  • \u90bb\u63a5\u8868\u4f7f\u7528\u591a\u4e2a\u94fe\u8868\u6765\u8868\u793a\u56fe\uff0c\u7b2c \\(i\\) \u6761\u94fe\u8868\u5bf9\u5e94\u9876\u70b9 \\(i\\) \uff0c\u5176\u4e2d\u5b58\u50a8\u4e86\u8be5\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9\u3002\u90bb\u63a5\u8868\u76f8\u5bf9\u90bb\u63a5\u77e9\u9635\u66f4\u52a0\u8282\u7701\u7a7a\u95f4\uff0c\u4f46\u7531\u4e8e\u9700\u8981\u901a\u8fc7\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u8fb9\uff0c\u56e0\u6b64\u65f6\u95f4\u6548\u7387\u8f83\u4f4e\u3002
  • \u5f53\u90bb\u63a5\u8868\u4e2d\u7684\u94fe\u8868\u8fc7\u957f\u65f6\uff0c\u53ef\u4ee5\u5c06\u5176\u8f6c\u5316\u4e3a\u7ea2\u9ed1\u6811\u6216\u54c8\u5e0c\u8868\uff0c\u4ece\u800c\u63d0\u5347\u67e5\u8be2\u6548\u7387\u3002
  • \u4ece\u7b97\u6cd5\u601d\u60f3\u89d2\u5ea6\u5206\u6790\uff0c\u90bb\u63a5\u77e9\u9635\u4f53\u73b0\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\uff0c\u90bb\u63a5\u8868\u4f53\u73b0\u201c\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u201d
  • \u56fe\u53ef\u4ee5\u7528\u4e8e\u5efa\u6a21\u5404\u7c7b\u73b0\u5b9e\u7cfb\u7edf\uff0c\u4f8b\u5982\u793e\u4ea4\u7f51\u7edc\u3001\u5730\u94c1\u7ebf\u8def\u7b49\u3002
  • \u6811\u662f\u56fe\u7684\u4e00\u79cd\u7279\u4f8b\uff0c\u6811\u7684\u904d\u5386\u4e5f\u662f\u56fe\u7684\u904d\u5386\u7684\u4e00\u79cd\u7279\u4f8b\u3002
  • \u56fe\u7684\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u7531\u8fd1\u53ca\u8fdc\u3001\u5c42\u5c42\u6269\u5f20\u7684\u641c\u7d22\u65b9\u5f0f\uff0c\u5e38\u501f\u52a9\u961f\u5217\u5b9e\u73b0\u3002
  • \u56fe\u7684\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u662f\u4e00\u79cd\u4f18\u5148\u8d70\u5230\u5e95\u3001\u65e0\u8def\u53ef\u8d70\u518d\u56de\u5934\u7684\u641c\u7d22\u65b9\u5f0f\uff0c\u5e38\u57fa\u4e8e\u9012\u5f52\u6765\u5b9e\u73b0\u3002
"},{"location":"chapter_hashing/hash_collision/","title":"6.2. \u00a0 \u54c8\u5e0c\u51b2\u7a81","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u54c8\u5e0c\u51fd\u6570\u5e94\u8be5\u4e3a\u6bcf\u4e2a\u8f93\u5165\u4ea7\u751f\u552f\u4e00\u7684\u8f93\u51fa\uff0c\u4f7f\u5f97 key \u548c value \u4e00\u4e00\u5bf9\u5e94\u3002\u800c\u5b9e\u9645\u4e0a\uff0c\u5f80\u5f80\u5b58\u5728\u5411\u54c8\u5e0c\u51fd\u6570\u8f93\u5165\u4e0d\u540c\u7684 key \u800c\u4ea7\u751f\u76f8\u540c\u8f93\u51fa\u7684\u60c5\u51b5\uff0c\u8fd9\u79cd\u60c5\u51b5\u88ab\u79f0\u4e3a\u300c\u54c8\u5e0c\u51b2\u7a81 Hash Collision\u300d\u3002\u54c8\u5e0c\u51b2\u7a81\u4f1a\u5bfc\u81f4\u67e5\u8be2\u7ed3\u679c\u9519\u8bef\uff0c\u4ece\u800c\u4e25\u91cd\u5f71\u54cd\u54c8\u5e0c\u8868\u7684\u53ef\u7528\u6027\u3002

\u90a3\u4e48\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\u5462\uff1f\u672c\u8d28\u4e0a\u770b\uff0c\u7531\u4e8e\u54c8\u5e0c\u51fd\u6570\u7684\u8f93\u5165\u7a7a\u95f4\u5f80\u5f80\u8fdc\u5927\u4e8e\u8f93\u51fa\u7a7a\u95f4\uff0c\u56e0\u6b64\u4e0d\u53ef\u907f\u514d\u5730\u4f1a\u51fa\u73b0\u591a\u4e2a\u8f93\u5165\u4ea7\u751f\u76f8\u540c\u8f93\u51fa\u7684\u60c5\u51b5\uff0c\u5373\u4e3a\u54c8\u5e0c\u51b2\u7a81\u3002\u6bd4\u5982\uff0c\u8f93\u5165\u7a7a\u95f4\u662f\u5168\u4f53\u6574\u6570\uff0c\u8f93\u51fa\u7a7a\u95f4\u662f\u4e00\u4e2a\u56fa\u5b9a\u5927\u5c0f\u7684\u6876\uff08\u6570\u7ec4\uff09\u7684\u7d22\u5f15\u8303\u56f4\uff0c\u90a3\u4e48\u5fc5\u5b9a\u4f1a\u6709\u591a\u4e2a\u6574\u6570\u540c\u65f6\u6620\u5c04\u5230\u4e00\u4e2a\u6876\u7d22\u5f15\u3002

\u4e3a\u4e86\u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\uff0c\u4e00\u65b9\u9762\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u54c8\u5e0c\u8868\u6269\u5bb9\u6765\u51cf\u5c0f\u51b2\u7a81\u6982\u7387\u3002\u6781\u7aef\u60c5\u51b5\u4e0b\uff0c\u5f53\u8f93\u5165\u7a7a\u95f4\u548c\u8f93\u51fa\u7a7a\u95f4\u5927\u5c0f\u76f8\u7b49\u65f6\uff0c\u54c8\u5e0c\u8868\u5c31\u7b49\u4ef7\u4e8e\u6570\u7ec4\u4e86\uff0c\u53ef\u8c13\u201c\u5927\u529b\u51fa\u5947\u8ff9\u201d\u3002

\u53e6\u4e00\u65b9\u9762\uff0c\u8003\u8651\u901a\u8fc7\u4f18\u5316\u54c8\u5e0c\u8868\u7684\u8868\u793a\u65b9\u5f0f\u4ee5\u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u6709\u300c\u94fe\u5f0f\u5730\u5740\u300d\u548c\u300c\u5f00\u653e\u5bfb\u5740\u300d\u3002

"},{"location":"chapter_hashing/hash_collision/#621","title":"6.2.1. \u00a0 \u54c8\u5e0c\u8868\u6269\u5bb9","text":"

\u300c\u8d1f\u8f7d\u56e0\u5b50 Load Factor\u300d\u5b9a\u4e49\u4e3a \u54c8\u5e0c\u8868\u4e2d\u5143\u7d20\u6570\u91cf\u9664\u4ee5\u6876\u69fd\u6570\u91cf\uff08\u5373\u6570\u7ec4\u5927\u5c0f\uff09\uff0c\u4ee3\u8868\u54c8\u5e0c\u51b2\u7a81\u7684\u4e25\u91cd\u7a0b\u5ea6\u3002

\u8d1f\u8f7d\u56e0\u5b50\u5e38\u7528\u4f5c\u54c8\u5e0c\u8868\u6269\u5bb9\u7684\u89e6\u53d1\u6761\u4ef6\u3002\u6bd4\u5982\u5728 Java \u4e2d\uff0c\u5f53\u8d1f\u8f7d\u56e0\u5b50 \\(> 0.75\\) \u65f6\u5219\u89e6\u53d1\u6269\u5bb9\uff0c\u5c06 HashMap \u5927\u5c0f\u6269\u5145\u81f3\u539f\u5148\u7684 \\(2\\) \u500d\u3002

\u4e0e\u6570\u7ec4\u6269\u5bb9\u7c7b\u4f3c\uff0c\u54c8\u5e0c\u8868\u6269\u5bb9\u64cd\u4f5c\u7684\u5f00\u9500\u5f88\u5927\uff0c\u56e0\u4e3a\u9700\u8981\u5c06\u6240\u6709\u952e\u503c\u5bf9\u4ece\u539f\u54c8\u5e0c\u8868\u4f9d\u6b21\u79fb\u52a8\u81f3\u65b0\u54c8\u5e0c\u8868\u3002

"},{"location":"chapter_hashing/hash_collision/#622","title":"6.2.2. \u00a0 \u94fe\u5f0f\u5730\u5740","text":"

\u5728\u539f\u59cb\u54c8\u5e0c\u8868\u4e2d\uff0c\u6876\u5185\u7684\u6bcf\u4e2a\u5730\u5740\u53ea\u80fd\u5b58\u50a8\u4e00\u4e2a\u5143\u7d20\uff08\u5373\u952e\u503c\u5bf9\uff09\u3002\u8003\u8651\u5c06\u5355\u4e2a\u5143\u7d20\u8f6c\u5316\u6210\u4e00\u4e2a\u94fe\u8868\uff0c\u5c06\u6240\u6709\u51b2\u7a81\u5143\u7d20\u90fd\u5b58\u50a8\u5728\u4e00\u4e2a\u94fe\u8868\u4e2d\u3002

Fig. \u94fe\u5f0f\u5730\u5740

\u94fe\u5f0f\u5730\u5740\u4e0b\uff0c\u54c8\u5e0c\u8868\u64cd\u4f5c\u65b9\u6cd5\u4e3a\uff1a

  • \u67e5\u8be2\u5143\u7d20\uff1a\u5148\u5c06 key \u8f93\u5165\u5230\u54c8\u5e0c\u51fd\u6570\u5f97\u5230\u6876\u5185\u7d22\u5f15\uff0c\u5373\u53ef\u8bbf\u95ee\u94fe\u8868\u5934\u7ed3\u70b9\uff0c\u518d\u901a\u8fc7\u904d\u5386\u94fe\u8868\u67e5\u627e\u5bf9\u5e94 value \u3002
  • \u6dfb\u52a0\u5143\u7d20\uff1a\u5148\u901a\u8fc7\u54c8\u5e0c\u51fd\u6570\u8bbf\u95ee\u94fe\u8868\u5934\u90e8\uff0c\u518d\u5c06\u7ed3\u70b9\uff08\u5373\u952e\u503c\u5bf9\uff09\u6dfb\u52a0\u5230\u94fe\u8868\u5934\u90e8\u5373\u53ef\u3002
  • \u5220\u9664\u5143\u7d20\uff1a\u540c\u6837\u5148\u6839\u636e\u54c8\u5e0c\u51fd\u6570\u7ed3\u679c\u8bbf\u95ee\u94fe\u8868\u5934\u90e8\uff0c\u518d\u904d\u5386\u94fe\u8868\u67e5\u627e\u5bf9\u5e94\u7ed3\u70b9\uff0c\u5220\u9664\u4e4b\u5373\u53ef\u3002

\u94fe\u5f0f\u5730\u5740\u867d\u7136\u89e3\u51b3\u4e86\u54c8\u5e0c\u51b2\u7a81\u95ee\u9898\uff0c\u4f46\u4ecd\u5b58\u5728\u5c40\u9650\u6027\uff0c\u5305\u62ec\uff1a

  • \u5360\u7528\u7a7a\u95f4\u53d8\u5927\uff0c\u56e0\u4e3a\u94fe\u8868\u6216\u4e8c\u53c9\u6811\u5305\u542b\u7ed3\u70b9\u6307\u9488\uff0c\u76f8\u6bd4\u4e8e\u6570\u7ec4\u66f4\u52a0\u8017\u8d39\u5185\u5b58\u7a7a\u95f4\uff1b
  • \u67e5\u8be2\u6548\u7387\u964d\u4f4e\uff0c\u56e0\u4e3a\u9700\u8981\u7ebf\u6027\u904d\u5386\u94fe\u8868\u6765\u67e5\u627e\u5bf9\u5e94\u5143\u7d20\uff1b

\u4e3a\u4e86\u63d0\u5347\u64cd\u4f5c\u6548\u7387\uff0c\u53ef\u4ee5\u628a\u300c\u94fe\u8868\u300d\u8f6c\u5316\u4e3a\u300cAVL \u6811\u300d\u6216\u300c\u7ea2\u9ed1\u6811\u300d\uff0c\u5c06\u67e5\u8be2\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(\\log n)\\) \u3002

"},{"location":"chapter_hashing/hash_collision/#623","title":"6.2.3. \u00a0 \u5f00\u653e\u5bfb\u5740","text":"

\u300c\u5f00\u653e\u5bfb\u5740\u300d\u4e0d\u5f15\u5165\u989d\u5916\u6570\u636e\u7ed3\u6784\uff0c\u800c\u662f\u901a\u8fc7\u201c\u591a\u6b21\u63a2\u6d4b\u201d\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u6839\u636e\u63a2\u6d4b\u65b9\u6cd5\u7684\u4e0d\u540c\uff0c\u4e3b\u8981\u5206\u4e3a \u7ebf\u6027\u63a2\u6d4b\u3001\u5e73\u65b9\u63a2\u6d4b\u3001\u591a\u6b21\u54c8\u5e0c\u3002

"},{"location":"chapter_hashing/hash_collision/#_1","title":"\u7ebf\u6027\u63a2\u6d4b","text":"

\u300c\u7ebf\u6027\u63a2\u6d4b\u300d\u4f7f\u7528\u56fa\u5b9a\u6b65\u957f\u7684\u7ebf\u6027\u67e5\u627e\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002

\u63d2\u5165\u5143\u7d20\uff1a\u5982\u679c\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\uff0c\u5219\u4ece\u51b2\u7a81\u4f4d\u7f6e\u5411\u540e\u7ebf\u6027\u904d\u5386\uff08\u6b65\u957f\u4e00\u822c\u53d6 1 \uff09\uff0c\u76f4\u5230\u627e\u5230\u4e00\u4e2a\u7a7a\u4f4d\uff0c\u5219\u5c06\u5143\u7d20\u63d2\u5165\u5230\u8be5\u7a7a\u4f4d\u4e2d\u3002

\u67e5\u627e\u5143\u7d20\uff1a\u82e5\u51fa\u73b0\u54c8\u5e0c\u51b2\u7a81\uff0c\u5219\u4f7f\u7528\u76f8\u540c\u6b65\u957f\u6267\u884c\u7ebf\u6027\u67e5\u627e\uff0c\u4f1a\u9047\u5230\u4e24\u79cd\u60c5\u51b5\uff1a

  1. \u627e\u5230\u5bf9\u5e94\u5143\u7d20\uff0c\u8fd4\u56de value \u5373\u53ef\uff1b
  2. \u82e5\u9047\u5230\u7a7a\u4f4d\uff0c\u5219\u8bf4\u660e\u67e5\u627e\u952e\u503c\u5bf9\u4e0d\u5728\u54c8\u5e0c\u8868\u4e2d\uff1b

Fig. \u7ebf\u6027\u63a2\u6d4b

\u7ebf\u6027\u63a2\u6d4b\u5b58\u5728\u4ee5\u4e0b\u7f3a\u9677\uff1a

  • \u4e0d\u80fd\u76f4\u63a5\u5220\u9664\u5143\u7d20\u3002\u5220\u9664\u5143\u7d20\u4f1a\u5bfc\u81f4\u6876\u5185\u51fa\u73b0\u4e00\u4e2a\u7a7a\u4f4d\uff0c\u5728\u67e5\u627e\u5176\u4ed6\u5143\u7d20\u65f6\uff0c\u8be5\u7a7a\u4f4d\u6709\u53ef\u80fd\u5bfc\u81f4\u7a0b\u5e8f\u8ba4\u4e3a\u5143\u7d20\u4e0d\u5b58\u5728\uff08\u5373\u4e0a\u8ff0\u7b2c 2. \u79cd\u60c5\u51b5\uff09\u3002\u56e0\u6b64\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u6807\u5fd7\u4f4d\u6765\u6807\u8bb0\u5220\u9664\u5143\u7d20\u3002
  • \u5bb9\u6613\u4ea7\u751f\u805a\u96c6\u3002\u6876\u5185\u88ab\u5360\u7528\u7684\u8fde\u7eed\u4f4d\u7f6e\u8d8a\u957f\uff0c\u8fd9\u4e9b\u8fde\u7eed\u4f4d\u7f6e\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\u7684\u53ef\u80fd\u6027\u8d8a\u5927\uff0c\u4ece\u800c\u8fdb\u4e00\u6b65\u4fc3\u8fdb\u8fd9\u4e00\u4f4d\u7f6e\u7684\u201c\u805a\u5806\u751f\u957f\u201d\uff0c\u6700\u7ec8\u5bfc\u81f4\u589e\u5220\u67e5\u6539\u64cd\u4f5c\u6548\u7387\u7684\u52a3\u5316\u3002
"},{"location":"chapter_hashing/hash_collision/#_2","title":"\u591a\u6b21\u54c8\u5e0c","text":"

\u987e\u540d\u601d\u4e49\uff0c\u300c\u591a\u6b21\u54c8\u5e0c\u300d\u7684\u601d\u8def\u662f\u4f7f\u7528\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570 \\(f_1(x)\\) , \\(f_2(x)\\) , \\(f_3(x)\\) , \\(\\cdots\\) \u8fdb\u884c\u63a2\u6d4b\u3002

\u63d2\u5165\u5143\u7d20\uff1a\u82e5\u54c8\u5e0c\u51fd\u6570 \\(f_1(x)\\) \u51fa\u73b0\u51b2\u7a81\uff0c\u5219\u5c1d\u8bd5 \\(f_2(x)\\) \uff0c\u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u76f4\u5230\u627e\u5230\u7a7a\u4f4d\u540e\u63d2\u5165\u5143\u7d20\u3002

\u67e5\u627e\u5143\u7d20\uff1a\u4ee5\u76f8\u540c\u7684\u54c8\u5e0c\u51fd\u6570\u987a\u5e8f\u67e5\u627e\uff0c\u5b58\u5728\u4e24\u79cd\u60c5\u51b5\uff1a

  1. \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u5219\u8fd4\u56de\u4e4b\uff1b
  2. \u5230\u7a7a\u4f4d\u6216\u5df2\u5c1d\u8bd5\u6240\u6709\u54c8\u5e0c\u51fd\u6570\uff0c\u8bf4\u660e\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64\u5143\u7d20\uff1b

\u76f8\u6bd4\u4e8e\u300c\u7ebf\u6027\u63a2\u6d4b\u300d\uff0c\u300c\u591a\u6b21\u54c8\u5e0c\u300d\u65b9\u6cd5\u66f4\u4e0d\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\uff0c\u4ee3\u4ef7\u662f\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u589e\u52a0\u4e86\u989d\u5916\u8ba1\u7b97\u91cf\u3002

\u5de5\u4e1a\u754c\u65b9\u6848

Java \u91c7\u7528\u300c\u94fe\u5f0f\u5730\u5740\u300d\u3002\u5728 JDK 1.8 \u4e4b\u540e\uff0cHashMap \u5185\u6570\u7ec4\u957f\u5ea6\u5927\u4e8e 64 \u65f6\uff0c\u957f\u5ea6\u5927\u4e8e 8 \u7684\u94fe\u8868\u4f1a\u88ab\u8f6c\u5316\u4e3a\u300c\u7ea2\u9ed1\u6811\u300d\uff0c\u4ee5\u63d0\u5347\u67e5\u627e\u6027\u80fd\u3002

Python \u91c7\u7528\u300c\u5f00\u653e\u5bfb\u5740\u300d\u3002\u5b57\u5178 dict \u4f7f\u7528\u4f2a\u968f\u673a\u6570\u8fdb\u884c\u63a2\u6d4b\u3002

"},{"location":"chapter_hashing/hash_map/","title":"6.1. \u00a0 \u54c8\u5e0c\u8868","text":"

\u54c8\u5e0c\u8868\u901a\u8fc7\u5efa\u7acb\u300c\u952e key\u300d\u548c\u300c\u503c value\u300d\u4e4b\u95f4\u7684\u6620\u5c04\uff0c\u5b9e\u73b0\u9ad8\u6548\u7684\u5143\u7d20\u67e5\u627e\u3002\u5177\u4f53\u5730\uff0c\u8f93\u5165\u4e00\u4e2a key \uff0c\u5728\u54c8\u5e0c\u8868\u4e2d\u67e5\u8be2\u5e76\u83b7\u53d6 value \uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \u3002

\u4f8b\u5982\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u5305\u542b \\(n\\) \u4e2a\u5b66\u751f\u7684\u6570\u636e\u5e93\uff0c\u6bcf\u4e2a\u5b66\u751f\u6709\u201c\u59d3\u540d name \u201d\u548c\u201c\u5b66\u53f7 id \u201d\u4e24\u9879\u6570\u636e\uff0c\u5e0c\u671b\u5b9e\u73b0\u4e00\u4e2a\u67e5\u8be2\u529f\u80fd\uff1a\u8f93\u5165\u4e00\u4e2a\u5b66\u53f7\uff0c\u8fd4\u56de\u5bf9\u5e94\u7684\u59d3\u540d\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u54c8\u5e0c\u8868\u5b9e\u73b0\u3002

Fig. \u54c8\u5e0c\u8868\u7684\u62bd\u8c61\u8868\u793a

"},{"location":"chapter_hashing/hash_map/#611","title":"6.1.1. \u00a0 \u54c8\u5e0c\u8868\u6548\u7387","text":"

\u9664\u4e86\u54c8\u5e0c\u8868\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6570\u636e\u7ed3\u6784\u6765\u5b9e\u73b0\u4e0a\u8ff0\u67e5\u8be2\u529f\u80fd\uff1a

  1. \u65e0\u5e8f\u6570\u7ec4\uff1a\u6bcf\u4e2a\u5143\u7d20\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff1b
  2. \u6709\u5e8f\u6570\u7ec4\uff1a\u5c06 1. \u4e2d\u7684\u6570\u7ec4\u6309\u7167\u5b66\u53f7\u4ece\u5c0f\u5230\u5927\u6392\u5e8f\uff1b
  3. \u94fe\u8868\uff1a\u6bcf\u4e2a\u7ed3\u70b9\u7684\u503c\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff1b
  4. \u4e8c\u53c9\u641c\u7d22\u6811\uff1a\u6bcf\u4e2a\u7ed3\u70b9\u7684\u503c\u4e3a [\u5b66\u53f7, \u59d3\u540d] \uff0c\u6839\u636e\u5b66\u53f7\u5927\u5c0f\u6765\u6784\u5efa\u6811\uff1b

\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5982\u4e0b\u8868\u6240\u793a\uff08\u5728\u6b64\u4e0d\u505a\u8d58\u8ff0\uff0c\u8be6\u89e3\u53ef\u89c1 \u4e8c\u53c9\u641c\u7d22\u6811\u7ae0\u8282\uff09\u3002\u65e0\u8bba\u662f\u67e5\u627e\u5143\u7d20\u3001\u8fd8\u662f\u589e\u5220\u5143\u7d20\uff0c\u54c8\u5e0c\u8868\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f \\(O(1)\\) \uff0c\u5168\u9762\u80dc\u51fa\uff01

\u65e0\u5e8f\u6570\u7ec4 \u6709\u5e8f\u6570\u7ec4 \u94fe\u8868 \u4e8c\u53c9\u641c\u7d22\u6811 \u54c8\u5e0c\u8868 \u67e5\u627e\u5143\u7d20 \\(O(n)\\) \\(O(\\log n)\\) \\(O(n)\\) \\(O(\\log n)\\) \\(O(1)\\) \u63d2\u5165\u5143\u7d20 \\(O(1)\\) \\(O(n)\\) \\(O(1)\\) \\(O(\\log n)\\) \\(O(1)\\) \u5220\u9664\u5143\u7d20 \\(O(n)\\) \\(O(n)\\) \\(O(n)\\) \\(O(\\log n)\\) \\(O(1)\\)"},{"location":"chapter_hashing/hash_map/#612","title":"6.1.2. \u00a0 \u54c8\u5e0c\u8868\u5e38\u7528\u64cd\u4f5c","text":"

\u54c8\u5e0c\u8868\u7684\u57fa\u672c\u64cd\u4f5c\u5305\u62ec \u521d\u59cb\u5316\u3001\u67e5\u8be2\u64cd\u4f5c\u3001\u6dfb\u52a0\u4e0e\u5220\u9664\u952e\u503c\u5bf9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hash_map.java
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nMap<Integer, String> map = new HashMap<>();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.put(12836, \"\u5c0f\u54c8\");   map.put(15937, \"\u5c0f\u5570\");   map.put(16750, \"\u5c0f\u7b97\");   map.put(13276, \"\u5c0f\u6cd5\");\nmap.put(10583, \"\u5c0f\u9e2d\");\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nString name = map.get(15937);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.remove(10583);\n
hash_map.cpp
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nunordered_map<int, string> map;\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap[12836] = \"\u5c0f\u54c8\";\nmap[15937] = \"\u5c0f\u5570\";\nmap[16750] = \"\u5c0f\u7b97\";\nmap[13276] = \"\u5c0f\u6cd5\";\nmap[10583] = \"\u5c0f\u9e2d\";\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nstring name = map[15937];\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.erase(10583);\n
hash_map.py
\"\"\" \u521d\u59cb\u5316\u54c8\u5e0c\u8868 \"\"\"\nmapp: Dict = {}\n\"\"\" \u6dfb\u52a0\u64cd\u4f5c \"\"\"\n# \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmapp[12836] = \"\u5c0f\u54c8\"\nmapp[15937] = \"\u5c0f\u5570\"\nmapp[16750] = \"\u5c0f\u7b97\"\nmapp[13276] = \"\u5c0f\u6cd5\"\nmapp[10583] = \"\u5c0f\u9e2d\"\n\"\"\" \u67e5\u8be2\u64cd\u4f5c \"\"\"\n# \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nname: str = mapp[15937]\n\"\"\" \u5220\u9664\u64cd\u4f5c \"\"\"\n# \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmapp.pop(10583)\n
hash_map.go
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nmapp := make(map[int]string)\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmapp[12836] = \"\u5c0f\u54c8\"\nmapp[15937] = \"\u5c0f\u5570\"\nmapp[16750] = \"\u5c0f\u7b97\"\nmapp[13276] = \"\u5c0f\u6cd5\"\nmapp[10583] = \"\u5c0f\u9e2d\"\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nname := mapp[15937]\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\ndelete(mapp, 10583)\n
hash_map.js
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nconst map = new ArrayHashMap();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.set(12836, '\u5c0f\u54c8');\nmap.set(15937, '\u5c0f\u5570');\nmap.set(16750, '\u5c0f\u7b97');\nmap.set(13276, '\u5c0f\u6cd5');\nmap.set(10583, '\u5c0f\u9e2d');\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map.get(15937);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.delete(10583);\n
hash_map.ts
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nconst map = new Map<number, string>();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.set(12836, '\u5c0f\u54c8');\nmap.set(15937, '\u5c0f\u5570');\nmap.set(16750, '\u5c0f\u7b97');\nmap.set(13276, '\u5c0f\u6cd5');\nmap.set(10583, '\u5c0f\u9e2d');\nconsole.info('\\n\u6dfb\u52a0\u5b8c\u6210\u540e\uff0c\u54c8\u5e0c\u8868\u4e3a\\nKey -> Value');\nconsole.info(map);\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map.get(15937);\nconsole.info('\\n\u8f93\u5165\u5b66\u53f7 15937 \uff0c\u67e5\u8be2\u5230\u59d3\u540d ' + name);\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.delete(10583);\nconsole.info('\\n\u5220\u9664 10583 \u540e\uff0c\u54c8\u5e0c\u8868\u4e3a\\nKey -> Value');\nconsole.info(map);\n
hash_map.c
\n
hash_map.cs
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nDictionary<int, String> map = new ();\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap.Add(12836, \"\u5c0f\u54c8\");\nmap.Add(15937, \"\u5c0f\u5570\");\nmap.Add(16750, \"\u5c0f\u7b97\");\nmap.Add(13276, \"\u5c0f\u6cd5\");\nmap.Add(10583, \"\u5c0f\u9e2d\");\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nString name = map[15937];\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.Remove(10583);\n
hash_map.swift
/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nvar map: [Int: String] = [:]\n/* \u6dfb\u52a0\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u952e\u503c\u5bf9 (key, value)\nmap[12836] = \"\u5c0f\u54c8\"\nmap[15937] = \"\u5c0f\u5570\"\nmap[16750] = \"\u5c0f\u7b97\"\nmap[13276] = \"\u5c0f\u6cd5\"\nmap[10583] = \"\u5c0f\u9e2d\"\n/* \u67e5\u8be2\u64cd\u4f5c */\n// \u5411\u54c8\u5e0c\u8868\u8f93\u5165\u952e key \uff0c\u5f97\u5230\u503c value\nlet name = map[15937]!\n/* \u5220\u9664\u64cd\u4f5c */\n// \u5728\u54c8\u5e0c\u8868\u4e2d\u5220\u9664\u952e\u503c\u5bf9 (key, value)\nmap.removeValue(forKey: 10583)\n
hash_map.zig
\n

\u904d\u5386\u54c8\u5e0c\u8868\u6709\u4e09\u79cd\u65b9\u5f0f\uff0c\u5373 \u904d\u5386\u952e\u503c\u5bf9\u3001\u904d\u5386\u952e\u3001\u904d\u5386\u503c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hash_map.java
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor (Map.Entry <Integer, String> kv: map.entrySet()) {\nSystem.out.println(kv.getKey() + \" -> \" + kv.getValue());\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor (int key: map.keySet()) {\nSystem.out.println(key);\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor (String val: map.values()) {\nSystem.out.println(val);\n}\n
hash_map.cpp
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor (auto kv: map) {\ncout << kv.first << \" -> \" << kv.second << endl;\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor (auto key: map) {\ncout << key.first << endl;\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor (auto val: map) {\ncout << val.second << endl;\n}\n
hash_map.py
\"\"\" \u904d\u5386\u54c8\u5e0c\u8868 \"\"\"\n# \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor key, value in mapp.items():\nprint(key, \"->\", value)\n# \u5355\u72ec\u904d\u5386\u952e key\nfor key in mapp.keys():\nprint(key)\n# \u5355\u72ec\u904d\u5386\u503c value\nfor value in mapp.values():\nprint(value)\n
hash_map_test.go
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 key->value\nfor key, value := range mapp {\nfmt.Println(key, \"->\", value)\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nfor key := range mapp {\nfmt.Println(key)\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nfor _, value := range mapp {\nfmt.Println(value)\n}\n
hash_map.js
/* \u904d\u5386\u54c8\u5e0c\u8868 */\nconsole.info('\\n\u904d\u5386\u952e\u503c\u5bf9 Key->Value');\nfor (const [k, v] of map.entries()) {\nconsole.info(k + ' -> ' + v);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u952e Key');\nfor (const k of map.keys()) {\nconsole.info(k);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u503c Value');\nfor (const v of map.values()) {\nconsole.info(v);\n}\n
hash_map.ts
/* \u904d\u5386\u54c8\u5e0c\u8868 */\nconsole.info('\\n\u904d\u5386\u952e\u503c\u5bf9 Key->Value');\nfor (const [k, v] of map.entries()) {\nconsole.info(k + ' -> ' + v);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u952e Key');\nfor (const k of map.keys()) {\nconsole.info(k);\n}\nconsole.info('\\n\u5355\u72ec\u904d\u5386\u503c Value');\nfor (const v of map.values()) {\nconsole.info(v);\n}\n
hash_map.c
\n
hash_map.cs
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 Key->Value\nforeach (var kv in map)\n{\nConsole.WriteLine(kv.Key + \" -> \" + kv.Value);\n}\n// \u5355\u72ec\u904d\u5386\u952e key\nforeach (int key in map.Keys)\n{\nConsole.WriteLine(key);\n}\n// \u5355\u72ec\u904d\u5386\u503c value\nforeach (String val in map.Values)\n{\nConsole.WriteLine(val);\n}\n
hash_map.swift
/* \u904d\u5386\u54c8\u5e0c\u8868 */\n// \u904d\u5386\u952e\u503c\u5bf9 Key->Value\nfor (key, value) in map {\nprint(\"\\(key) -> \\(value)\")\n}\n// \u5355\u72ec\u904d\u5386\u952e Key\nfor key in map.keys {\nprint(key)\n}\n// \u5355\u72ec\u904d\u5386\u503c Value\nfor value in map.values {\nprint(value)\n}\n
hash_map.zig
\n
"},{"location":"chapter_hashing/hash_map/#613","title":"6.1.3. \u00a0 \u54c8\u5e0c\u51fd\u6570","text":"

\u54c8\u5e0c\u8868\u4e2d\u5b58\u50a8\u5143\u7d20\u7684\u6570\u636e\u7ed3\u6784\u88ab\u79f0\u4e3a\u300c\u6876 Bucket\u300d\uff0c\u5e95\u5c42\u5b9e\u73b0\u53ef\u80fd\u662f\u6570\u7ec4\u3001\u94fe\u8868\u3001\u4e8c\u53c9\u6811\uff08\u7ea2\u9ed1\u6811\uff09\uff0c\u6216\u662f\u5b83\u4eec\u7684\u7ec4\u5408\u3002

\u6700\u7b80\u5355\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u4ec5\u7528\u4e00\u4e2a\u300c\u6570\u7ec4\u300d\u6765\u5b9e\u73b0\u54c8\u5e0c\u8868\u3002\u9996\u5148\uff0c\u5c06\u6240\u6709 value \u653e\u5165\u6570\u7ec4\u4e2d\uff0c\u90a3\u4e48\u6bcf\u4e2a value \u5728\u6570\u7ec4\u4e2d\u90fd\u6709\u552f\u4e00\u7684\u300c\u7d22\u5f15\u300d\u3002\u663e\u7136\uff0c\u8bbf\u95ee value \u9700\u8981\u7ed9\u5b9a\u7d22\u5f15\uff0c\u800c\u4e3a\u4e86 \u5efa\u7acb key \u548c\u7d22\u5f15\u4e4b\u95f4\u7684\u6620\u5c04\u5173\u7cfb\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u300c\u54c8\u5e0c\u51fd\u6570 Hash Function\u300d\u3002

\u8bbe\u6570\u7ec4\u4e3a bucket \uff0c\u54c8\u5e0c\u51fd\u6570\u4e3a f(x) \uff0c\u8f93\u5165\u952e\u4e3a key \u3002\u90a3\u4e48\u83b7\u53d6 value \u7684\u6b65\u9aa4\u4e3a\uff1a

  1. \u901a\u8fc7\u54c8\u5e0c\u51fd\u6570\u8ba1\u7b97\u51fa\u7d22\u5f15\uff0c\u5373 index = f(key) \uff1b
  2. \u901a\u8fc7\u7d22\u5f15\u5728\u6570\u7ec4\u4e2d\u83b7\u53d6\u503c\uff0c\u5373 value = bucket[index] \uff1b

\u4ee5\u4e0a\u8ff0\u5b66\u751f\u6570\u636e key \u5b66\u53f7 -> value \u59d3\u540d \u4e3a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u300c\u54c8\u5e0c\u51fd\u6570\u300d\u8bbe\u8ba1\u4e3a

\\[ f(x) = x \\% 100 \\]

Fig. \u7b80\u5355\u54c8\u5e0c\u51fd\u6570\u793a\u4f8b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_hash_map.java
/* \u952e\u503c\u5bf9 int->String */\nclass Entry {\npublic int key;\npublic String val;\npublic Entry(int key, String val) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate List<Entry> bucket;\npublic ArrayHashMap() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket = new ArrayList<>();\nfor (int i = 0; i < 100; i++) {\nbucket.add(null);\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate int hashFunc(int key) {\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic String get(int key) {\nint index = hashFunc(key);\nEntry pair = bucket.get(index);\nif (pair == null) return null;\nreturn pair.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic void put(int key, String val) {\nEntry pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket.set(index, pair);\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic void remove(int key) {\nint index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nbucket.set(index, null);\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic List<Entry> entrySet() {\nList<Entry> entrySet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nentrySet.add(pair);\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic List<Integer> keySet() {\nList<Integer> keySet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nkeySet.add(pair.key);\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic List<String> valueSet() {\nList<String> valueSet = new ArrayList<>();\nfor (Entry pair : bucket) {\nif (pair != null)\nvalueSet.add(pair.val);\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic void print() {\nfor (Entry kv: entrySet()) {\nSystem.out.println(kv.key + \" -> \" + kv.val);\n}\n}\n}\n
array_hash_map.cpp
/* \u952e\u503c\u5bf9 int->String */\nstruct Entry {\npublic:\nint key;\nstring val;\nEntry(int key, string val) {\nthis->key = key;\nthis->val = val;\n}\n};\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate:\nvector<Entry*> bucket;\npublic:\nArrayHashMap() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket= vector<Entry*>(100);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nint hashFunc(int key) {\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nstring get(int key) {\nint index = hashFunc(key);\nEntry* pair = bucket[index];\nif (pair == nullptr)\nreturn nullptr;\nreturn pair->val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nvoid put(int key, string val) {\nEntry* pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket[index] = pair;\n}\n/* \u5220\u9664\u64cd\u4f5c */\nvoid remove(int key) {\nint index = hashFunc(key);\n// \u7f6e\u4e3a nullptr \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = nullptr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nvector<Entry*> entrySet() {\nvector<Entry*> entrySet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr) {\nentrySet.push_back(pair);\n}\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nvector<int> keySet() {\nvector<int> keySet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr) {\nkeySet.push_back(pair->key);\n}\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nvector<string> valueSet() {\nvector<string> valueSet;\nfor (Entry* pair: bucket) {\nif (pair != nullptr){\nvalueSet.push_back(pair->val);\n}\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nvoid print() {\nfor (Entry* kv: entrySet()) {\ncout << kv->key << \" -> \" << kv->val << endl;\n}\n}\n};\n
array_hash_map.py
class Entry:\n\"\"\" \u952e\u503c\u5bf9 int->String \"\"\"\ndef __init__(self, key: int, val: str):\nself.key = key\nself.val = val\nclass ArrayHashMap:\n\"\"\" \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nself.bucket: List[Optional[Entry]] = [None] * 100\ndef hash_func(self, key: int) -> int:\n\"\"\" \u54c8\u5e0c\u51fd\u6570 \"\"\"\nindex: int = key % 100\nreturn index\ndef get(self, key: int) -> str:\n\"\"\" \u67e5\u8be2\u64cd\u4f5c \"\"\"\nindex: int = self.hash_func(key)\npair: Entry = self.bucket[index]\nif pair is None:\nreturn None\nreturn pair.val\ndef put(self, key: int, val: str) -> None:\n\"\"\" \u6dfb\u52a0\u64cd\u4f5c \"\"\"\npair = Entry(key, val)\nindex: int = self.hash_func(key)\nself.bucket[index] = pair\ndef remove(self, key: int) -> None:\n\"\"\" \u5220\u9664\u64cd\u4f5c \"\"\"\nindex: int = self.hash_func(key)\n# \u7f6e\u4e3a None \uff0c\u4ee3\u8868\u5220\u9664\nself.bucket[index] = None\ndef entry_set(self) -> List[Entry]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 \"\"\"\nresult: List[Entry] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair)\nreturn result\ndef key_set(self) -> List[int]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u952e \"\"\"\nresult: List[int] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair.key)\nreturn result\ndef value_set(self) -> List[str]:\n\"\"\" \u83b7\u53d6\u6240\u6709\u503c \"\"\"\nresult: List[str] = []\nfor pair in self.bucket:\nif pair is not None:\nresult.append(pair.val)\nreturn result\ndef print(self) -> None:\n\"\"\" \u6253\u5370\u54c8\u5e0c\u8868 \"\"\"\nfor pair in self.bucket:\nif pair is not None:\nprint(pair.key, \"->\", pair.val)\n
array_hash_map.go
/* \u952e\u503c\u5bf9 int->String */\ntype entry struct {\nkey int\nval string\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\ntype arrayHashMap struct {\nbucket []*entry\n}\n/* \u521d\u59cb\u5316\u54c8\u5e0c\u8868 */\nfunc newArrayHashMap() *arrayHashMap {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket := make([]*entry, 100)\nreturn &arrayHashMap{bucket: bucket}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nfunc (a *arrayHashMap) hashFunc(key int) int {\nindex := key % 100\nreturn index\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nfunc (a *arrayHashMap) get(key int) string {\nindex := a.hashFunc(key)\npair := a.bucket[index]\nif pair == nil {\nreturn \"Not Found\"\n}\nreturn pair.val\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nfunc (a *arrayHashMap) put(key int, val string) {\npair := &entry{key: key, val: val}\nindex := a.hashFunc(key)\na.bucket[index] = pair\n}\n/* \u5220\u9664\u64cd\u4f5c */\nfunc (a *arrayHashMap) remove(key int) {\nindex := a.hashFunc(key)\n// \u7f6e\u4e3a nil \uff0c\u4ee3\u8868\u5220\u9664\na.bucket[index] = nil\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u5bf9 */\nfunc (a *arrayHashMap) entrySet() []*entry {\nvar pairs []*entry\nfor _, pair := range a.bucket {\nif pair != nil {\npairs = append(pairs, pair)\n}\n}\nreturn pairs\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nfunc (a *arrayHashMap) keySet() []int {\nvar keys []int\nfor _, pair := range a.bucket {\nif pair != nil {\nkeys = append(keys, pair.key)\n}\n}\nreturn keys\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nfunc (a *arrayHashMap) valueSet() []string {\nvar values []string\nfor _, pair := range a.bucket {\nif pair != nil {\nvalues = append(values, pair.val)\n}\n}\nreturn values\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nfunc (a *arrayHashMap) print() {\nfor _, pair := range a.bucket {\nif pair != nil {\nfmt.Println(pair.key, \"->\", pair.val)\n}\n}\n}\n
array_hash_map.js
/* \u952e\u503c\u5bf9 Number -> String */\nclass Entry {\nconstructor(key, val) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\n#bucket;\nconstructor() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nthis.#bucket = new Array(100).fill(null);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\n#hashFunc(key) {\nreturn key % 100;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nget(key) {\nlet index = this.#hashFunc(key);\nlet entry = this.#bucket[index];\nif (entry === null) return null;\nreturn entry.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nset(key, val) {\nlet index = this.#hashFunc(key);\nthis.#bucket[index] = new Entry(key, val);\n}\n/* \u5220\u9664\u64cd\u4f5c */\ndelete(key) {\nlet index = this.#hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nthis.#bucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nentries() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nkeys() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]?.key);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nvalues() {\nlet arr = [];\nfor (let i = 0; i < this.#bucket.length; i++) {\nif (this.#bucket[i]) {\narr.push(this.#bucket[i]?.val);\n}\n}\nreturn arr;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nprint() {\nlet entrySet = this.entries();\nfor (const entry of entrySet) {\nif (!entry) continue;\nconsole.info(`${entry.key} -> ${entry.val}`);\n}\n}\n}\n
array_hash_map.ts
/* \u952e\u503c\u5bf9 Number -> String */\nclass Entry {\npublic key: number;\npublic val: string;\nconstructor(key: number, val: string) {\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate readonly bucket: (Entry | null)[];\nconstructor() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nthis.bucket = (new Array(100)).fill(null);\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate hashFunc(key: number): number {\nreturn key % 100;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic get(key: number): string | null {\nlet index = this.hashFunc(key);\nlet entry = this.bucket[index];\nif (entry === null) return null;\nreturn entry.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic set(key: number, val: string) {\nlet index = this.hashFunc(key);\nthis.bucket[index] = new Entry(key, val);\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic delete(key: number) {\nlet index = this.hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nthis.bucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic entries(): (Entry | null)[] {\nlet arr: (Entry | null)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic keys(): (number | undefined)[] {\nlet arr: (number | undefined)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]?.key);\n}\n}\nreturn arr;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic values(): (string | undefined)[] {\nlet arr: (string | undefined)[] = [];\nfor (let i = 0; i < this.bucket.length; i++) {\nif (this.bucket[i]) {\narr.push(this.bucket[i]?.val);\n}\n}\nreturn arr;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic print() {\nlet entrySet = this.entries();\nfor (const entry of entrySet) {\nif (!entry) continue;\nconsole.info(`${entry.key} -> ${entry.val}`);\n}\n}\n}\n
array_hash_map.c
[class]{entry}-[func]{}\n[class]{arrayHashMap}-[func]{}\n
array_hash_map.cs
/* \u952e\u503c\u5bf9 int->String */\nclass Entry\n{\npublic int key;\npublic String val;\npublic Entry(int key, String val)\n{\nthis.key = key;\nthis.val = val;\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap\n{\nprivate List<Entry?> bucket;\npublic ArrayHashMap()\n{\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nbucket = new();\nfor (int i = 0; i < 100; i++)\n{\nbucket.Add(null);\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate int hashFunc(int key)\n{\nint index = key % 100;\nreturn index;\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\npublic String? get(int key)\n{\nint index = hashFunc(key);\nEntry? pair = bucket[index];\nif (pair == null) return null;\nreturn pair.val;\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\npublic void put(int key, String val)\n{\nEntry pair = new Entry(key, val);\nint index = hashFunc(key);\nbucket[index] = pair;\n}\n/* \u5220\u9664\u64cd\u4f5c */\npublic void remove(int key)\n{\nint index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = null;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\npublic List<Entry> entrySet()\n{\nList<Entry> entrySet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nentrySet.Add(pair);\n}\nreturn entrySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\npublic List<int> keySet()\n{\nList<int> keySet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nkeySet.Add(pair.key);\n}\nreturn keySet;\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\npublic List<String> valueSet()\n{\nList<String> valueSet = new();\nforeach (Entry? pair in bucket)\n{\nif (pair != null)\nvalueSet.Add(pair.val);\n}\nreturn valueSet;\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\npublic void print()\n{\nforeach (Entry kv in entrySet())\n{\nConsole.WriteLine(kv.key + \" -> \" + kv.val);\n}\n}\n}\n
array_hash_map.swift
/* \u952e\u503c\u5bf9 int->String */\nclass Entry {\nvar key: Int\nvar val: String\ninit(key: Int, val: String) {\nself.key = key\nself.val = val\n}\n}\n/* \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868 */\nclass ArrayHashMap {\nprivate var bucket: [Entry?] = []\ninit() {\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nfor _ in 0 ..< 100 {\nbucket.append(nil)\n}\n}\n/* \u54c8\u5e0c\u51fd\u6570 */\nprivate func hashFunc(key: Int) -> Int {\nlet index = key % 100\nreturn index\n}\n/* \u67e5\u8be2\u64cd\u4f5c */\nfunc get(key: Int) -> String? {\nlet index = hashFunc(key: key)\nlet pair = bucket[index]\nreturn pair?.val\n}\n/* \u6dfb\u52a0\u64cd\u4f5c */\nfunc put(key: Int, val: String) {\nlet pair = Entry(key: key, val: val)\nlet index = hashFunc(key: key)\nbucket[index] = pair\n}\n/* \u5220\u9664\u64cd\u4f5c */\nfunc remove(key: Int) {\nlet index = hashFunc(key: key)\n// \u7f6e\u4e3a nil \uff0c\u4ee3\u8868\u5220\u9664\nbucket[index] = nil\n}\n/* \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9 */\nfunc entrySet() -> [Entry] {\nvar entrySet: [Entry] = []\nfor pair in bucket {\nif let pair = pair {\nentrySet.append(pair)\n}\n}\nreturn entrySet\n}\n/* \u83b7\u53d6\u6240\u6709\u952e */\nfunc keySet() -> [Int] {\nvar keySet: [Int] = []\nfor pair in bucket {\nif let pair = pair {\nkeySet.append(pair.key)\n}\n}\nreturn keySet\n}\n/* \u83b7\u53d6\u6240\u6709\u503c */\nfunc valueSet() -> [String] {\nvar valueSet: [String] = []\nfor pair in bucket {\nif let pair = pair {\nvalueSet.append(pair.val)\n}\n}\nreturn valueSet\n}\n/* \u6253\u5370\u54c8\u5e0c\u8868 */\nfunc print() {\nfor entry in entrySet() {\nSwift.print(\"\\(entry.key) -> \\(entry.val)\")\n}\n}\n}\n
array_hash_map.zig
// \u952e\u503c\u5bf9 int->String\nconst Entry = struct {\nkey: usize = undefined,\nval: []const u8 = undefined,\npub fn init(key: usize, val: []const u8) Entry {\nreturn Entry {\n.key = key,\n.val = val,\n};\n}\n};\n// \u57fa\u4e8e\u6570\u7ec4\u7b80\u6613\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868\nfn ArrayHashMap(comptime T: type) type {\nreturn struct {\nbucket: ?std.ArrayList(?T) = null,\nmem_allocator: std.mem.Allocator = undefined,\nconst Self = @This();\n// \u6784\u9020\u65b9\u6cd5\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nself.mem_allocator = allocator;\n// \u521d\u59cb\u5316\u4e00\u4e2a\u957f\u5ea6\u4e3a 100 \u7684\u6876\uff08\u6570\u7ec4\uff09\nself.bucket = std.ArrayList(?T).init(self.mem_allocator);\nvar i: i32 = 0;\nwhile (i < 100) : (i += 1) {\ntry self.bucket.?.append(null);\n}\n}\n// \u6790\u6784\u65b9\u6cd5\npub fn deinit(self: *Self) void {\nif (self.bucket != null) self.bucket.?.deinit();\n}\n// \u54c8\u5e0c\u51fd\u6570\nfn hashFunc(key: usize) usize {\nvar index = key % 100;\nreturn index;\n}\n// \u67e5\u8be2\u64cd\u4f5c\npub fn get(self: *Self, key: usize) []const u8 {\nvar index = hashFunc(key);\nvar pair = self.bucket.?.items[index];\nreturn pair.?.val;\n}\n// \u6dfb\u52a0\u64cd\u4f5c\npub fn put(self: *Self, key: usize, val: []const u8) !void {\nvar pair = Entry.init(key, val);\nvar index = hashFunc(key);\nself.bucket.?.items[index] = pair;\n}\n// \u5220\u9664\u64cd\u4f5c\npub fn remove(self: *Self, key: usize) !void {\nvar index = hashFunc(key);\n// \u7f6e\u4e3a null \uff0c\u4ee3\u8868\u5220\u9664\nself.bucket.?.items[index] = null;\n}       // \u83b7\u53d6\u6240\u6709\u952e\u503c\u5bf9\npub fn entrySet(self: *Self) !*std.ArrayList(T) {\nvar entry_set = std.ArrayList(T).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry entry_set.append(item.?);\n}\nreturn &entry_set;\n}  // \u83b7\u53d6\u6240\u6709\u952e\npub fn keySet(self: *Self) !*std.ArrayList(usize) {\nvar key_set = std.ArrayList(usize).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry key_set.append(item.?.key);\n}\nreturn &key_set;\n}  // \u83b7\u53d6\u6240\u6709\u503c\npub fn valueSet(self: *Self) !*std.ArrayList([]const u8) {\nvar value_set = std.ArrayList([]const u8).init(self.mem_allocator);\nfor (self.bucket.?.items) |item| {\nif (item == null) continue;\ntry value_set.append(item.?.val);\n}\nreturn &value_set;\n}\n// \u6253\u5370\u54c8\u5e0c\u8868\npub fn print(self: *Self) !void {\nvar entry_set = try self.entrySet();\ndefer entry_set.deinit();\nfor (entry_set.items) |item| {\nstd.debug.print(\"{} -> {s}\\n\", .{item.key, item.val});\n}\n}\n};\n}\n
"},{"location":"chapter_hashing/hash_map/#614","title":"6.1.4. \u00a0 \u54c8\u5e0c\u51b2\u7a81","text":"

\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u4f1a\u53d1\u73b0\uff0c\u54c8\u5e0c\u51fd\u6570 \\(f(x) = x \\% 100\\) \u4f1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5931\u6548\u3002\u5177\u4f53\u5730\uff0c\u5f53\u8f93\u5165\u7684 key \u540e\u4e24\u4f4d\u76f8\u540c\u65f6\uff0c\u54c8\u5e0c\u51fd\u6570\u7684\u8ba1\u7b97\u7ed3\u679c\u4e5f\u76f8\u540c\uff0c\u6307\u5411\u540c\u4e00\u4e2a value \u3002\u4f8b\u5982\uff0c\u5206\u522b\u67e5\u8be2\u4e24\u4e2a\u5b66\u53f7 \\(12836\\) \u548c \\(20336\\) \uff0c\u5219\u6709

\\[ f(12836) = f(20336) = 36 \\]

\u4e24\u4e2a\u5b66\u53f7\u6307\u5411\u4e86\u540c\u4e00\u4e2a\u59d3\u540d\uff0c\u8fd9\u660e\u663e\u662f\u4e0d\u5bf9\u7684\uff0c\u6211\u4eec\u5c06\u8fd9\u79cd\u73b0\u8c61\u79f0\u4e3a\u300c\u54c8\u5e0c\u51b2\u7a81 Hash Collision\u300d\u3002\u5982\u4f55\u907f\u514d\u54c8\u5e0c\u51b2\u7a81\u7684\u95ee\u9898\u5c06\u88ab\u7559\u5728\u4e0b\u7ae0\u8ba8\u8bba\u3002

Fig. \u54c8\u5e0c\u51b2\u7a81\u793a\u4f8b

\u7efc\u4e0a\u6240\u8ff0\uff0c\u4e00\u4e2a\u4f18\u79c0\u7684\u300c\u54c8\u5e0c\u51fd\u6570\u300d\u5e94\u8be5\u5177\u5907\u4ee5\u4e0b\u7279\u6027\uff1a

  • \u5c3d\u91cf\u5c11\u5730\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\uff1b
  • \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff0c\u8ba1\u7b97\u5c3d\u53ef\u80fd\u9ad8\u6548\uff1b
  • \u7a7a\u95f4\u4f7f\u7528\u7387\u9ad8\uff0c\u5373\u201c\u952e\u503c\u5bf9\u5360\u7528\u7a7a\u95f4 / \u54c8\u5e0c\u8868\u603b\u5360\u7528\u7a7a\u95f4\u201d\u5c3d\u53ef\u80fd\u5927\uff1b
"},{"location":"chapter_hashing/summary/","title":"6.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u5411\u54c8\u5e0c\u8868\u4e2d\u8f93\u5165\u4e00\u4e2a\u952e key \uff0c\u67e5\u8be2\u5230\u503c value \u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(1)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002
  • \u54c8\u5e0c\u8868\u7684\u5e38\u7528\u64cd\u4f5c\u5305\u62ec\u67e5\u8be2\u3001\u6dfb\u52a0\u4e0e\u5220\u9664\u952e\u503c\u5bf9\u3001\u904d\u5386\u952e\u503c\u5bf9\u7b49\u3002
  • \u54c8\u5e0c\u51fd\u6570\u5c06 key \u6620\u5c04\u5230\u6876\uff08\u6570\u7ec4\uff09\u7d22\u5f15\uff0c\u4ece\u800c\u8bbf\u95ee\u5230\u5bf9\u5e94\u7684\u503c value \u3002
  • \u4e24\u4e2a\u4e0d\u540c\u7684 key \u7ecf\u8fc7\u54c8\u5e0c\u51fd\u6570\u53ef\u80fd\u5f97\u5230\u76f8\u540c\u7684\u6876\u7d22\u5f15\uff0c\u8fdb\u800c\u53d1\u751f\u54c8\u5e0c\u51b2\u7a81\uff0c\u5bfc\u81f4\u67e5\u8be2\u9519\u8bef\u3002
  • \u7f13\u89e3\u54c8\u5e0c\u51b2\u7a81\u7684\u9014\u5f84\u6709\u4e24\u79cd\uff1a\u54c8\u5e0c\u8868\u6269\u5bb9\u3001\u4f18\u5316\u54c8\u5e0c\u8868\u7684\u8868\u793a\u65b9\u5f0f\u3002
  • \u8d1f\u8f7d\u56e0\u5b50\u5b9a\u4e49\u4e3a\u54c8\u5e0c\u8868\u4e2d\u5143\u7d20\u6570\u91cf\u9664\u4ee5\u6876\u69fd\u6570\u91cf\uff0c\u4f53\u73b0\u54c8\u5e0c\u51b2\u7a81\u7684\u4e25\u91cd\u7a0b\u5ea6\uff0c\u5e38\u7528\u4f5c\u54c8\u5e0c\u8868\u6269\u5bb9\u7684\u89e6\u53d1\u6761\u4ef6\u3002\u4e0e\u6570\u7ec4\u6269\u5bb9\u7684\u539f\u7406\u7c7b\u4f3c\uff0c\u54c8\u5e0c\u8868\u6269\u5bb9\u64cd\u4f5c\u5f00\u9500\u4e5f\u5f88\u5927\u3002
  • \u94fe\u5f0f\u5730\u5740\u8003\u8651\u5c06\u5355\u4e2a\u5143\u7d20\u8f6c\u5316\u6210\u4e00\u4e2a\u94fe\u8868\uff0c\u5c06\u6240\u6709\u51b2\u7a81\u5143\u7d20\u90fd\u5b58\u50a8\u5728\u4e00\u4e2a\u94fe\u8868\u4e2d\uff0c\u4ece\u800c\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u94fe\u8868\u8fc7\u957f\u4f1a\u5bfc\u81f4\u67e5\u8be2\u6548\u7387\u53d8\u4f4e\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u94fe\u8868\u8f6c\u5316\u4e3a AVL \u6811\u6216\u7ea2\u9ed1\u6811\u6765\u89e3\u51b3\u3002
  • \u5f00\u653e\u5bfb\u5740\u901a\u8fc7\u591a\u6b21\u63a2\u6d4b\u6765\u89e3\u51b3\u54c8\u5e0c\u51b2\u7a81\u3002\u7ebf\u6027\u63a2\u6d4b\u4f7f\u7528\u56fa\u5b9a\u6b65\u957f\uff0c\u7f3a\u70b9\u662f\u4e0d\u80fd\u5220\u9664\u5143\u7d20\u4e14\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\u3002\u591a\u6b21\u54c8\u5e0c\u4f7f\u7528\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u8fdb\u884c\u63a2\u6d4b\uff0c\u76f8\u5bf9\u7ebf\u6027\u63a2\u6d4b\u4e0d\u5bb9\u6613\u4ea7\u751f\u805a\u96c6\uff0c\u4ee3\u4ef7\u662f\u591a\u4e2a\u54c8\u5e0c\u51fd\u6570\u589e\u52a0\u4e86\u8ba1\u7b97\u91cf\u3002
  • \u5728\u5de5\u4e1a\u754c\u4e2d\uff0cJava \u7684 HashMap \u91c7\u7528\u94fe\u5f0f\u5730\u5740\u3001Python \u7684 Dict \u91c7\u7528\u5f00\u653e\u5bfb\u5740\u3002
"},{"location":"chapter_heap/build_heap/","title":"8.2. \u00a0 \u5efa\u5806\u64cd\u4f5c *","text":"

\u5982\u679c\u6211\u4eec\u60f3\u8981\u6839\u636e\u8f93\u5165\u5217\u8868\u6765\u751f\u6210\u4e00\u4e2a\u5806\uff0c\u8fd9\u6837\u7684\u64cd\u4f5c\u88ab\u79f0\u4e3a\u300c\u5efa\u5806\u300d\u3002

"},{"location":"chapter_heap/build_heap/#821","title":"8.2.1. \u00a0 \u4e24\u79cd\u5efa\u5806\u65b9\u6cd5","text":""},{"location":"chapter_heap/build_heap/#_1","title":"\u501f\u52a9\u5165\u5806\u65b9\u6cd5\u5b9e\u73b0","text":"

\u6700\u76f4\u63a5\u5730\uff0c\u8003\u8651\u501f\u52a9\u300c\u5143\u7d20\u5165\u5806\u300d\u65b9\u6cd5\uff0c\u5148\u5efa\u7acb\u4e00\u4e2a\u7a7a\u5806\uff0c\u518d\u5c06\u5217\u8868\u5143\u7d20\u4f9d\u6b21\u5165\u5806\u5373\u53ef\u3002

"},{"location":"chapter_heap/build_heap/#_2","title":"\u57fa\u4e8e\u5806\u5316\u64cd\u4f5c\u5b9e\u73b0","text":"

\u7136\u800c\uff0c\u5b58\u5728\u4e00\u79cd\u66f4\u52a0\u9ad8\u6548\u7684\u5efa\u5806\u65b9\u6cd5\u3002\u8bbe\u5143\u7d20\u6570\u91cf\u4e3a \\(n\\) \uff0c\u6211\u4eec\u5148\u5c06\u5217\u8868\u6240\u6709\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\uff0c\u7136\u540e\u8fed\u4ee3\u5730\u5bf9\u5404\u4e2a\u7ed3\u70b9\u6267\u884c\u300c\u4ece\u9876\u81f3\u5e95\u5806\u5316\u300d\u3002\u5f53\u7136\uff0c\u65e0\u9700\u5bf9\u53f6\u7ed3\u70b9\u6267\u884c\u5806\u5316\uff0c\u56e0\u4e3a\u5176\u6ca1\u6709\u5b50\u7ed3\u70b9\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(List<Integer> nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = new ArrayList<>(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (int i = parent(size() - 1); i >= 0; i--) {\nsiftDown(i);\n}\n}\n
my_heap.cpp
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(vector<int> nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = nums;\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (int i = parent(size() - 1); i >= 0; i--) {\nsiftDown(i);\n}\n}\n
my_heap.py
def __init__(self, nums: List[int]):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\n# \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nself.max_heap = nums\n# \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor i in range(self.parent(self.size() - 1), -1, -1):\nself.sift_down(i)\n
my_heap.go
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u5207\u7247\u5efa\u5806 */\nfunc newMaxHeap(nums []any) *maxHeap {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nh := &maxHeap{data: nums}\nfor i := len(h.data) - 1; i >= 0; i-- {\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nh.siftDown(i)\n}\nreturn h\n}\n
my_heap.js
/* \u6784\u9020\u65b9\u6cd5\uff0c\u5efa\u7acb\u7a7a\u5806\u6216\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nconstructor(nums) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nthis.#maxHeap = nums === undefined ? [] : [...nums];\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (let i = this.#parent(this.size() - 1); i >= 0; i--) {\nthis.#siftDown(i);\n}\n}\n
my_heap.ts
/* \u6784\u9020\u65b9\u6cd5\uff0c\u5efa\u7acb\u7a7a\u5806\u6216\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nconstructor(nums?: number[]) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nthis.maxHeap = nums === undefined ? [] : [...nums];\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor (let i = this.parent(this.size() - 1); i >= 0; i--) {\nthis.siftDown(i);\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{newMaxHeap}\n
my_heap.cs
/* \u6784\u9020\u51fd\u6570\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\nMaxHeap(IEnumerable<int> nums)\n{\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = new List<int>(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nvar size = parent(this.size() - 1);\nfor (int i = size; i >= 0; i--)\n{\nsiftDown(i);\n}\n}\n
my_heap.swift
/* \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806 */\ninit(nums: [Int]) {\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\nmaxHeap = nums\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nfor i in stride(from: parent(i: size() - 1), through: 0, by: -1) {\nsiftDown(i: i)\n}\n}\n
my_heap.zig
// \u6784\u9020\u65b9\u6cd5\uff0c\u6839\u636e\u8f93\u5165\u5217\u8868\u5efa\u5806\nfn init(self: *Self, allocator: std.mem.Allocator, nums: []const T) !void {\nif (self.maxHeap != null) return;\nself.maxHeap = std.ArrayList(T).init(allocator);\n// \u5c06\u5217\u8868\u5143\u7d20\u539f\u5c01\u4e0d\u52a8\u6dfb\u52a0\u8fdb\u5806\ntry self.maxHeap.?.appendSlice(nums);\n// \u5806\u5316\u9664\u53f6\u7ed3\u70b9\u4ee5\u5916\u7684\u5176\u4ed6\u6240\u6709\u7ed3\u70b9\nvar i: usize = parent(self.size() - 1) + 1;\nwhile (i > 0) : (i -= 1) {\ntry self.siftDown(i - 1);\n}\n}\n
"},{"location":"chapter_heap/build_heap/#822","title":"8.2.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u5bf9\u4e8e\u7b2c\u4e00\u79cd\u5efa\u5806\u65b9\u6cd5\uff0c\u5143\u7d20\u5165\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u800c\u5e73\u5747\u957f\u5ea6\u4e3a \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u8be5\u65b9\u6cd5\u7684\u603b\u4f53\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \u3002

\u90a3\u4e48\uff0c\u7b2c\u4e8c\u79cd\u5efa\u5806\u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u591a\u5c11\u5462\uff1f\u6211\u4eec\u6765\u5c55\u5f00\u63a8\u7b97\u4e00\u4e0b\u3002

  • \u5b8c\u5168\u4e8c\u53c9\u6811\u4e2d\uff0c\u8bbe\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u53f6\u7ed3\u70b9\u6570\u91cf\u4e3a \\((n + 1) / 2\\) \uff0c\u5176\u4e2d \\(/\\) \u4e3a\u5411\u4e0b\u6574\u9664\u3002\u56e0\u6b64\u5728\u6392\u9664\u53f6\u7ed3\u70b9\u540e\uff0c\u9700\u8981\u5806\u5316\u7ed3\u70b9\u6570\u91cf\u4e3a \\((n - 1)/2\\) \uff0c\u5373\u4e3a \\(O(n)\\) \uff1b
  • \u4ece\u9876\u81f3\u5e95\u5806\u5316\u4e2d\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u6700\u591a\u5806\u5316\u81f3\u53f6\u7ed3\u70b9\uff0c\u56e0\u6b64\u6700\u5927\u8fed\u4ee3\u6b21\u6570\u4e3a\u4e8c\u53c9\u6811\u9ad8\u5ea6 \\(O(\\log n)\\) \uff1b

\u5c06\u4e0a\u8ff0\u4e24\u8005\u76f8\u4e58\uff0c\u53ef\u5f97\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \u3002\u7136\u800c\uff0c\u8be5\u4f30\u7b97\u7ed3\u679c\u4ecd\u4e0d\u591f\u51c6\u786e\uff0c\u56e0\u4e3a\u6211\u4eec\u6ca1\u6709\u8003\u8651\u5230 \u4e8c\u53c9\u6811\u5e95\u5c42\u7ed3\u70b9\u8fdc\u591a\u4e8e\u9876\u5c42\u7ed3\u70b9 \u7684\u6027\u8d28\u3002

\u4e0b\u9762\u6211\u4eec\u6765\u5c1d\u8bd5\u5c55\u5f00\u8ba1\u7b97\u3002\u4e3a\u4e86\u51cf\u5c0f\u8ba1\u7b97\u96be\u5ea6\uff0c\u6211\u4eec\u5047\u8bbe\u6811\u662f\u4e00\u4e2a\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff0c\u8be5\u5047\u8bbe\u4e0d\u4f1a\u5f71\u54cd\u8ba1\u7b97\u7ed3\u679c\u7684\u6b63\u786e\u6027\u3002\u8bbe\u4e8c\u53c9\u6811\uff08\u5373\u5806\uff09\u7ed3\u70b9\u6570\u91cf\u4e3a \\(n\\) \uff0c\u6811\u9ad8\u5ea6\u4e3a \\(h\\) \u3002\u4e0a\u6587\u63d0\u5230\uff0c\u7ed3\u70b9\u5806\u5316\u6700\u5927\u8fed\u4ee3\u6b21\u6570\u7b49\u4e8e\u8be5\u7ed3\u70b9\u5230\u53f6\u7ed3\u70b9\u7684\u8ddd\u79bb\uff0c\u800c\u8fd9\u6b63\u662f\u201c\u7ed3\u70b9\u9ad8\u5ea6\u201d\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5c06\u5404\u5c42\u7684\u201c\u7ed3\u70b9\u6570\u91cf \\(\\times\\) \u7ed3\u70b9\u9ad8\u5ea6\u201d\u6c42\u548c\uff0c\u5373\u53ef\u5f97\u5230\u6240\u6709\u7ed3\u70b9\u7684\u5806\u5316\u7684\u8fed\u4ee3\u6b21\u6570\u603b\u548c\u3002

\\[ T(h) = 2^0h + 2^1(h-1) + 2^2(h-2) + \\cdots + 2^{(h-1)}\\times1 \\]

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u5404\u5c42\u7ed3\u70b9\u6570\u91cf

\u5316\u7b80\u4e0a\u5f0f\u9700\u8981\u501f\u52a9\u4e2d\u5b66\u7684\u6570\u5217\u77e5\u8bc6\uff0c\u5148\u5bf9 \\(T(h)\\) \u4e58\u4ee5 \\(2\\) \uff0c\u6613\u5f97

\\[ \\begin{aligned} T(h) & = 2^0h + 2^1(h-1) + 2^2(h-2) + \\cdots + 2^{h-1}\\times1 \\newline 2 T(h) & = 2^1h + 2^2(h-1) + 2^3(h-2) + \\cdots + 2^{h}\\times1 \\newline \\end{aligned} \\]

\u4f7f\u7528\u9519\u4f4d\u76f8\u51cf\u6cd5\uff0c\u4ee4\u4e0b\u5f0f \\(2 T(h)\\) \u51cf\u53bb\u4e0a\u5f0f \\(T(h)\\) \uff0c\u53ef\u5f97

\\[ 2T(h) - T(h) = T(h) = -2^0h + 2^1 + 2^2 + \\cdots + 2^{h-1} + 2^h \\]

\u89c2\u5bdf\u4e0a\u5f0f\uff0c\\(T(h)\\) \u662f\u4e00\u4e2a\u7b49\u6bd4\u6570\u5217\uff0c\u53ef\u76f4\u63a5\u4f7f\u7528\u6c42\u548c\u516c\u5f0f\uff0c\u5f97\u5230\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a

\\[ \\begin{aligned} T(h) & = 2 \\frac{1 - 2^h}{1 - 2} - h \\newline & = 2^{h+1} - h \\newline & = O(2^h) \\end{aligned} \\]

\u8fdb\u4e00\u6b65\u5730\uff0c\u9ad8\u5ea6\u4e3a \\(h\\) \u7684\u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u7ed3\u70b9\u6570\u91cf\u4e3a \\(n = 2^{h+1} - 1\\) \uff0c\u6613\u5f97\u590d\u6742\u5ea6\u4e3a \\(O(2^h) = O(n)\\)\u3002\u4ee5\u4e0a\u63a8\u7b97\u8868\u660e\uff0c\u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002

"},{"location":"chapter_heap/heap/","title":"8.1. \u00a0 \u5806","text":"

\u300c\u5806 Heap\u300d\u662f\u4e00\u68f5\u9650\u5b9a\u6761\u4ef6\u4e0b\u7684\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u3002\u6839\u636e\u6210\u7acb\u6761\u4ef6\uff0c\u5806\u4e3b\u8981\u5206\u4e3a\u4e24\u79cd\u7c7b\u578b\uff1a

  • \u300c\u5927\u9876\u5806 Max Heap\u300d\uff0c\u4efb\u610f\u7ed3\u70b9\u7684\u503c \\(\\geq\\) \u5176\u5b50\u7ed3\u70b9\u7684\u503c\uff1b
  • \u300c\u5c0f\u9876\u5806 Min Heap\u300d\uff0c\u4efb\u610f\u7ed3\u70b9\u7684\u503c \\(\\leq\\) \u5176\u5b50\u7ed3\u70b9\u7684\u503c\uff1b

Fig. \u5c0f\u9876\u5806\u4e0e\u5927\u9876\u5806

"},{"location":"chapter_heap/heap/#811","title":"8.1.1. \u00a0 \u5806\u672f\u8bed\u4e0e\u6027\u8d28","text":"
  • \u7531\u4e8e\u5806\u662f\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u56e0\u6b64\u6700\u5e95\u5c42\u7ed3\u70b9\u9760\u5de6\u586b\u5145\uff0c\u5176\u5b83\u5c42\u7ed3\u70b9\u7686\u88ab\u586b\u6ee1\u3002
  • \u4e8c\u53c9\u6811\u4e2d\u7684\u6839\u7ed3\u70b9\u5bf9\u5e94\u300c\u5806\u9876\u300d\uff0c\u5e95\u5c42\u6700\u9760\u53f3\u7ed3\u70b9\u5bf9\u5e94\u300c\u5806\u5e95\u300d\u3002
  • \u5bf9\u4e8e\u5927\u9876\u5806 / \u5c0f\u9876\u5806\uff0c\u5176\u5806\u9876\u5143\u7d20\uff08\u5373\u6839\u7ed3\u70b9\uff09\u7684\u503c\u6700\u5927 / \u6700\u5c0f\u3002
"},{"location":"chapter_heap/heap/#812","title":"8.1.2. \u00a0 \u5806\u5e38\u7528\u64cd\u4f5c","text":"

\u503c\u5f97\u8bf4\u660e\u7684\u662f\uff0c\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u63d0\u4f9b\u7684\u662f\u300c\u4f18\u5148\u961f\u5217 Priority Queue\u300d\uff0c\u5176\u662f\u4e00\u79cd\u62bd\u8c61\u6570\u636e\u7ed3\u6784\uff0c\u5b9a\u4e49\u4e3a\u5177\u6709\u51fa\u961f\u4f18\u5148\u7ea7\u7684\u961f\u5217\u3002

\u800c\u6070\u597d\uff0c\u5806\u7684\u5b9a\u4e49\u4e0e\u4f18\u5148\u961f\u5217\u7684\u64cd\u4f5c\u903b\u8f91\u5b8c\u5168\u543b\u5408\uff0c\u5927\u9876\u5806\u5c31\u662f\u4e00\u4e2a\u5143\u7d20\u4ece\u5927\u5230\u5c0f\u51fa\u961f\u7684\u4f18\u5148\u961f\u5217\u3002\u4ece\u4f7f\u7528\u89d2\u5ea6\u770b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u300c\u4f18\u5148\u961f\u5217\u300d\u548c\u300c\u5806\u300d\u7406\u89e3\u4e3a\u7b49\u4ef7\u7684\u6570\u636e\u7ed3\u6784\u3002\u56e0\u6b64\uff0c\u672c\u6587\u4e0e\u4ee3\u7801\u5bf9\u4e24\u8005\u4e0d\u505a\u7279\u522b\u533a\u5206\uff0c\u7edf\u4e00\u4f7f\u7528\u300c\u5806\u300d\u6765\u547d\u540d\u3002

\u5806\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff0c\u65b9\u6cd5\u540d\u9700\u6839\u636e\u7f16\u7a0b\u8bed\u8a00\u786e\u5b9a\u3002

\u65b9\u6cd5\u540d \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 push() \u5143\u7d20\u5165\u5806 \\(O(\\log n)\\) pop() \u5806\u9876\u5143\u7d20\u51fa\u5806 \\(O(\\log n)\\) peek() \u8bbf\u95ee\u5806\u9876\u5143\u7d20\uff08\u5927 / \u5c0f\u9876\u5806\u5206\u522b\u4e3a\u6700\u5927 / \u5c0f\u503c\uff09 \\(O(1)\\) size() \u83b7\u53d6\u5806\u7684\u5143\u7d20\u6570\u91cf \\(O(1)\\) isEmpty() \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u63d0\u4f9b\u7684\u5806\u7c7b\uff08\u6216\u4f18\u5148\u961f\u5217\u7c7b\uff09\u3002

Tip

\u7c7b\u4f3c\u4e8e\u6392\u5e8f\u4e2d\u201c\u4ece\u5c0f\u5230\u5927\u6392\u5217\u201d\u548c\u201c\u4ece\u5927\u5230\u5c0f\u6392\u5217\u201d\uff0c\u201c\u5927\u9876\u5806\u201d\u548c\u201c\u5c0f\u9876\u5806\u201d\u53ef\u4ec5\u901a\u8fc7\u4fee\u6539 Comparator \u6765\u4e92\u76f8\u8f6c\u6362\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig heap.java
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\nQueue<Integer> minHeap = new PriorityQueue<>();\n// \u521d\u59cb\u5316\u5927\u9876\u5806\uff08\u4f7f\u7528 lambda \u8868\u8fbe\u5f0f\u4fee\u6539 Comparator \u5373\u53ef\uff09\nQueue<Integer> maxHeap = new PriorityQueue<>((a, b) -> b - a);\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.offer(1);\nmaxHeap.offer(3);\nmaxHeap.offer(2);\nmaxHeap.offer(5);\nmaxHeap.offer(4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.peek(); // 5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\npeek = heap.poll();  // 5\npeek = heap.poll();  // 4\npeek = heap.poll();  // 3\npeek = heap.poll();  // 2\npeek = heap.poll();  // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.size();\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = maxHeap.isEmpty();\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nminHeap = new PriorityQueue<>(Arrays.asList(1, 3, 2, 5, 4));\n
heap.cpp
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\npriority_queue<int, vector<int>, greater<int>> minHeap;\n// \u521d\u59cb\u5316\u5927\u9876\u5806\npriority_queue<int, vector<int>, less<int>> maxHeap;\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.push(1);\nmaxHeap.push(3);\nmaxHeap.push(2);\nmaxHeap.push(5);\nmaxHeap.push(4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.top(); // 5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\nmaxHeap.pop(); // 5\nmaxHeap.pop(); // 4\nmaxHeap.pop(); // 3\nmaxHeap.pop(); // 2\nmaxHeap.pop(); // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.size();\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = maxHeap.empty();\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nvector<int> input{1, 3, 2, 5, 4};\npriority_queue<int, vector<int>, greater<int>> minHeap(input.begin(), input.end());\n
heap.py
# \u521d\u59cb\u5316\u5c0f\u9876\u5806\nmin_heap, flag = [], 1\n# \u521d\u59cb\u5316\u5927\u9876\u5806\nmax_heap, flag = [], -1\n# Python \u7684 heapq \u6a21\u5757\u9ed8\u8ba4\u5b9e\u73b0\u5c0f\u9876\u5806\n# \u8003\u8651\u5c06\u201c\u5143\u7d20\u53d6\u8d1f\u201d\u540e\u518d\u5165\u5806\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5c06\u5927\u5c0f\u5173\u7cfb\u98a0\u5012\uff0c\u4ece\u800c\u5b9e\u73b0\u5927\u9876\u5806\n# \u5728\u672c\u793a\u4f8b\u4e2d\uff0cflag = 1 \u65f6\u5bf9\u5e94\u5c0f\u9876\u5806\uff0cflag = -1 \u65f6\u5bf9\u5e94\u5927\u9876\u5806\n\"\"\" \u5143\u7d20\u5165\u5806 \"\"\"\nheapq.heappush(max_heap, flag * 1)\nheapq.heappush(max_heap, flag * 3)\nheapq.heappush(max_heap, flag * 2)\nheapq.heappush(max_heap, flag * 5)\nheapq.heappush(max_heap, flag * 4)\n\"\"\" \u83b7\u53d6\u5806\u9876\u5143\u7d20 \"\"\"\npeek: int = flag * max_heap[0] # 5\n\"\"\" \u5806\u9876\u5143\u7d20\u51fa\u5806 \"\"\"\n# \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\nval = flag * heapq.heappop(max_heap) # 5\nval = flag * heapq.heappop(max_heap) # 4\nval = flag * heapq.heappop(max_heap) # 3\nval = flag * heapq.heappop(max_heap) # 2\nval = flag * heapq.heappop(max_heap) # 1\n\"\"\" \u83b7\u53d6\u5806\u5927\u5c0f \"\"\"\nsize: int = len(max_heap)\n\"\"\" \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = not max_heap\n\"\"\" \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 \"\"\"\nmin_heap: List[int] = [1, 3, 2, 5, 4]\nheapq.heapify(min_heap)\n
heap.go
// Go \u8bed\u8a00\u4e2d\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 heap.Interface \u6765\u6784\u5efa\u6574\u6570\u5927\u9876\u5806\n// \u5b9e\u73b0 heap.Interface \u9700\u8981\u540c\u65f6\u5b9e\u73b0 sort.Interface\ntype intHeap []any\n// Push heap.Interface \u7684\u65b9\u6cd5\uff0c\u5b9e\u73b0\u63a8\u5165\u5143\u7d20\u5230\u5806\nfunc (h *intHeap) Push(x any) {\n// Push \u548c Pop \u4f7f\u7528 pointer receiver \u4f5c\u4e3a\u53c2\u6570\n// \u56e0\u4e3a\u5b83\u4eec\u4e0d\u4ec5\u4f1a\u5bf9\u5207\u7247\u7684\u5185\u5bb9\u8fdb\u884c\u8c03\u6574\uff0c\u8fd8\u4f1a\u4fee\u6539\u5207\u7247\u7684\u957f\u5ea6\u3002\n*h = append(*h, x.(int))\n}\n// Pop heap.Interface \u7684\u65b9\u6cd5\uff0c\u5b9e\u73b0\u5f39\u51fa\u5806\u9876\u5143\u7d20\nfunc (h *intHeap) Pop() any {\n// \u5f85\u51fa\u5806\u5143\u7d20\u5b58\u653e\u5728\u6700\u540e\nlast := (*h)[len(*h)-1]\n*h = (*h)[:len(*h)-1]\nreturn last\n}\n// Len sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Len() int {\nreturn len(*h)\n}\n// Less sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Less(i, j int) bool {\n// \u5982\u679c\u5b9e\u73b0\u5c0f\u9876\u5806\uff0c\u5219\u9700\u8981\u8c03\u6574\u4e3a\u5c0f\u4e8e\u53f7\nreturn (*h)[i].(int) > (*h)[j].(int)\n}\n// Swap sort.Interface \u7684\u65b9\u6cd5\nfunc (h *intHeap) Swap(i, j int) {\n(*h)[i], (*h)[j] = (*h)[j], (*h)[i]\n}\n// Top \u83b7\u53d6\u5806\u9876\u5143\u7d20\nfunc (h *intHeap) Top() any {\nreturn (*h)[0]\n}\n/* Driver Code */\nfunc TestHeap(t *testing.T) {\n/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5927\u9876\u5806\nmaxHeap := &intHeap{}\nheap.Init(maxHeap)\n/* \u5143\u7d20\u5165\u5806 */\n// \u8c03\u7528 heap.Interface \u7684\u65b9\u6cd5\uff0c\u6765\u6dfb\u52a0\u5143\u7d20\nheap.Push(maxHeap, 1)\nheap.Push(maxHeap, 3)\nheap.Push(maxHeap, 2)\nheap.Push(maxHeap, 4)\nheap.Push(maxHeap, 5)\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\ntop := maxHeap.Top()\nfmt.Printf(\"\u5806\u9876\u5143\u7d20\u4e3a %d\\n\", top)\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u8c03\u7528 heap.Interface \u7684\u65b9\u6cd5\uff0c\u6765\u79fb\u9664\u5143\u7d20\nheap.Pop(maxHeap) // 5\nheap.Pop(maxHeap) // 4\nheap.Pop(maxHeap) // 3\nheap.Pop(maxHeap) // 2\nheap.Pop(maxHeap) // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nsize := len(*maxHeap)\nfmt.Printf(\"\u5806\u5143\u7d20\u6570\u91cf\u4e3a %d\\n\", size)\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nisEmpty := len(*maxHeap) == 0\nfmt.Printf(\"\u5806\u662f\u5426\u4e3a\u7a7a %t\\n\", isEmpty)\n}\n
heap.js
// JavaScript \u672a\u63d0\u4f9b\u5185\u7f6e Heap \u7c7b\n
heap.ts
// TypeScript \u672a\u63d0\u4f9b\u5185\u7f6e Heap \u7c7b\n
heap.c
\n
heap.cs
/* \u521d\u59cb\u5316\u5806 */\n// \u521d\u59cb\u5316\u5c0f\u9876\u5806\nPriorityQueue<int, int> minHeap = new PriorityQueue<int, int>();\n// \u521d\u59cb\u5316\u5927\u9876\u5806\uff08\u4f7f\u7528 lambda \u8868\u8fbe\u5f0f\u4fee\u6539 Comparator \u5373\u53ef\uff09\nPriorityQueue<int, int> maxHeap = new PriorityQueue<int, int>(Comparer<int>.Create((x, y) => y - x));\n/* \u5143\u7d20\u5165\u5806 */\nmaxHeap.Enqueue(1, 1);\nmaxHeap.Enqueue(3, 3);\nmaxHeap.Enqueue(2, 2);\nmaxHeap.Enqueue(5, 5);\nmaxHeap.Enqueue(4, 4);\n/* \u83b7\u53d6\u5806\u9876\u5143\u7d20 */\nint peek = maxHeap.Peek();//5\n/* \u5806\u9876\u5143\u7d20\u51fa\u5806 */\n// \u51fa\u5806\u5143\u7d20\u4f1a\u5f62\u6210\u4e00\u4e2a\u4ece\u5927\u5230\u5c0f\u7684\u5e8f\u5217\npeek = maxHeap.Dequeue();  // 5\npeek = maxHeap.Dequeue();  // 4\npeek = maxHeap.Dequeue();  // 3\npeek = maxHeap.Dequeue();  // 2\npeek = maxHeap.Dequeue();  // 1\n/* \u83b7\u53d6\u5806\u5927\u5c0f */\nint size = maxHeap.Count;\n/* \u5224\u65ad\u5806\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = maxHeap.Count == 0;\n/* \u8f93\u5165\u5217\u8868\u5e76\u5efa\u5806 */\nminHeap = new PriorityQueue<int, int>(new List<(int, int)> { (1, 1), (3, 3), (2, 2), (5, 5), (4, 4), });\n
heap.swift
// Swift \u672a\u63d0\u4f9b\u5185\u7f6e Heap \u7c7b\n
heap.zig
\n
"},{"location":"chapter_heap/heap/#813","title":"8.1.3. \u00a0 \u5806\u7684\u5b9e\u73b0","text":"

\u4e0b\u6587\u5b9e\u73b0\u7684\u662f\u300c\u5927\u9876\u5806\u300d\uff0c\u82e5\u60f3\u8f6c\u6362\u4e3a\u300c\u5c0f\u9876\u5806\u300d\uff0c\u5c06\u6240\u6709\u5927\u5c0f\u903b\u8f91\u5224\u65ad\u53d6\u9006\uff08\u4f8b\u5982\u5c06 \\(\\geq\\) \u66ff\u6362\u4e3a \\(\\leq\\) \uff09\u5373\u53ef\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_heap/heap/#_1","title":"\u5806\u7684\u5b58\u50a8\u4e0e\u8868\u793a","text":"

\u5728\u4e8c\u53c9\u6811\u7ae0\u8282\u6211\u4eec\u5b66\u8fc7\uff0c\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u975e\u5e38\u9002\u5408\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u6765\u8868\u793a\uff0c\u800c\u5806\u6070\u597d\u662f\u4e00\u68f5\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u56e0\u800c\u6211\u4eec\u91c7\u7528\u300c\u6570\u7ec4\u300d\u6765\u5b58\u50a8\u300c\u5806\u300d\u3002

\u4e8c\u53c9\u6811\u6307\u9488\u3002\u4f7f\u7528\u6570\u7ec4\u8868\u793a\u4e8c\u53c9\u6811\u65f6\uff0c\u5143\u7d20\u4ee3\u8868\u7ed3\u70b9\u503c\uff0c\u7d22\u5f15\u4ee3\u8868\u7ed3\u70b9\u5728\u4e8c\u53c9\u6811\u4e2d\u7684\u4f4d\u7f6e\uff0c\u800c\u7ed3\u70b9\u6307\u9488\u901a\u8fc7\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u6765\u5b9e\u73b0\u3002

\u5177\u4f53\u5730\uff0c\u7ed9\u5b9a\u7d22\u5f15 \\(i\\) \uff0c\u90a3\u4e48\u5176\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 1\\) \u3001\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 2\\) \u3001\u7236\u7ed3\u70b9\u7d22\u5f15\u4e3a \\((i - 1) / 2\\) \uff08\u5411\u4e0b\u6574\u9664\uff09\u3002\u5f53\u7d22\u5f15\u8d8a\u754c\u65f6\uff0c\u4ee3\u8868\u7a7a\u7ed3\u70b9\u6216\u7ed3\u70b9\u4e0d\u5b58\u5728\u3002

Fig. \u5806\u7684\u8868\u793a\u4e0e\u5b58\u50a8

\u6211\u4eec\u5c06\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u5c01\u88c5\u6210\u51fd\u6570\uff0c\u4ee5\u4fbf\u540e\u7eed\u4f7f\u7528\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i) {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i) {\nreturn (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.cpp
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i) {\nreturn 2 * i + 2;\n} /* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i) {\nreturn (i - 1) / 2; // \u5411\u4e0b\u53d6\u6574\n}\n
my_heap.py
def left(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn 2 * i + 1\ndef right(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn 2 * i + 2\ndef parent(self, i: int) -> int:\n\"\"\" \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 \"\"\"\nreturn (i - 1) // 2  # \u5411\u4e0b\u6574\u9664\n
my_heap.go
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) left(i int) int {\nreturn 2*i + 1\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) right(i int) int {\nreturn 2*i + 2\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nfunc (h *maxHeap) parent(i int) int {\n// \u5411\u4e0b\u6574\u9664\nreturn (i - 1) / 2\n}\n
my_heap.js
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\n#left(i) {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\n#right(i) {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\n#parent(i) {\nreturn Math.floor((i - 1) / 2); // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.ts
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nleft(i: number): number {\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nright(i: number): number {\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nparent(i: number): number {\nreturn Math.floor((i - 1) / 2); // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.c
[class]{maxHeap}-[func]{left}\n[class]{maxHeap}-[func]{right}\n[class]{maxHeap}-[func]{parent}\n
my_heap.cs
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint left(int i)\n{\nreturn 2 * i + 1;\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nint right(int i)\n{\nreturn 2 * i + 2;\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nint parent(int i)\n{\nreturn (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.swift
/* \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc left(i: Int) -> Int {\n2 * i + 1\n}\n/* \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15 */\nfunc right(i: Int) -> Int {\n2 * i + 2\n}\n/* \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15 */\nfunc parent(i: Int) -> Int {\n(i - 1) / 2 // \u5411\u4e0b\u6574\u9664\n}\n
my_heap.zig
// \u83b7\u53d6\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\nfn left(i: usize) usize {\nreturn 2 * i + 1;\n}\n// \u83b7\u53d6\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\nfn right(i: usize) usize {\nreturn 2 * i + 2;\n}\n// \u83b7\u53d6\u7236\u7ed3\u70b9\u7d22\u5f15\nfn parent(i: usize) usize {\n// return (i - 1) / 2; // \u5411\u4e0b\u6574\u9664\nreturn @divFloor(i - 1, 2);\n}\n
"},{"location":"chapter_heap/heap/#_2","title":"\u8bbf\u95ee\u5806\u9876\u5143\u7d20","text":"

\u5806\u9876\u5143\u7d20\u662f\u4e8c\u53c9\u6811\u7684\u6839\u7ed3\u70b9\uff0c\u5373\u5217\u8868\u9996\u5143\u7d20\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek() {\nreturn maxHeap.get(0);\n}\n
my_heap.cpp
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek() {\nreturn maxHeap[0];\n}\n
my_heap.py
def peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u5806\u9876\u5143\u7d20 \"\"\"\nreturn self.max_heap[0]\n
my_heap.go
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nfunc (h *maxHeap) peek() any {\nreturn h.data[0]\n}\n
my_heap.js
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\npeek() {\nreturn this.#maxHeap[0];\n}\n
my_heap.ts
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\npeek(): number {\nreturn this.maxHeap[0];\n}\n
my_heap.c
[class]{maxHeap}-[func]{peek}\n
my_heap.cs
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nint peek()\n{\nreturn maxHeap[0];\n}\n
my_heap.swift
/* \u8bbf\u95ee\u5806\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nmaxHeap[0]\n}\n
my_heap.zig
// \u8bbf\u95ee\u5806\u9876\u5143\u7d20\nfn peek(self: *Self) T {\nreturn self.maxHeap.?.items[0];\n}  
"},{"location":"chapter_heap/heap/#_3","title":"\u5143\u7d20\u5165\u5806","text":"

\u7ed9\u5b9a\u5143\u7d20 val \uff0c\u6211\u4eec\u5148\u5c06\u5176\u6dfb\u52a0\u5230\u5806\u5e95\u3002\u6dfb\u52a0\u540e\uff0c\u7531\u4e8e val \u53ef\u80fd\u5927\u4e8e\u5806\u4e2d\u5176\u5b83\u5143\u7d20\uff0c\u6b64\u65f6\u5806\u7684\u6210\u7acb\u6761\u4ef6\u53ef\u80fd\u5df2\u7ecf\u88ab\u7834\u574f\uff0c\u56e0\u6b64\u9700\u8981\u4fee\u590d\u4ece\u63d2\u5165\u7ed3\u70b9\u5230\u6839\u7ed3\u70b9\u8fd9\u6761\u8def\u5f84\u4e0a\u7684\u5404\u4e2a\u7ed3\u70b9\uff0c\u8be5\u64cd\u4f5c\u88ab\u79f0\u4e3a\u300c\u5806\u5316 Heapify\u300d\u3002

\u8003\u8651\u4ece\u5165\u5806\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u6267\u884c\u5806\u5316\u3002\u5177\u4f53\u5730\uff0c\u6bd4\u8f83\u63d2\u5165\u7ed3\u70b9\u4e0e\u5176\u7236\u7ed3\u70b9\u7684\u503c\uff0c\u82e5\u63d2\u5165\u7ed3\u70b9\u66f4\u5927\u5219\u5c06\u5b83\u4eec\u4ea4\u6362\uff1b\u5e76\u5faa\u73af\u4ee5\u4e0a\u64cd\u4f5c\uff0c\u4ece\u5e95\u81f3\u9876\u5730\u4fee\u590d\u5806\u4e2d\u7684\u5404\u4e2a\u7ed3\u70b9\uff1b\u76f4\u81f3\u8d8a\u8fc7\u6839\u7ed3\u70b9\u65f6\u7ed3\u675f\uff0c\u6216\u5f53\u9047\u5230\u65e0\u9700\u4ea4\u6362\u7684\u7ed3\u70b9\u65f6\u63d0\u524d\u7ed3\u675f\u3002

<1><2><3><4><5><6>

\u8bbe\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \uff0c\u5219\u6811\u7684\u9ad8\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u6613\u5f97\u5806\u5316\u64cd\u4f5c\u7684\u5faa\u73af\u8f6e\u6570\u6700\u591a\u4e3a \\(O(\\log n)\\) \uff0c\u56e0\u800c\u5143\u7d20\u5165\u5806\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.add(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p = parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap.get(i) <= maxHeap.get(p))\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.cpp
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.push_back(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p =  parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap[i] <= maxHeap[p])\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(maxHeap[i], maxHeap[p]);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.py
def push(self, val: int):\n\"\"\" \u5143\u7d20\u5165\u5806 \"\"\"\n# \u6dfb\u52a0\u7ed3\u70b9\nself.max_heap.append(val)\n# \u4ece\u5e95\u81f3\u9876\u5806\u5316\nself.sift_up(self.size() - 1)\ndef sift_up(self, i: int):\n\"\"\" \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 \"\"\"\nwhile True:\n# \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\np = self.parent(i)\n# \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 or self.max_heap[i] <= self.max_heap[p]:\nbreak\n# \u4ea4\u6362\u4e24\u7ed3\u70b9\nself.swap(i, p)\n# \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n
my_heap.go
/* \u5143\u7d20\u5165\u5806 */\nfunc (h *maxHeap) push(val any) {\n// \u6dfb\u52a0\u7ed3\u70b9\nh.data = append(h.data, val)\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nh.siftUp(len(h.data) - 1)\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nfunc (h *maxHeap) siftUp(i int) {\nfor true {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\np := h.parent(i)\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 || h.data[i].(int) <= h.data[p].(int) {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nh.swap(i, p)\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n}\n}\n
my_heap.js
/* \u5143\u7d20\u5165\u5806 */\npush(val) {\n// \u6dfb\u52a0\u7ed3\u70b9\nthis.#maxHeap.push(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nthis.#siftUp(this.size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\n#siftUp(i) {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nconst p = this.#parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || this.#maxHeap[i] <= this.#maxHeap[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.#swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.ts
/* \u5143\u7d20\u5165\u5806 */\npush(val: number): void {\n// \u6dfb\u52a0\u7ed3\u70b9\nthis.maxHeap.push(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nthis.siftUp(this.size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nsiftUp(i: number): void {\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nconst p = this.parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 || this.maxHeap[i] <= this.maxHeap[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{push}\n[class]{maxHeap}-[func]{siftUp}\n
my_heap.cs
/* \u5143\u7d20\u5165\u5806 */\nvoid push(int val)\n{\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.Add(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(size() - 1);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nvoid siftUp(int i)\n{\nwhile (true)\n{\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nint p = parent(i);\n// \u82e5\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\uff0c\u5219\u7ed3\u675f\u5806\u5316\nif (p < 0 || maxHeap[i] <= maxHeap[p])\nbreak;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
my_heap.swift
/* \u5143\u7d20\u5165\u5806 */\nfunc push(val: Int) {\n// \u6dfb\u52a0\u7ed3\u70b9\nmaxHeap.append(val)\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\nsiftUp(i: size() - 1)\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316 */\nfunc siftUp(i: Int) {\nvar i = i\nwhile true {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nlet p = parent(i: i)\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif p < 0 || maxHeap[i] <= maxHeap[p] {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i: i, j: p)\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p\n}\n}\n
my_heap.zig
// \u5143\u7d20\u5165\u5806\nfn push(self: *Self, val: T) !void {\n// \u6dfb\u52a0\u7ed3\u70b9\ntry self.maxHeap.?.append(val);\n// \u4ece\u5e95\u81f3\u9876\u5806\u5316\ntry self.siftUp(self.size() - 1);\n}  // \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5806\u5316\nfn siftUp(self: *Self, i_: usize) !void {\nvar i = i_;\nwhile (true) {\n// \u83b7\u53d6\u7ed3\u70b9 i \u7684\u7236\u7ed3\u70b9\nvar p = parent(i);\n// \u5f53\u201c\u8d8a\u8fc7\u6839\u7ed3\u70b9\u201d\u6216\u201c\u7ed3\u70b9\u65e0\u9700\u4fee\u590d\u201d\u65f6\uff0c\u7ed3\u675f\u5806\u5316\nif (p < 0 or self.maxHeap.?.items[i] <= self.maxHeap.?.items[p]) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\ntry self.swap(i, p);\n// \u5faa\u73af\u5411\u4e0a\u5806\u5316\ni = p;\n}\n}\n
"},{"location":"chapter_heap/heap/#_4","title":"\u5806\u9876\u5143\u7d20\u51fa\u5806","text":"

\u5806\u9876\u5143\u7d20\u662f\u4e8c\u53c9\u6811\u6839\u7ed3\u70b9\uff0c\u5373\u5217\u8868\u9996\u5143\u7d20\uff0c\u5982\u679c\u6211\u4eec\u76f4\u63a5\u5c06\u9996\u5143\u7d20\u4ece\u5217\u8868\u4e2d\u5220\u9664\uff0c\u5219\u4e8c\u53c9\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u90fd\u4f1a\u968f\u4e4b\u53d1\u751f\u79fb\u4f4d\uff08\u7d22\u5f15\u53d1\u751f\u53d8\u5316\uff09\uff0c\u8fd9\u6837\u540e\u7eed\u4f7f\u7528\u5806\u5316\u4fee\u590d\u5c31\u5f88\u9ebb\u70e6\u4e86\u3002\u4e3a\u4e86\u5c3d\u91cf\u51cf\u5c11\u5143\u7d20\u7d22\u5f15\u53d8\u52a8\uff0c\u91c7\u53d6\u4ee5\u4e0b\u64cd\u4f5c\u6b65\u9aa4\uff1a

  1. \u4ea4\u6362\u5806\u9876\u5143\u7d20\u4e0e\u5806\u5e95\u5143\u7d20\uff08\u5373\u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff09\uff1b
  2. \u4ea4\u6362\u5b8c\u6210\u540e\uff0c\u5c06\u5806\u5e95\u4ece\u5217\u8868\u4e2d\u5220\u9664\uff08\u6ce8\u610f\uff0c\u56e0\u4e3a\u5df2\u7ecf\u4ea4\u6362\uff0c\u5b9e\u9645\u4e0a\u5220\u9664\u7684\u662f\u539f\u6765\u7684\u5806\u9876\u5143\u7d20\uff09\uff1b
  3. \u4ece\u6839\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u6267\u884c\u5806\u5316\uff1b

\u987e\u540d\u601d\u4e49\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316\u7684\u64cd\u4f5c\u65b9\u5411\u4e0e\u4ece\u5e95\u81f3\u9876\u5806\u5316\u76f8\u53cd\uff0c\u6211\u4eec\u6bd4\u8f83\u6839\u7ed3\u70b9\u7684\u503c\u4e0e\u5176\u4e24\u4e2a\u5b50\u7ed3\u70b9\u7684\u503c\uff0c\u5c06\u6700\u5927\u7684\u5b50\u7ed3\u70b9\u4e0e\u6839\u7ed3\u70b9\u6267\u884c\u4ea4\u6362\uff0c\u5e76\u5faa\u73af\u4ee5\u4e0a\u64cd\u4f5c\uff0c\u76f4\u5230\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u65f6\u7ed3\u675f\uff0c\u6216\u5f53\u9047\u5230\u65e0\u9700\u4ea4\u6362\u7684\u7ed3\u70b9\u65f6\u63d0\u524d\u7ed3\u675f\u3002

<1><2><3><4><5><6><7><8><9><10>

\u4e0e\u5143\u7d20\u5165\u5806\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u5806\u9876\u5143\u7d20\u51fa\u5806\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig my_heap.java
/* \u5143\u7d20\u51fa\u5806 */\nint pop() {\n// \u5224\u7a7a\u5904\u7406\nif (isEmpty())\nthrow new EmptyStackException();\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(0, size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nint val = maxHeap.remove(size() - 1);\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\nif (l < size() && maxHeap.get(l) > maxHeap.get(ma))\nma = l;\nif (r < size() && maxHeap.get(r) > maxHeap.get(ma))\nma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.cpp
/* \u5143\u7d20\u51fa\u5806 */\nvoid pop() {\n// \u5224\u7a7a\u5904\u7406\nif (empty()) {\nthrow out_of_range(\"\u5806\u4e3a\u7a7a\");\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(maxHeap[0], maxHeap[size() - 1]);\n// \u5220\u9664\u7ed3\u70b9\nmaxHeap.pop_back();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (l < size() && maxHeap[l] > maxHeap[ma]) ma = l;\nif (r < size() && maxHeap[r] > maxHeap[ma])\nma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\nswap(maxHeap[i], maxHeap[ma]);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.py
def pop(self) -> int:\n\"\"\" \u5143\u7d20\u51fa\u5806 \"\"\"\n# \u5224\u7a7a\u5904\u7406\nassert not self.is_empty()\n# \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nself.swap(0, self.size() - 1)\n# \u5220\u9664\u7ed3\u70b9\nval = self.max_heap.pop()\n# \u4ece\u9876\u81f3\u5e95\u5806\u5316\nself.sift_down(0)\n# \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\ndef sift_down(self, i: int):\n\"\"\" \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 \"\"\"\nwhile True:\n# \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nl, r, ma = self.left(i), self.right(i), i\nif l < self.size() and self.max_heap[l] > self.max_heap[ma]:\nma = l\nif r < self.size() and self.max_heap[r] > self.max_heap[ma]:\nma = r\n# \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif ma == i:\nbreak\n# \u4ea4\u6362\u4e24\u7ed3\u70b9\nself.swap(i, ma)\n# \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma\n
my_heap.go
/* \u5143\u7d20\u51fa\u5806 */\nfunc (h *maxHeap) pop() any {\n// \u5224\u7a7a\u5904\u7406\nif h.isEmpty() {\nfmt.Println(\"error\")\nreturn nil\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nh.swap(0, h.size()-1)\n// \u5220\u9664\u7ed3\u70b9\nval := h.data[len(h.data)-1]\nh.data = h.data[:len(h.data)-1]\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nh.siftDown(0)\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nfunc (h *maxHeap) siftDown(i int) {\nfor true {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a max\nl, r, max := h.left(i), h.right(i), i\nif l < h.size() && h.data[l].(int) > h.data[max].(int) {\nmax = l\n}\nif r < h.size() && h.data[r].(int) > h.data[max].(int) {\nmax = r\n}\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif max == i {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nh.swap(i, max)\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = max\n}\n}\n
my_heap.js
/* \u5143\u7d20\u51fa\u5806 */\npop() {\n// \u5224\u7a7a\u5904\u7406\nif (this.isEmpty()) throw new Error(\"\u5806\u4e3a\u7a7a\");\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nthis.#swap(0, this.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nconst val = this.#maxHeap.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nthis.#siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\n#siftDown(i) {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nconst l = this.#left(i),\nr = this.#right(i);\nlet ma = i;\nif (l < this.size() && this.#maxHeap[l] > this.#maxHeap[ma]) ma = l;\nif (r < this.size() && this.#maxHeap[r] > this.#maxHeap[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.#swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.ts
/* \u5143\u7d20\u51fa\u5806 */\npop(): number {\n// \u5224\u7a7a\u5904\u7406\nif (this.isEmpty()) throw new RangeError('Heap is empty.');\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nthis.swap(0, this.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nconst val = this.maxHeap.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nthis.siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nsiftDown(i: number): void {\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nconst l = this.left(i),\nr = this.right(i);\nlet ma = i;\nif (l < this.size() && this.maxHeap[l] > this.maxHeap[ma]) ma = l;\nif (r < this.size() && this.maxHeap[r] > this.maxHeap[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nthis.swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.c
[class]{maxHeap}-[func]{pop}\n[class]{maxHeap}-[func]{siftDown}\n
my_heap.cs
/* \u5143\u7d20\u51fa\u5806 */\nint pop()\n{\n// \u5224\u7a7a\u5904\u7406\nif (isEmpty())\nthrow new IndexOutOfRangeException();\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(0, size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nint val = maxHeap.Last();\nmaxHeap.RemoveAt(size() - 1);\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nvoid siftDown(int i)\n{\nwhile (true)\n{\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nint l = left(i), r = right(i), ma = i;\nif (l < size() && maxHeap[l] > maxHeap[ma])\nma = l;\nif (r < size() && maxHeap[r] > maxHeap[ma])\nma = r;\n// \u82e5\u201c\u7ed3\u70b9 i \u6700\u5927\u201d\u6216\u201c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u201d\uff0c\u5219\u7ed3\u675f\u5806\u5316\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
my_heap.swift
/* \u5143\u7d20\u51fa\u5806 */\nfunc pop() -> Int {\n// \u5224\u7a7a\u5904\u7406\nif isEmpty() {\nfatalError(\"\u5806\u4e3a\u7a7a\")\n}\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\nswap(i: 0, j: size() - 1)\n// \u5220\u9664\u7ed3\u70b9\nlet val = maxHeap.remove(at: size() - 1)\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\nsiftDown(i: 0)\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val\n}\n/* \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316 */\nfunc siftDown(i: Int) {\nvar i = i\nwhile true {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nlet l = left(i: i)\nlet r = right(i: i)\nvar ma = i\nif l < size(), maxHeap[l] > maxHeap[ma] {\nma = l\n}\nif r < size(), maxHeap[r] > maxHeap[ma] {\nma = r\n}\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif ma == i {\nbreak\n}\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\nswap(i: i, j: ma)\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma\n}\n}\n
my_heap.zig
// \u5143\u7d20\u51fa\u5806\nfn pop(self: *Self) !T {\n// \u5224\u65ad\u5904\u7406\nif (self.isEmpty()) unreachable;\n// \u4ea4\u6362\u6839\u7ed3\u70b9\u4e0e\u6700\u53f3\u53f6\u7ed3\u70b9\uff08\u5373\u4ea4\u6362\u9996\u5143\u7d20\u4e0e\u5c3e\u5143\u7d20\uff09\ntry self.swap(0, self.size() - 1);\n// \u5220\u9664\u7ed3\u70b9\nvar val = self.maxHeap.?.pop();\n// \u4ece\u9876\u81f3\u5e95\u5806\u5316\ntry self.siftDown(0);\n// \u8fd4\u56de\u5806\u9876\u5143\u7d20\nreturn val;\n} // \u4ece\u7ed3\u70b9 i \u5f00\u59cb\uff0c\u4ece\u9876\u81f3\u5e95\u5806\u5316\nfn siftDown(self: *Self, i_: usize) !void {\nvar i = i_;\nwhile (true) {\n// \u5224\u65ad\u7ed3\u70b9 i, l, r \u4e2d\u503c\u6700\u5927\u7684\u7ed3\u70b9\uff0c\u8bb0\u4e3a ma\nvar l = left(i);\nvar r = right(i);\nvar ma = i;\nif (l < self.size() and self.maxHeap.?.items[l] > self.maxHeap.?.items[ma]) ma = l;\nif (r < self.size() and self.maxHeap.?.items[r] > self.maxHeap.?.items[ma]) ma = r;\n// \u82e5\u7ed3\u70b9 i \u6700\u5927\u6216\u7d22\u5f15 l, r \u8d8a\u754c\uff0c\u5219\u65e0\u9700\u7ee7\u7eed\u5806\u5316\uff0c\u8df3\u51fa\nif (ma == i) break;\n// \u4ea4\u6362\u4e24\u7ed3\u70b9\ntry self.swap(i, ma);\n// \u5faa\u73af\u5411\u4e0b\u5806\u5316\ni = ma;\n}\n}\n
"},{"location":"chapter_heap/heap/#814","title":"8.1.4. \u00a0 \u5806\u5e38\u89c1\u5e94\u7528","text":"
  • \u4f18\u5148\u961f\u5217\u3002\u5806\u5e38\u4f5c\u4e3a\u5b9e\u73b0\u4f18\u5148\u961f\u5217\u7684\u9996\u9009\u6570\u636e\u7ed3\u6784\uff0c\u5165\u961f\u548c\u51fa\u961f\u64cd\u4f5c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(\\log n)\\) \uff0c\u5efa\u961f\u64cd\u4f5c\u4e3a \\(O(n)\\) \uff0c\u7686\u975e\u5e38\u9ad8\u6548\u3002
  • \u5806\u6392\u5e8f\u3002\u7ed9\u5b9a\u4e00\u7ec4\u6570\u636e\uff0c\u6211\u4eec\u4f7f\u7528\u5176\u5efa\u5806\uff0c\u5e76\u4f9d\u6b21\u5168\u90e8\u5f39\u51fa\uff0c\u5219\u53ef\u4ee5\u5f97\u5230\u6709\u5e8f\u7684\u5e8f\u5217\u3002\u5f53\u7136\uff0c\u5806\u6392\u5e8f\u4e00\u822c\u65e0\u9700\u5f39\u51fa\u5143\u7d20\uff0c\u4ec5\u9700\u6bcf\u8f6e\u5c06\u5806\u9876\u5143\u7d20\u4ea4\u6362\u81f3\u6570\u7ec4\u5c3e\u90e8\u5e76\u51cf\u5c0f\u5806\u7684\u957f\u5ea6\u5373\u53ef\u3002
  • \u83b7\u53d6\u6700\u5927\u7684 \\(k\\) \u4e2a\u5143\u7d20\u3002\u8fd9\u65e2\u662f\u4e00\u9053\u7ecf\u5178\u7b97\u6cd5\u9898\u76ee\uff0c\u4e5f\u662f\u4e00\u79cd\u5e38\u89c1\u5e94\u7528\uff0c\u4f8b\u5982\u9009\u53d6\u70ed\u5ea6\u524d 10 \u7684\u65b0\u95fb\u4f5c\u4e3a\u5fae\u535a\u70ed\u641c\uff0c\u9009\u53d6\u524d 10 \u9500\u91cf\u7684\u5546\u54c1\u7b49\u3002
"},{"location":"chapter_heap/summary/","title":"8.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u5806\u662f\u4e00\u68f5\u9650\u5b9a\u6761\u4ef6\u4e0b\u7684\u5b8c\u5168\u4e8c\u53c9\u6811\uff0c\u6839\u636e\u6210\u7acb\u6761\u4ef6\u53ef\u5206\u4e3a\u5927\u9876\u5806\u548c\u5c0f\u9876\u5806\u3002\u5927\uff08\u5c0f\uff09\u9876\u5806\u7684\u5806\u9876\u5143\u7d20\u6700\u5927\uff08\u5c0f\uff09\u3002
  • \u4f18\u5148\u961f\u5217\u5b9a\u4e49\u4e3a\u4e00\u79cd\u5177\u6709\u51fa\u961f\u4f18\u5148\u7ea7\u7684\u961f\u5217\u3002\u5806\u662f\u5b9e\u73b0\u4f18\u5148\u961f\u5217\u7684\u6700\u5e38\u7528\u6570\u636e\u7ed3\u6784\u3002
  • \u5806\u7684\u5e38\u7528\u64cd\u4f5c\u548c\u5bf9\u5e94\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a\u5143\u7d20\u5165\u5806 \\(O(\\log n)\\) \u3001\u5806\u9876\u5143\u7d20\u51fa\u5806 \\(O(\\log n)\\) \u3001\u8bbf\u95ee\u5806\u9876\u5143\u7d20 \\(O(1)\\) \u7b49\u3002
  • \u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u7528\u6570\u7ec4\u6765\u8868\u793a\uff0c\u56e0\u6b64\u6211\u4eec\u4e00\u822c\u7528\u6570\u7ec4\u6765\u5b58\u50a8\u5806\u3002
  • \u5806\u5316\u64cd\u4f5c\u7528\u4e8e\u4fee\u590d\u5806\u7684\u7279\u6027\uff0c\u5728\u5165\u5806\u548c\u51fa\u5806\u64cd\u4f5c\u4e2d\u90fd\u4f1a\u4f7f\u7528\u5230\u3002
  • \u8f93\u5165 \\(n\\) \u4e2a\u5143\u7d20\u5e76\u5efa\u5806\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u88ab\u4f18\u5316\u81f3 \\(O(n)\\) \uff0c\u975e\u5e38\u9ad8\u6548\u3002
"},{"location":"chapter_introduction/algorithms_are_everywhere/","title":"1.1. \u00a0 \u7b97\u6cd5\u65e0\u5904\u4e0d\u5728","text":"

\u542c\u5230\u201c\u7b97\u6cd5\u201d\u8fd9\u4e2a\u8bcd\uff0c\u6211\u4eec\u4e00\u822c\u4f1a\u8054\u60f3\u5230\u6570\u5b66\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u5927\u591a\u6570\u7b97\u6cd5\u5e76\u4e0d\u5305\u542b\u590d\u6742\u7684\u6570\u5b66\uff0c\u800c\u66f4\u50cf\u662f\u5728\u8003\u5bdf\u57fa\u672c\u903b\u8f91\uff0c\u800c\u8fd9\u4e9b\u903b\u8f91\u5728\u6211\u4eec\u65e5\u5e38\u751f\u6d3b\u4e2d\u5904\u5904\u53ef\u89c1\u3002

\u5728\u6b63\u5f0f\u4ecb\u7ecd\u7b97\u6cd5\u4e4b\u524d\uff0c\u6211\u60f3\u544a\u8bc9\u4f60\u4e00\u4ef6\u6709\u8da3\u7684\u4e8b\uff1a\u5176\u5b9e\uff0c\u4f60\u5728\u8fc7\u53bb\u5df2\u7ecf\u5b66\u4f1a\u4e86\u5f88\u591a\u7b97\u6cd5\uff0c\u5e76\u4e14\u5df2\u7ecf\u4e60\u60ef\u5c06\u5b83\u4eec\u5e94\u7528\u5230\u65e5\u5e38\u751f\u6d3b\u4e2d\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u4ecb\u7ecd\u4e24\u4e2a\u5177\u4f53\u4f8b\u5b50\u6765\u4f50\u8bc1\u3002

\u4f8b\u4e00\uff1a\u62fc\u79ef\u6728\u3002\u4e00\u5957\u79ef\u6728\uff0c\u9664\u4e86\u6709\u8bb8\u591a\u90e8\u4ef6\u4e4b\u5916\uff0c\u8fd8\u4f1a\u9644\u9001\u8be6\u7ec6\u7684\u62fc\u88c5\u8bf4\u660e\u4e66\u3002\u6211\u4eec\u6309\u7167\u8bf4\u660e\u4e66\u4e0a\u4e00\u6b65\u6b65\u64cd\u4f5c\uff0c\u5373\u53ef\u62fc\u51fa\u590d\u6742\u7684\u79ef\u6728\u6a21\u578b\u3002

\u5982\u679c\u4ece\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u89d2\u5ea6\u770b\uff0c\u5927\u5927\u5c0f\u5c0f\u7684\u300c\u79ef\u6728\u300d\u5c31\u662f\u6570\u636e\u7ed3\u6784\uff0c\u800c\u300c\u62fc\u88c5\u8bf4\u660e\u4e66\u300d\u4e0a\u7684\u4e00\u7cfb\u5217\u6b65\u9aa4\u5c31\u662f\u7b97\u6cd5\u3002

\u4f8b\u4e8c\uff1a\u67e5\u5b57\u5178\u3002\u5728\u5b57\u5178\u4e2d\uff0c\u6bcf\u4e2a\u6c49\u5b57\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u62fc\u97f3\uff0c\u800c\u5b57\u5178\u662f\u6309\u7167\u62fc\u97f3\u7684\u82f1\u6587\u5b57\u6bcd\u8868\u987a\u5e8f\u6392\u5217\u7684\u3002\u5047\u8bbe\u9700\u8981\u5728\u5b57\u5178\u4e2d\u67e5\u8be2\u4efb\u610f\u4e00\u4e2a\u62fc\u97f3\u9996\u5b57\u6bcd\u4e3a \\(r\\) \u7684\u5b57\uff0c\u4e00\u822c\u6211\u4eec\u4f1a\u8fd9\u6837\u505a\uff1a

  1. \u6253\u5f00\u5b57\u5178\u5927\u81f4\u4e00\u534a\u9875\u6570\u7684\u4f4d\u7f6e\uff0c\u67e5\u770b\u6b64\u9875\u7684\u9996\u5b57\u6bcd\u662f\u4ec0\u4e48\uff08\u5047\u8bbe\u4e3a \\(m\\) \uff09\uff1b
  2. \u7531\u4e8e\u5728\u82f1\u6587\u5b57\u6bcd\u8868\u4e2d \\(r\\) \u5728 \\(m\\) \u7684\u540e\u9762\uff0c\u56e0\u6b64\u5e94\u6392\u9664\u5b57\u5178\u524d\u534a\u90e8\u5206\uff0c\u67e5\u627e\u8303\u56f4\u4ec5\u5269\u540e\u534a\u90e8\u5206\uff1b
  3. \u5faa\u73af\u6267\u884c\u6b65\u9aa4 1-2 \uff0c\u76f4\u5230\u627e\u5230\u62fc\u97f3\u9996\u5b57\u6bcd\u4e3a \\(r\\) \u7684\u9875\u7801\u65f6\u7ec8\u6b62\u3002
<1><2><3><4><5>

\u67e5\u5b57\u5178\u8fd9\u4e2a\u5c0f\u5b66\u751f\u7684\u6807\u914d\u6280\u80fd\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u5927\u540d\u9f0e\u9f0e\u7684\u300c\u4e8c\u5206\u67e5\u627e\u300d\u3002\u4ece\u6570\u636e\u7ed3\u6784\u89d2\u5ea6\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u5178\u770b\u4f5c\u662f\u4e00\u4e2a\u5df2\u6392\u5e8f\u7684\u300c\u6570\u7ec4\u300d\uff1b\u800c\u4ece\u7b97\u6cd5\u89d2\u5ea6\uff0c\u6211\u4eec\u53ef\u5c06\u4e0a\u8ff0\u67e5\u5b57\u5178\u7684\u4e00\u7cfb\u5217\u6307\u4ee4\u770b\u4f5c\u662f\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7b97\u6cd5\u3002

\u5c0f\u5230\u70f9\u996a\u4e00\u9053\u83dc\u3001\u5927\u5230\u661f\u9645\u822a\u884c\uff0c\u51e0\u4e4e\u6240\u6709\u95ee\u9898\u7684\u89e3\u51b3\u90fd\u79bb\u4e0d\u5f00\u7b97\u6cd5\u3002\u8ba1\u7b97\u673a\u7684\u51fa\u73b0\uff0c\u4f7f\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u7f16\u7a0b\u5c06\u6570\u636e\u7ed3\u6784\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u7f16\u5199\u4ee3\u7801\u6765\u8c03\u7528 CPU, GPU \u6267\u884c\u7b97\u6cd5\uff0c\u4ece\u800c\u5c06\u751f\u6d3b\u4e2d\u7684\u95ee\u9898\u642c\u8fd0\u5230\u8ba1\u7b97\u673a\u4e2d\uff0c\u66f4\u52a0\u9ad8\u6548\u5730\u89e3\u51b3\u5404\u5f0f\u5404\u6837\u7684\u590d\u6742\u95ee\u9898\u3002

Tip

\u8bfb\u5230\u8fd9\u91cc\uff0c\u5982\u679c\u4f60\u611f\u5230\u5bf9\u6570\u636e\u7ed3\u6784\u3001\u7b97\u6cd5\u3001\u6570\u7ec4\u3001\u4e8c\u5206\u67e5\u627e\u7b49\u6b64\u7c7b\u6982\u5ff5\u4e00\u77e5\u534a\u89e3\uff0c\u90a3\u4e48\u5c31\u592a\u597d\u4e86\uff01\u56e0\u4e3a\u8fd9\u6b63\u662f\u672c\u4e66\u5b58\u5728\u7684\u4ef7\u503c\uff0c\u63a5\u4e0b\u6765\uff0c\u672c\u4e66\u5c06\u4f1a\u4e00\u6b65\u6b65\u5730\u5f15\u5bfc\u4f60\u8fdb\u5165\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u77e5\u8bc6\u6bbf\u5802\u3002

"},{"location":"chapter_introduction/summary/","title":"1.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u7b97\u6cd5\u5728\u751f\u6d3b\u4e2d\u968f\u5904\u53ef\u89c1\uff0c\u5e76\u4e0d\u9ad8\u6df1\u83ab\u6d4b\u3002\u6211\u4eec\u5df2\u7ecf\u4e0d\u77e5\u4e0d\u89c9\u5730\u5b66\u4e60\u5230\u8bb8\u591a\u201c\u7b97\u6cd5\u201d\uff0c\u7528\u4e8e\u89e3\u51b3\u751f\u6d3b\u4e2d\u5927\u5927\u5c0f\u5c0f\u7684\u95ee\u9898\u3002
  • \u201c\u67e5\u5b57\u5178\u201d\u7684\u539f\u7406\u548c\u4e8c\u5206\u67e5\u627e\u7b97\u6cd5\u4e00\u81f4\u3002\u4e8c\u5206\u4f53\u73b0\u5206\u800c\u6cbb\u4e4b\u7684\u91cd\u8981\u7b97\u6cd5\u601d\u60f3\u3002
  • \u7b97\u6cd5\u662f\u5728\u6709\u9650\u65f6\u95f4\u5185\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u7684\u4e00\u7ec4\u6307\u4ee4\u6216\u64cd\u4f5c\u6b65\u9aa4\uff0c\u6570\u636e\u7ed3\u6784\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\u3002
  • \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e24\u8005\u7d27\u5bc6\u8054\u7cfb\u3002\u6570\u636e\u7ed3\u6784\u662f\u7b97\u6cd5\u7684\u5e95\u5ea7\uff0c\u7b97\u6cd5\u662f\u53d1\u6325\u6570\u636e\u7ed3\u6784\u7684\u821e\u53f0\u3002
  • \u4e50\u9ad8\u79ef\u6728\u5bf9\u5e94\u6570\u636e\uff0c\u79ef\u6728\u5f62\u72b6\u548c\u8fde\u63a5\u5f62\u5f0f\u5bf9\u5e94\u6570\u636e\u7ed3\u6784\uff0c\u62fc\u88c5\u79ef\u6728\u7684\u6d41\u7a0b\u6b65\u9aa4\u5bf9\u5e94\u7b97\u6cd5\u3002
"},{"location":"chapter_introduction/what_is_dsa/","title":"1.2. \u00a0 \u7b97\u6cd5\u662f\u4ec0\u4e48","text":""},{"location":"chapter_introduction/what_is_dsa/#121","title":"1.2.1. \u00a0 \u7b97\u6cd5\u5b9a\u4e49","text":"

\u300c\u7b97\u6cd5 Algorithm\u300d\u662f\u5728\u6709\u9650\u65f6\u95f4\u5185\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u7684\u4e00\u7ec4\u6307\u4ee4\u6216\u64cd\u4f5c\u6b65\u9aa4\u3002\u7b97\u6cd5\u5177\u6709\u4ee5\u4e0b\u7279\u6027\uff1a

  • \u95ee\u9898\u662f\u660e\u786e\u7684\uff0c\u9700\u8981\u62e5\u6709\u660e\u786e\u7684\u8f93\u5165\u548c\u8f93\u51fa\u5b9a\u4e49\u3002
  • \u89e3\u5177\u6709\u786e\u5b9a\u6027\uff0c\u5373\u7ed9\u5b9a\u76f8\u540c\u8f93\u5165\u65f6\uff0c\u8f93\u51fa\u4e00\u5b9a\u76f8\u540c\u3002
  • \u5177\u6709\u53ef\u884c\u6027\uff0c\u53ef\u5728\u6709\u9650\u6b65\u9aa4\u3001\u6709\u9650\u65f6\u95f4\u3001\u6709\u9650\u5185\u5b58\u7a7a\u95f4\u4e0b\u5b8c\u6210\u3002
  • \u72ec\u7acb\u4e8e\u7f16\u7a0b\u8bed\u8a00\uff0c\u5373\u53ef\u7528\u591a\u79cd\u8bed\u8a00\u5b9e\u73b0\u3002
"},{"location":"chapter_introduction/what_is_dsa/#122","title":"1.2.2. \u00a0 \u6570\u636e\u7ed3\u6784\u5b9a\u4e49","text":"

\u300c\u6570\u636e\u7ed3\u6784 Data Structure\u300d\u662f\u5728\u8ba1\u7b97\u673a\u4e2d\u7ec4\u7ec7\u4e0e\u5b58\u50a8\u6570\u636e\u7684\u65b9\u5f0f\u3002\u4e3a\u4e86\u63d0\u9ad8\u6570\u636e\u5b58\u50a8\u548c\u64cd\u4f5c\u6027\u80fd\uff0c\u6570\u636e\u7ed3\u6784\u7684\u8bbe\u8ba1\u539f\u5219\u6709\uff1a

  • \u7a7a\u95f4\u5360\u7528\u5c3d\u53ef\u80fd\u5c0f\uff0c\u8282\u7701\u8ba1\u7b97\u673a\u5185\u5b58\u3002
  • \u6570\u636e\u64cd\u4f5c\u5c3d\u91cf\u5feb\uff0c\u5305\u62ec\u6570\u636e\u8bbf\u95ee\u3001\u6dfb\u52a0\u3001\u5220\u9664\u3001\u66f4\u65b0\u7b49\u3002
  • \u63d0\u4f9b\u7b80\u6d01\u7684\u6570\u636e\u8868\u793a\u548c\u903b\u8f91\u4fe1\u606f\uff0c\u4ee5\u4fbf\u7b97\u6cd5\u9ad8\u6548\u8fd0\u884c\u3002

\u6570\u636e\u7ed3\u6784\u7684\u8bbe\u8ba1\u662f\u4e00\u4e2a\u5145\u6ee1\u6743\u8861\u7684\u8fc7\u7a0b\uff0c\u8fd9\u610f\u5473\u7740\u5982\u679c\u83b7\u5f97\u67d0\u65b9\u9762\u7684\u4f18\u52bf\uff0c\u5219\u5f80\u5f80\u9700\u8981\u5728\u53e6\u4e00\u65b9\u9762\u505a\u51fa\u59a5\u534f\u3002\u4f8b\u5982\uff0c\u94fe\u8868\u76f8\u5bf9\u4e8e\u6570\u7ec4\uff0c\u6570\u636e\u6dfb\u52a0\u5220\u9664\u64cd\u4f5c\u66f4\u52a0\u65b9\u4fbf\uff0c\u4f46\u727a\u7272\u4e86\u6570\u636e\u7684\u8bbf\u95ee\u901f\u5ea6\uff1b\u56fe\u76f8\u5bf9\u4e8e\u94fe\u8868\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u903b\u8f91\u4fe1\u606f\uff0c\u4f46\u9700\u8981\u5360\u7528\u66f4\u591a\u7684\u5185\u5b58\u7a7a\u95f4\u3002

"},{"location":"chapter_introduction/what_is_dsa/#123","title":"1.2.3. \u00a0 \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u5173\u7cfb","text":"

\u300c\u6570\u636e\u7ed3\u6784\u300d\u4e0e\u300c\u7b97\u6cd5\u300d\u662f\u9ad8\u5ea6\u76f8\u5173\u3001\u7d27\u5bc6\u5d4c\u5408\u7684\uff0c\u4f53\u73b0\u5728\uff1a

  • \u6570\u636e\u7ed3\u6784\u662f\u7b97\u6cd5\u7684\u5e95\u5ea7\u3002\u6570\u636e\u7ed3\u6784\u4e3a\u7b97\u6cd5\u63d0\u4f9b\u7ed3\u6784\u5316\u5b58\u50a8\u7684\u6570\u636e\uff0c\u4ee5\u53ca\u64cd\u4f5c\u6570\u636e\u7684\u5bf9\u5e94\u65b9\u6cd5\u3002
  • \u7b97\u6cd5\u662f\u6570\u636e\u7ed3\u6784\u53d1\u6325\u7684\u821e\u53f0\u3002\u6570\u636e\u7ed3\u6784\u4ec5\u5b58\u50a8\u6570\u636e\u4fe1\u606f\uff0c\u7ed3\u5408\u7b97\u6cd5\u624d\u53ef\u89e3\u51b3\u7279\u5b9a\u95ee\u9898\u3002
  • \u7b97\u6cd5\u6709\u5bf9\u5e94\u6700\u4f18\u7684\u6570\u636e\u7ed3\u6784\u3002\u7ed9\u5b9a\u7b97\u6cd5\uff0c\u4e00\u822c\u53ef\u57fa\u4e8e\u4e0d\u540c\u7684\u6570\u636e\u7ed3\u6784\u5b9e\u73b0\uff0c\u800c\u6700\u7ec8\u6267\u884c\u6548\u7387\u5f80\u5f80\u76f8\u5dee\u5f88\u5927\u3002

Fig. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u5173\u7cfb

\u5982\u679c\u5c06\u300cLEGO \u4e50\u9ad8\u300d\u7c7b\u6bd4\u5230\u300c\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300d\uff0c\u90a3\u4e48\u53ef\u4ee5\u5f97\u5230\u4e0b\u8868\u6240\u793a\u7684\u5bf9\u5e94\u5173\u7cfb\u3002

\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5 LEGO \u4e50\u9ad8 \u8f93\u5165\u6570\u636e \u672a\u62fc\u88c5\u7684\u79ef\u6728 \u6570\u636e\u7ed3\u6784 \u79ef\u6728\u7ec4\u7ec7\u5f62\u5f0f\uff0c\u5305\u62ec\u5f62\u72b6\u3001\u5927\u5c0f\u3001\u8fde\u63a5\u65b9\u5f0f\u7b49 \u7b97\u6cd5 \u628a\u79ef\u6728\u62fc\u6210\u76ee\u6807\u5f62\u6001\u7684\u4e00\u7cfb\u5217\u64cd\u4f5c\u6b65\u9aa4 \u8f93\u51fa\u6570\u636e \u79ef\u6728\u6a21\u578b

\u7ea6\u5b9a\u4fd7\u6210\u7684\u7b80\u79f0

\u5728\u5b9e\u9645\u8ba8\u8bba\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4f1a\u5c06\u300c\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u300d\u76f4\u63a5\u7b80\u79f0\u4e3a\u300c\u7b97\u6cd5\u300d\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u719f\u79f0\u7684 LeetCode \u7b97\u6cd5\u9898\u76ee\uff0c\u5b9e\u9645\u4e0a\u540c\u65f6\u8003\u5bdf\u4e86\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\u4e24\u90e8\u5206\u77e5\u8bc6\u3002

"},{"location":"chapter_preface/about_the_book/","title":"0.1. \u00a0 \u5173\u4e8e\u672c\u4e66","text":"

\u672c\u9879\u76ee\u81f4\u529b\u4e8e\u6784\u5efa\u4e00\u672c\u5f00\u6e90\u514d\u8d39\u3001\u65b0\u624b\u53cb\u597d\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5165\u95e8\u4e66\u3002

  • \u5168\u4e66\u91c7\u7528\u52a8\u753b\u56fe\u89e3\uff0c\u7ed3\u6784\u5316\u5730\u8bb2\u89e3\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u77e5\u8bc6\uff0c\u5185\u5bb9\u6e05\u6670\u6613\u61c2\u3001\u5b66\u4e60\u66f2\u7ebf\u5e73\u6ed1\uff1b
  • \u7b97\u6cd5\u6e90\u4ee3\u7801\u7686\u53ef\u4e00\u952e\u8fd0\u884c\uff0c\u652f\u6301 Java, C++, Python, Go, JS, TS, C#, Swift, Zig \u7b49\u8bed\u8a00\uff1b
  • \u9f13\u52b1\u8bfb\u8005\u5728\u7ae0\u8282\u8ba8\u8bba\u533a\u4e92\u5e2e\u4e92\u52a9\u3001\u5171\u540c\u8fdb\u6b65\uff0c\u63d0\u95ee\u4e0e\u8bc4\u8bba\u4e00\u822c\u80fd\u5728\u4e24\u65e5\u5185\u5f97\u5230\u56de\u590d\uff1b
"},{"location":"chapter_preface/about_the_book/#011","title":"0.1.1. \u00a0 \u8bfb\u8005\u5bf9\u8c61","text":"

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u521d\u5b66\u8005\u300d\uff0c\u5b8c\u5168\u6ca1\u6709\u63a5\u89e6\u8fc7\u7b97\u6cd5\uff0c\u6216\u8005\u5df2\u7ecf\u6709\u5c11\u91cf\u5237\u9898\uff0c\u5bf9\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u6709\u6726\u80e7\u7684\u7406\u89e3\uff0c\u5728\u4f1a\u4e0e\u4e0d\u4f1a\u4e4b\u95f4\u53cd\u590d\u6a2a\u8df3\uff0c\u90a3\u4e48\u8fd9\u672c\u4e66\u5c31\u662f\u4e3a\u4f60\u800c\u5199\uff01

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u8001\u624b\u300d\uff0c\u5df2\u7ecf\u79ef\u7d2f\u4e00\u5b9a\u5237\u9898\u91cf\uff0c\u63a5\u89e6\u8fc7\u5927\u591a\u6570\u9898\u578b\uff0c\u90a3\u4e48\u672c\u4e66\u53ef\u4ee5\u5e2e\u52a9\u4f60\u56de\u987e\u4e0e\u68b3\u7406\u7b97\u6cd5\u77e5\u8bc6\u4f53\u7cfb\uff0c\u4ed3\u5e93\u6e90\u4ee3\u7801\u53ef\u4ee5\u88ab\u5f53\u4f5c\u201c\u5237\u9898\u5de5\u5177\u5e93\u201d\u6216\u201c\u7b97\u6cd5\u5b57\u5178\u201d\u6765\u4f7f\u7528\u3002

\u5982\u679c\u60a8\u662f\u300c\u7b97\u6cd5\u5927\u4f6c\u300d\uff0c\u5e0c\u671b\u53ef\u4ee5\u5f97\u5230\u4f60\u7684\u5b9d\u8d35\u610f\u89c1\u5efa\u8bae\uff0c\u6216\u8005\u4e00\u8d77\u53c2\u4e0e\u521b\u4f5c\u3002

\u524d\u7f6e\u6761\u4ef6

\u60a8\u9700\u8981\u81f3\u5c11\u5177\u5907\u4efb\u4e00\u8bed\u8a00\u7684\u7f16\u7a0b\u57fa\u7840\uff0c\u80fd\u591f\u9605\u8bfb\u548c\u7f16\u5199\u7b80\u5355\u4ee3\u7801\u3002

"},{"location":"chapter_preface/about_the_book/#012","title":"0.1.2. \u00a0 \u5185\u5bb9\u7ed3\u6784","text":"

\u672c\u4e66\u4e3b\u8981\u5185\u5bb9\u6709\uff1a

  • \u590d\u6742\u5ea6\u5206\u6790\uff1a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u8bc4\u4ef7\u7ef4\u5ea6\u3001\u7b97\u6cd5\u6548\u7387\u7684\u8bc4\u4f30\u65b9\u6cd5\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u3001\u7a7a\u95f4\u590d\u6742\u5ea6\uff0c\u5305\u62ec\u63a8\u7b97\u65b9\u6cd5\u3001\u5e38\u89c1\u7c7b\u578b\u3001\u793a\u4f8b\u7b49\u3002
  • \u6570\u636e\u7ed3\u6784\uff1a\u5e38\u7528\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u6570\u636e\u5728\u5185\u5b58\u4e2d\u7684\u5b58\u50a8\u65b9\u5f0f\u3001\u6570\u636e\u7ed3\u6784\u5206\u7c7b\u65b9\u6cd5\u3002\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u6563\u5217\u8868\u3001\u6811\u3001\u5806\u3001\u56fe\u7b49\u6570\u636e\u7ed3\u6784\uff0c\u5185\u5bb9\u5305\u62ec\u5b9a\u4e49\u3001\u4f18\u52a3\u52bf\u3001\u5e38\u7528\u64cd\u4f5c\u3001\u5e38\u89c1\u7c7b\u578b\u3001\u5178\u578b\u5e94\u7528\u3001\u5b9e\u73b0\u65b9\u6cd5\u7b49\u3002
  • \u7b97\u6cd5\uff1a\u67e5\u627e\u7b97\u6cd5\u3001\u6392\u5e8f\u7b97\u6cd5\u3001\u641c\u7d22\u4e0e\u56de\u6eaf\u3001\u52a8\u6001\u89c4\u5212\u3001\u5206\u6cbb\u7b97\u6cd5\uff0c\u5185\u5bb9\u5305\u62ec\u5b9a\u4e49\u3001\u4f7f\u7528\u573a\u666f\u3001\u4f18\u52a3\u52bf\u3001\u65f6\u7a7a\u6548\u7387\u3001\u5b9e\u73b0\u65b9\u6cd5\u3001\u793a\u4f8b\u9898\u76ee\u7b49\u3002

Fig. Hello \u7b97\u6cd5\u5185\u5bb9\u7ed3\u6784

"},{"location":"chapter_preface/about_the_book/#013","title":"0.1.3. \u00a0 \u81f4\u8c22","text":"

\u672c\u4e66\u7684\u6210\u4e66\u8fc7\u7a0b\u4e2d\uff0c\u6211\u83b7\u5f97\u4e86\u8bb8\u591a\u4eba\u7684\u5e2e\u52a9\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a

  • \u611f\u8c22\u6211\u5728\u516c\u53f8\u7684\u5bfc\u5e08\u674e\u6c50\u535a\u58eb\uff0c\u5728\u4e00\u6b21\u7545\u8c08\u65f6\u60a8\u544a\u8bc9\u6211\u201c\u89c9\u5f97\u5e94\u8be5\u505a\u5c31\u53bb\u505a\u201d\uff0c\u575a\u5b9a\u4e86\u6211\u5199\u8fd9\u672c\u4e66\u7684\u51b3\u5fc3\u3002
  • \u611f\u8c22\u6211\u7684\u5973\u670b\u53cb\u6ce1\u6ce1\u62c5\u4efb\u672c\u4e66\u7684\u9996\u4f4d\u8bfb\u8005\uff0c\u4ece\u7b97\u6cd5\u5c0f\u767d\u7684\u89c6\u89d2\u63d0\u51fa\u4e86\u8bb8\u591a\u5efa\u8bae\uff0c\u4f7f\u8fd9\u672c\u4e66\u66f4\u52a0\u9002\u5408\u521d\u5b66\u8005\u6765\u9605\u8bfb\u3002
  • \u611f\u8c22\u817e\u5b9d\u3001\u7426\u5b9d\u3001\u98de\u5b9d\u4e3a\u672c\u4e66\u8d77\u4e86\u4e2a\u597d\u542c\u53c8\u6709\u6897\u540d\u5b57\uff0c\u76f4\u63a5\u5524\u8d77\u6211\u6700\u521d\u6572\u4e0b\u7b2c\u4e00\u884c\u4ee3\u7801 \"Hello World!\" \u7684\u56de\u5fc6\u3002
  • \u611f\u8c22\u82cf\u6f7c\u4e3a\u672c\u4e66\u8bbe\u8ba1\u4e86\u5c01\u9762\u548c LOGO \uff0c\u5728\u6211\u7684\u5f3a\u8feb\u75c7\u4e0b\u524d\u540e\u591a\u6b21\u5e2e\u5fd9\u4fee\u6539\uff0c\u8c22\u8c22\u4f60\u7684\u8010\u5fc3\u3002
  • \u611f\u8c22 @squidfunk \u7ed9\u51fa\u7684\u5199\u4f5c\u6392\u7248\u5efa\u8bae\uff0c\u4ee5\u53ca\u4f18\u79c0\u5f00\u6e90\u9879\u76ee Material-for-MkDocs \u3002

\u672c\u4e66\u9f13\u52b1\u201c\u624b\u8111\u5e76\u7528\u201d\u7684\u5b66\u4e60\u65b9\u5f0f\uff0c\u5728\u8fd9\u70b9\u4e0a\u53d7\u5230\u4e86\u300a\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\u300b\u5f88\u5927\u5f71\u54cd\uff0c\u4e5f\u5728\u6b64\u5411\u5404\u4f4d\u540c\u5b66\u5f3a\u70c8\u63a8\u8350\u8fd9\u672c\u8457\u4f5c\uff0c\u5305\u62ec\u4e2d\u6587\u7248\u3001\u82f1\u6587\u7248\u3001\u674e\u6c90\u8001\u5e08 bilibili \u4e3b\u9875\u3002

\u5728\u5199\u4f5c\u8fc7\u7a0b\u4e2d\uff0c\u6211\u9605\u8bfb\u4e86\u8bb8\u591a\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u6559\u6750\u4e0e\u6587\u7ae0\uff0c\u8fd9\u4e9b\u8457\u4f5c\u4e3a\u672c\u4e66\u4f5c\u51fa\u4e86\u5f88\u597d\u7684\u699c\u6837\uff0c\u4fdd\u8bc1\u4e86\u672c\u4e66\u5185\u5bb9\u7684\u6b63\u786e\u6027\u4e0e\u8d28\u91cf\uff0c\u611f\u8c22\u5404\u4f4d\u8001\u5e08\u4e0e\u524d\u8f88\u7684\u7cbe\u5f69\u521b\u4f5c\uff01

\u611f\u8c22\u7236\u6bcd\uff0c\u4f60\u4eec\u4e00\u8d2f\u7684\u652f\u6301\u4e0e\u9f13\u52b1\u7ed9\u4e86\u6211\u81ea\u7531\u5ea6\u6765\u505a\u8fd9\u4e9b\u6709\u8da3\u7684\u4e8b\u3002

"},{"location":"chapter_preface/suggestions/","title":"0.2. \u00a0 \u5982\u4f55\u4f7f\u7528\u672c\u4e66","text":"

\u5efa\u8bae\u901a\u8bfb\u672c\u8282\u5185\u5bb9\uff0c\u4ee5\u83b7\u53d6\u6700\u4f73\u9605\u8bfb\u4f53\u9a8c\u3002

"},{"location":"chapter_preface/suggestions/#021","title":"0.2.1. \u00a0 \u7b97\u6cd5\u5b66\u4e60\u8def\u7ebf","text":"

\u603b\u4f53\u4e0a\u770b\uff0c\u6211\u8ba4\u4e3a\u53ef\u5c06\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u7684\u8fc7\u7a0b\u5206\u4e3a\u4e09\u4e2a\u9636\u6bb5\u3002

  1. \u7b97\u6cd5\u5165\u95e8\u3002\u719f\u6089\u5404\u79cd\u6570\u636e\u7ed3\u6784\u7684\u7279\u70b9\u3001\u7528\u6cd5\uff0c\u5b66\u4e60\u5404\u79cd\u7b97\u6cd5\u7684\u539f\u7406\u3001\u6d41\u7a0b\u3001\u7528\u9014\u3001\u6548\u7387\u7b49\u3002
  2. \u5237\u7b97\u6cd5\u9898\u3002\u53ef\u4ee5\u5148\u4ece\u70ed\u95e8\u9898\u5355\u5f00\u5237\uff0c\u63a8\u8350\u5251\u6307 Offer\u3001LeetCode Hot 100\uff0c\u5148\u79ef\u7d2f\u81f3\u5c11 100 \u9053\u9898\u91cf\uff0c\u719f\u6089\u5927\u591a\u6570\u7684\u7b97\u6cd5\u95ee\u9898\u3002\u521a\u5f00\u59cb\u5237\u9898\u65f6\uff0c\u201c\u9057\u5fd8\u201d\u662f\u6700\u5927\u7684\u56f0\u6270\u70b9\uff0c\u4f46\u8fd9\u662f\u5f88\u6b63\u5e38\u7684\uff0c\u8bf7\u4e0d\u8981\u62c5\u5fc3\u3002\u5b66\u4e60\u4e2d\u6709\u4e00\u79cd\u6982\u5ff5\u53eb\u201c\u5468\u671f\u6027\u56de\u987e\u201d\uff0c\u540c\u4e00\u9053\u9898\u9694\u6bb5\u65f6\u95f4\u505a\u4e00\u6b21\uff0c\u5728\u91cd\u590d 3 \u8f6e\u4ee5\u4e0a\u540e\uff0c\u5f80\u5f80\u5c31\u80fd\u7262\u8bb0\u4e8e\u5fc3\u4e86\u3002
  3. \u642d\u5efa\u77e5\u8bc6\u4f53\u7cfb\u3002\u5728\u5b66\u4e60\u65b9\u9762\uff0c\u53ef\u4ee5\u9605\u8bfb\u7b97\u6cd5\u4e13\u680f\u6587\u7ae0\u3001\u89e3\u9898\u6846\u67b6\u3001\u7b97\u6cd5\u6559\u6750\uff0c\u4e0d\u65ad\u5730\u4e30\u5bcc\u77e5\u8bc6\u4f53\u7cfb\u3002\u5728\u5237\u9898\u65b9\u9762\uff0c\u53ef\u4ee5\u5f00\u59cb\u91c7\u7528\u8fdb\u9636\u5237\u9898\u65b9\u6848\uff0c\u4f8b\u5982\u6309\u4e13\u9898\u5206\u7c7b\u3001\u4e00\u9898\u591a\u89e3\u3001\u4e00\u89e3\u591a\u9898\u7b49\uff0c\u76f8\u5173\u5237\u9898\u5fc3\u5f97\u53ef\u4ee5\u5728\u5404\u4e2a\u793e\u533a\u4e2d\u627e\u5230\u3002

\u4f5c\u4e3a\u4e00\u672c\u5165\u95e8\u6559\u7a0b\uff0c\u672c\u4e66\u5185\u5bb9\u4e3b\u8981\u5bf9\u5e94\u201c\u7b2c\u4e00\u9636\u6bb5\u201d\uff0c\u81f4\u529b\u4e8e\u5e2e\u52a9\u4f60\u66f4\u9ad8\u6548\u5730\u5f00\u5c55\u7b2c\u4e8c\u3001\u4e09\u9636\u6bb5\u7684\u5b66\u4e60\u3002

Fig. \u7b97\u6cd5\u5b66\u4e60\u8def\u7ebf

"},{"location":"chapter_preface/suggestions/#022","title":"0.2.2. \u00a0 \u884c\u6587\u98ce\u683c\u7ea6\u5b9a","text":"

\u6807\u9898\u540e\u6807\u6ce8 * \u7684\u662f\u9009\u8bfb\u7ae0\u8282\uff0c\u5185\u5bb9\u76f8\u5bf9\u8f83\u96be\u3002\u5982\u679c\u4f60\u7684\u65f6\u95f4\u6709\u9650\uff0c\u5efa\u8bae\u53ef\u4ee5\u5148\u8df3\u8fc7\u3002

\u6587\u7ae0\u4e2d\u7684\u91cd\u8981\u540d\u8bcd\u4f1a\u7528 \u300c\u62ec\u53f7\u300d \u6807\u6ce8\uff0c\u4f8b\u5982 \u300c\u6570\u7ec4 Array\u300d \u3002\u5efa\u8bae\u8bb0\u4f4f\u8fd9\u4e9b\u540d\u8bcd\uff0c\u5305\u62ec\u82f1\u6587\u7ffb\u8bd1\uff0c\u4ee5\u4fbf\u540e\u7eed\u9605\u8bfb\u6587\u732e\u65f6\u4f7f\u7528\u3002

\u91cd\u70b9\u5185\u5bb9\u3001\u603b\u8d77\u53e5\u3001\u603b\u7ed3\u53e5\u4f1a\u88ab \u52a0\u7c97 \uff0c\u6b64\u7c7b\u6587\u5b57\u503c\u5f97\u7279\u522b\u5173\u6ce8\u3002

\u4e13\u6709\u540d\u8bcd\u548c\u6709\u7279\u6307\u542b\u4e49\u7684\u8bcd\u53e5\u4f1a\u4f7f\u7528 \u201c\u53cc\u5f15\u53f7\u201d \u6807\u6ce8\uff0c\u4ee5\u907f\u514d\u6b67\u4e49\u3002

\u672c\u4e66\u90e8\u5206\u653e\u5f03\u4e86\u7f16\u7a0b\u8bed\u8a00\u7684\u6ce8\u91ca\u89c4\u8303\uff0c\u4ee5\u6362\u53d6\u66f4\u52a0\u7d27\u51d1\u7684\u5185\u5bb9\u6392\u7248\u3002\u6ce8\u91ca\u4e3b\u8981\u5206\u4e3a\u4e09\u79cd\u7c7b\u578b\uff1a\u6807\u9898\u6ce8\u91ca\u3001\u5185\u5bb9\u6ce8\u91ca\u3001\u591a\u884c\u6ce8\u91ca\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
\"\"\" \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 \"\"\"\n# \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n\"\"\"\n\u591a\u884c\n\u6ce8\u91ca\n\"\"\"\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
/* \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49 */\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n/**\n * \u591a\u884c\n * \u6ce8\u91ca\n */\n
// \u6807\u9898\u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u6ce8\u51fd\u6570\u3001\u7c7b\u3001\u6d4b\u8bd5\u6837\u4f8b\u7b49\n// \u5185\u5bb9\u6ce8\u91ca\uff0c\u7528\u4e8e\u8be6\u89e3\u4ee3\u7801\n// \u591a\u884c\n// \u6ce8\u91ca\n
"},{"location":"chapter_preface/suggestions/#023","title":"0.2.3. \u00a0 \u5728\u52a8\u753b\u56fe\u89e3\u4e2d\u9ad8\u6548\u5b66\u4e60","text":"

\u89c6\u9891\u548c\u56fe\u7247\u76f8\u6bd4\u4e8e\u6587\u5b57\u7684\u4fe1\u606f\u5bc6\u5ea6\u548c\u7ed3\u6784\u5316\u7a0b\u5ea6\u66f4\u9ad8\uff0c\u66f4\u5bb9\u6613\u7406\u89e3\u3002\u5728\u672c\u4e66\u4e2d\uff0c\u77e5\u8bc6\u91cd\u96be\u70b9\u4f1a\u4e3b\u8981\u4ee5\u52a8\u753b\u3001\u56fe\u89e3\u7684\u5f62\u5f0f\u5448\u73b0\uff0c\u800c\u6587\u5b57\u7684\u4f5c\u7528\u5219\u662f\u4f5c\u4e3a\u52a8\u753b\u548c\u56fe\u7684\u89e3\u91ca\u4e0e\u8865\u5145\u3002

\u9605\u8bfb\u672c\u4e66\u65f6\uff0c\u82e5\u53d1\u73b0\u67d0\u6bb5\u5185\u5bb9\u63d0\u4f9b\u4e86\u52a8\u753b\u6216\u56fe\u89e3\uff0c\u5efa\u8bae\u4f60\u4ee5\u56fe\u4e3a\u4e3b\u7ebf\uff0c\u5c06\u6587\u5b57\u5185\u5bb9\uff08\u4e00\u822c\u5728\u56fe\u7684\u4e0a\u65b9\uff09\u5bf9\u9f50\u5230\u56fe\u4e2d\u5185\u5bb9\uff0c\u7efc\u5408\u6765\u7406\u89e3\u3002

Fig. \u52a8\u753b\u56fe\u89e3\u793a\u4f8b

"},{"location":"chapter_preface/suggestions/#024","title":"0.2.4. \u00a0 \u5728\u4ee3\u7801\u5b9e\u8df5\u4e2d\u52a0\u6df1\u7406\u89e3","text":"

\u672c\u4e66\u7684\u914d\u5957\u4ee3\u7801\u6258\u7ba1\u5728GitHub \u4ed3\u5e93\uff0c\u6e90\u4ee3\u7801\u5305\u542b\u8be6\u7ec6\u6ce8\u91ca\uff0c\u914d\u6709\u6d4b\u8bd5\u6837\u4f8b\uff0c\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u3002

  • \u82e5\u5b66\u4e60\u65f6\u95f4\u7d27\u5f20\uff0c\u5efa\u8bae\u81f3\u5c11\u5c06\u6240\u6709\u4ee3\u7801\u901a\u8bfb\u5e76\u8fd0\u884c\u4e00\u904d\u3002
  • \u82e5\u65f6\u95f4\u5141\u8bb8\uff0c\u5f3a\u70c8\u5efa\u8bae\u5bf9\u7167\u7740\u4ee3\u7801\u81ea\u5df1\u6572\u4e00\u904d\u3002\u76f8\u6bd4\u4e8e\u8bfb\u4ee3\u7801\uff0c\u5199\u4ee3\u7801\u7684\u8fc7\u7a0b\u5f80\u5f80\u80fd\u5e26\u6765\u65b0\u7684\u6536\u83b7\u3002

Fig. \u8fd0\u884c\u4ee3\u7801\u793a\u4f8b

\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5\u672c\u5730\u7f16\u7a0b\u73af\u5883\u3002\u53c2\u7167\u9644\u5f55\u6559\u7a0b\uff0c\u5982\u679c\u5df2\u6709\u53ef\u76f4\u63a5\u8df3\u8fc7\u3002

\u7b2c\u4e8c\u6b65\uff1a\u4e0b\u8f7d\u4ee3\u7801\u4ed3\u3002\u5982\u679c\u5df2\u7ecf\u5b89\u88c5 Git \uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u514b\u9686\u4ee3\u7801\u4ed3\u3002

git clone https://github.com/krahets/hello-algo.git\n

\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u70b9\u51fb\u201cDownload ZIP\u201d\u76f4\u63a5\u4e0b\u8f7d\u4ee3\u7801\u538b\u7f29\u5305\uff0c\u672c\u5730\u89e3\u538b\u5373\u53ef\u3002

Fig. \u514b\u9686\u4ed3\u5e93\u4e0e\u4e0b\u8f7d\u4ee3\u7801

\u7b2c\u4e09\u6b65\uff1a\u8fd0\u884c\u6e90\u4ee3\u7801\u3002\u82e5\u4ee3\u7801\u5757\u7684\u9876\u90e8\u6807\u6709\u6587\u4ef6\u540d\u79f0\uff0c\u5219\u53ef\u5728\u4ed3\u5e93 codes \u6587\u4ef6\u5939\u4e2d\u627e\u5230\u5bf9\u5e94\u7684 \u6e90\u4ee3\u7801\u6587\u4ef6\u3002\u6e90\u4ee3\u7801\u6587\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7701\u53bb\u4e0d\u5fc5\u8981\u7684\u8c03\u8bd5\u65f6\u95f4\uff0c\u5c06\u7cbe\u529b\u96c6\u4e2d\u5728\u5b66\u4e60\u5185\u5bb9\u4e0a\u3002

Fig. \u4ee3\u7801\u5757\u4e0e\u5bf9\u5e94\u7684\u6e90\u4ee3\u7801\u6587\u4ef6

"},{"location":"chapter_preface/suggestions/#025","title":"0.2.5. \u00a0 \u5728\u63d0\u95ee\u8ba8\u8bba\u4e2d\u5171\u540c\u6210\u957f","text":"

\u9605\u8bfb\u672c\u4e66\u65f6\uff0c\u8bf7\u4e0d\u8981\u201c\u60ef\u7740\u201d\u90a3\u4e9b\u5f04\u4e0d\u660e\u767d\u7684\u77e5\u8bc6\u70b9\u3002\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u4e0b\u4f60\u7684\u95ee\u9898\uff0c\u5c0f\u4f19\u4f34\u4eec\u548c\u6211\u90fd\u4f1a\u7ed9\u4e88\u89e3\u7b54\uff0c\u60a8\u4e00\u822c 2 \u65e5\u5185\u4f1a\u5f97\u5230\u56de\u590d\u3002

\u540c\u65f6\uff0c\u4e5f\u5e0c\u671b\u4f60\u53ef\u4ee5\u591a\u82b1\u65f6\u95f4\u901b\u901b\u8bc4\u8bba\u533a\u3002\u4e00\u65b9\u9762\uff0c\u53ef\u4ee5\u770b\u770b\u5927\u5bb6\u9047\u5230\u4e86\u4ec0\u4e48\u95ee\u9898\uff0c\u53cd\u8fc7\u6765\u67e5\u6f0f\u8865\u7f3a\uff0c\u8fd9\u5f80\u5f80\u53ef\u4ee5\u5f15\u8d77\u66f4\u52a0\u6df1\u5ea6\u7684\u601d\u8003\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4e5f\u5e0c\u671b\u4f60\u53ef\u4ee5\u6177\u6168\u5730\u89e3\u7b54\u5c0f\u4f19\u4f34\u4eec\u7684\u95ee\u9898\u3001\u5206\u4eab\u81ea\u5df1\u7684\u89c1\u89e3\uff0c\u5927\u5bb6\u4e92\u76f8\u5b66\u4e60\u4e0e\u8fdb\u6b65\uff01

Fig. \u8bc4\u8bba\u533a\u793a\u4f8b

"},{"location":"chapter_preface/summary/","title":"0.3. \u00a0 \u5c0f\u7ed3","text":"
  • \u672c\u4e66\u4e3b\u8981\u9762\u5411\u7b97\u6cd5\u521d\u5b66\u8005\u3002\u5bf9\u4e8e\u5df2\u7ecf\u6709\u4e00\u5b9a\u79ef\u7d2f\u7684\u540c\u5b66\uff0c\u8fd9\u672c\u4e66\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7cfb\u7edf\u56de\u987e\u7b97\u6cd5\u77e5\u8bc6\uff0c\u6e90\u4ee3\u7801\u53ef\u88ab\u5f53\u4f5c\u201c\u5237\u9898\u5de5\u5177\u5e93\u201d\u6765\u4f7f\u7528\u3002
  • \u4e66\u4e2d\u5185\u5bb9\u4e3b\u8981\u5206\u4e3a\u590d\u6742\u5ea6\u5206\u6790\u3001\u6570\u636e\u7ed3\u6784\u3001\u7b97\u6cd5\u4e09\u90e8\u5206\uff0c\u8986\u76d6\u4e86\u8be5\u9886\u57df\u7684\u5927\u90e8\u5206\u4e3b\u9898\u3002
  • \u5bf9\u4e8e\u7b97\u6cd5\u5c0f\u767d\uff0c\u5728\u521d\u5b66\u9636\u6bb5\u9605\u8bfb\u4e00\u672c\u5165\u95e8\u4e66\u662f\u975e\u5e38\u6709\u5fc5\u8981\u7684\uff0c\u53ef\u4ee5\u5c11\u8d70\u8bb8\u591a\u5f2f\u8def\u3002
  • \u4e66\u5185\u7684\u52a8\u753b\u548c\u56fe\u89e3\u5f80\u5f80\u4ecb\u7ecd\u7684\u662f\u91cd\u70b9\u548c\u96be\u70b9\u77e5\u8bc6\uff0c\u5728\u9605\u8bfb\u65f6\u5e94\u8be5\u591a\u52a0\u5173\u6ce8\u3002
  • \u5b9e\u8df5\u662f\u5b66\u4e60\u7f16\u7a0b\u7684\u6700\u4f73\u65b9\u5f0f\uff0c\u5f3a\u70c8\u63a8\u8350\u8fd0\u884c\u6e90\u4ee3\u7801\uff0c\u52a8\u624b\u6572\u4ee3\u7801\u3002
  • \u672c\u4e66\u63d0\u4f9b\u4e86\u8ba8\u8bba\u533a\uff0c\u9047\u5230\u7591\u60d1\u53ef\u4ee5\u968f\u65f6\u63d0\u95ee\u3002
"},{"location":"chapter_reference/","title":"\u53c2\u8003\u6587\u732e","text":"

[1] Thomas H. Cormen, et al. Introduction to Algorithms (3rd Edition).

[2] Aditya Bhargava. Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People (1st Edition).

[3] \u4e25\u851a\u654f. \u6570\u636e\u7ed3\u6784\uff08 C \u8bed\u8a00\u7248\uff09.

[4] \u9093\u4fca\u8f89. \u6570\u636e\u7ed3\u6784\uff08 C++ \u8bed\u8a00\u7248\uff0c\u7b2c\u4e09\u7248\uff09.

[5] \u9a6c\u514b\u00b7\u827e\u4f26\u00b7\u7ef4\u65af\u8457\uff0c\u9648\u8d8a\u8bd1. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u5206\u6790\uff1aJava\u8bed\u8a00\u63cf\u8ff0\uff08\u7b2c\u4e09\u7248\uff09.

[6] \u7a0b\u6770. \u5927\u8bdd\u6570\u636e\u7ed3\u6784.

[7] \u738b\u4e89. \u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e4b\u7f8e.

[8] Gayle Laakmann McDowell. Cracking the Coding Interview: 189 Programming Questions and Solutions (6th Edition).

[9] Aston Zhang, et al. Dive into Deep Learning.

"},{"location":"chapter_searching/binary_search/","title":"10.2. \u00a0 \u4e8c\u5206\u67e5\u627e","text":"

\u300c\u4e8c\u5206\u67e5\u627e Binary Search\u300d\u5229\u7528\u6570\u636e\u7684\u6709\u5e8f\u6027\uff0c\u901a\u8fc7\u6bcf\u8f6e\u7f29\u5c0f\u4e00\u534a\u641c\u7d22\u533a\u95f4\u6765\u67e5\u627e\u76ee\u6807\u5143\u7d20\u3002

\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\u6709\u4e24\u4e2a\u524d\u7f6e\u6761\u4ef6\uff1a

  • \u8981\u6c42\u8f93\u5165\u6570\u636e\u662f\u6709\u5e8f\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u901a\u8fc7\u5224\u65ad\u5927\u5c0f\u5173\u7cfb\u6765\u6392\u9664\u4e00\u534a\u7684\u641c\u7d22\u533a\u95f4\uff1b
  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\uff0c\u800c\u5728\u94fe\u8868\u4e2d\u4f7f\u7528\u6548\u7387\u5f88\u4f4e\uff0c\u56e0\u4e3a\u5176\u5728\u5faa\u73af\u4e2d\u9700\u8981\u8df3\u8dc3\u5f0f\uff08\u975e\u8fde\u7eed\u5730\uff09\u8bbf\u95ee\u5143\u7d20\u3002
"},{"location":"chapter_searching/binary_search/#1021","title":"10.2.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u7ed9\u5b9a\u4e00\u4e2a\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6392\u5e8f\u6570\u7ec4 nums \uff0c\u5143\u7d20\u4ece\u5c0f\u5230\u5927\u6392\u5217\u3002\u6570\u7ec4\u7684\u7d22\u5f15\u53d6\u503c\u8303\u56f4\u4e3a

\\[ 0, 1, 2, \\cdots, n-1 \\]

\u4f7f\u7528\u300c\u533a\u95f4\u300d\u6765\u8868\u793a\u8fd9\u4e2a\u53d6\u503c\u8303\u56f4\u7684\u65b9\u6cd5\u4e3b\u8981\u6709\u4e24\u79cd\uff1a

  1. \u53cc\u95ed\u533a\u95f4 \\([0, n-1]\\) \uff0c\u5373\u4e24\u4e2a\u8fb9\u754c\u90fd\u5305\u542b\u81ea\u8eab\uff1b\u6b64\u65b9\u6cd5\u4e0b\uff0c\u533a\u95f4 \\([0, 0]\\) \u4ecd\u5305\u542b\u4e00\u4e2a\u5143\u7d20\uff1b
  2. \u5de6\u95ed\u53f3\u5f00 \\([0, n)\\) \uff0c\u5373\u5de6\u8fb9\u754c\u5305\u542b\u81ea\u8eab\u3001\u53f3\u8fb9\u754c\u4e0d\u5305\u542b\u81ea\u8eab\uff1b\u6b64\u65b9\u6cd5\u4e0b\uff0c\u533a\u95f4 \\([0, 0)\\) \u4e3a\u7a7a\uff1b
"},{"location":"chapter_searching/binary_search/#_1","title":"\u201c\u53cc\u95ed\u533a\u95f4\u201d\u5b9e\u73b0","text":"

\u9996\u5148\uff0c\u6211\u4eec\u5148\u91c7\u7528\u201c\u53cc\u95ed\u533a\u95f4\u201d\u7684\u8868\u793a\uff0c\u5728\u6570\u7ec4 nums \u4e2d\u67e5\u627e\u76ee\u6807\u5143\u7d20 target \u7684\u5bf9\u5e94\u7d22\u5f15\u3002

<1><2><3><4><5><6><7>

\u4e8c\u5206\u67e5\u627e\u201c\u53cc\u95ed\u533a\u95f4\u201d\u8868\u793a\u4e0b\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search.java
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(int[] nums, int target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.cpp
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(vector<int>& nums, int target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.size() - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.py
def binary_search(nums: List[int], target: int) -> int:\n\"\"\" \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 \"\"\"\n# \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\ni, j = 0, len(nums) - 1\nwhile i <= j:\nm = (i + j) // 2        # \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target:    # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\nelif nums[m] > target:  # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\nelse:\nreturn m            # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn -1                   # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
binary_search.go
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunc binarySearch(nums []int, target int) int {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\ni, j := 0, len(nums)-1\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nfor i <= j {\nm := (i + j) / 2      // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.js
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunction binarySearch(nums, target) {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nlet i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nconst m = parseInt((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m \uff0c\u5728 JS \u4e2d\u9700\u4f7f\u7528 parseInt \u51fd\u6570\u53d6\u6574\nif (nums[m] < target)          // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target)     // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse\nreturn m;                  // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.ts
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunction binarySearch(nums: number[], target: number): number {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nlet i = 0, j = nums.length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nconst m = Math.floor((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target) {        // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\n} else if (nums[m] > target) { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\n} else {                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n}\nreturn -1; // \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n}\n
binary_search.c
[class]{}-[func]{binarySearch}\n
binary_search.cs
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nint binarySearch(int[] nums, int target)\n{\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nint i = 0, j = nums.Length - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j)\n{\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.swift
/* \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09 */\nfunc binarySearch(nums: [Int], target: Int) -> Int {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nvar i = 0\nvar j = nums.count - 1\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile i <= j {\nlet m = (i + j) / 2 // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.zig
// \u4e8c\u5206\u67e5\u627e\uff08\u53cc\u95ed\u533a\u95f4\uff09\nfn binarySearch(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u521d\u59cb\u5316\u53cc\u95ed\u533a\u95f4 [0, n-1] \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20\nvar i: usize = 0;\nvar j: usize = nums.items.len - 1;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i > j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nvar m = (i + j) / 2;                    // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums.items[m] < target) {           // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j] \u4e2d\ni = m + 1;\n} else if (nums.items[m] > target) {    // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m-1] \u4e2d\nj = m - 1;\n} else {                                // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn @intCast(T, m);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
"},{"location":"chapter_searching/binary_search/#_2","title":"\u201c\u5de6\u95ed\u53f3\u5f00\u201d\u5b9e\u73b0","text":"

\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528\u201c\u5de6\u95ed\u53f3\u5f00\u201d\u7684\u8868\u793a\u65b9\u6cd5\uff0c\u5199\u51fa\u76f8\u540c\u529f\u80fd\u7684\u4e8c\u5206\u67e5\u627e\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search.java
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(int[] nums, int target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.cpp
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(vector<int>& nums, int target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.size();\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.py
def binary_search1(nums: List[int], target: int) -> int:\n\"\"\" \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 \"\"\"\n# \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\ni, j = 0, len(nums)\n# \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile i < j:\nm = (i + j) // 2        # \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target:    # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\nelif nums[m] > target:  # \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\nelse:                   # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\nreturn -1                   # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
binary_search.go
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunc binarySearch1(nums []int, target int) int {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\ni, j := 0, len(nums)\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nfor i < j {\nm := (i + j) / 2      // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.js
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunction binarySearch1(nums, target) {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nlet i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nconst m = parseInt((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m \uff0c\u5728 JS \u4e2d\u9700\u4f7f\u7528 parseInt \u51fd\u6570\u53d6\u6574\nif (nums[m] < target)          // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target)     // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                           // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.ts
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunction binarySearch1(nums: number[], target: number): number {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nlet i = 0, j = nums.length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j) {\nconst m = Math.floor((i + j) / 2); // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target) {        // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\n} else if (nums[m] > target) { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\n} else {                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n}\nreturn -1; // \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n}\n
binary_search.c
[class]{}-[func]{binarySearch1}\n
binary_search.cs
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nint binarySearch1(int[] nums, int target)\n{\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nint i = 0, j = nums.Length;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i < j)\n{\nint m = (i + j) / 2;       // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums[m] < target)      // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\nelse if (nums[m] > target) // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\nelse                       // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
binary_search.swift
/* \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09 */\nfunc binarySearch1(nums: [Int], target: Int) -> Int {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nvar i = 0\nvar j = nums.count\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile i < j {\nlet m = (i + j) / 2 // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif nums[m] < target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1\n} else if nums[m] > target { // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m\n} else { // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn m\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
binary_search.zig
// \u4e8c\u5206\u67e5\u627e\uff08\u5de6\u95ed\u53f3\u5f00\uff09\nfn binarySearch1(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u521d\u59cb\u5316\u5de6\u95ed\u53f3\u5f00 [0, n) \uff0c\u5373 i, j \u5206\u522b\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u3001\u5c3e\u5143\u7d20+1\nvar i: usize = 0;\nvar j: usize = nums.items.len;\n// \u5faa\u73af\uff0c\u5f53\u641c\u7d22\u533a\u95f4\u4e3a\u7a7a\u65f6\u8df3\u51fa\uff08\u5f53 i = j \u65f6\u4e3a\u7a7a\uff09\nwhile (i <= j) {\nvar m = (i + j) / 2;                    // \u8ba1\u7b97\u4e2d\u70b9\u7d22\u5f15 m\nif (nums.items[m] < target) {           // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [m+1, j) \u4e2d\ni = m + 1;\n} else if (nums.items[m] > target) {    // \u6b64\u60c5\u51b5\u8bf4\u660e target \u5728\u533a\u95f4 [i, m) \u4e2d\nj = m;\n} else {                                // \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn @intCast(T, m);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
"},{"location":"chapter_searching/binary_search/#_3","title":"\u4e24\u79cd\u8868\u793a\u5bf9\u6bd4","text":"

\u5bf9\u6bd4\u4e0b\u6765\uff0c\u4e24\u79cd\u8868\u793a\u7684\u4ee3\u7801\u5199\u6cd5\u6709\u4ee5\u4e0b\u4e0d\u540c\u70b9\uff1a

\u8868\u793a\u65b9\u6cd5 \u521d\u59cb\u5316\u6307\u9488 \u7f29\u5c0f\u533a\u95f4 \u5faa\u73af\u7ec8\u6b62\u6761\u4ef6 \u53cc\u95ed\u533a\u95f4 \\([0, n-1]\\) \\(i = 0\\) , \\(j = n-1\\) \\(i = m + 1\\) , \\(j = m - 1\\) \\(i > j\\) \u5de6\u95ed\u53f3\u5f00 \\([0, n)\\) \\(i = 0\\) , \\(j = n\\) \\(i = m + 1\\) , \\(j = m\\) \\(i = j\\)

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5728\u201c\u53cc\u95ed\u533a\u95f4\u201d\u8868\u793a\u4e2d\uff0c\u7531\u4e8e\u5bf9\u5de6\u53f3\u4e24\u8fb9\u754c\u7684\u5b9a\u4e49\u662f\u76f8\u540c\u7684\uff0c\u56e0\u6b64\u7f29\u5c0f\u533a\u95f4\u7684 \\(i\\) , \\(j\\) \u5904\u7406\u65b9\u6cd5\u4e5f\u662f\u5bf9\u79f0\u7684\uff0c\u8fd9\u6837\u66f4\u4e0d\u5bb9\u6613\u51fa\u9519\u3002\u7efc\u4e0a\u6240\u8ff0\uff0c\u5efa\u8bae\u4f60\u91c7\u7528\u201c\u53cc\u95ed\u533a\u95f4\u201d\u7684\u5199\u6cd5\u3002

"},{"location":"chapter_searching/binary_search/#_4","title":"\u5927\u6570\u8d8a\u754c\u5904\u7406","text":"

\u5f53\u6570\u7ec4\u957f\u5ea6\u5f88\u5927\u65f6\uff0c\u52a0\u6cd5 \\(i + j\\) \u7684\u7ed3\u679c\u6709\u53ef\u80fd\u4f1a\u8d85\u51fa int \u7c7b\u578b\u7684\u53d6\u503c\u8303\u56f4\u3002\u5728\u6b64\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u6362\u4e00\u79cd\u8ba1\u7b97\u4e2d\u70b9\u7684\u5199\u6cd5\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
# Python \u4e2d\u7684\u6570\u5b57\u7406\u8bba\u4e0a\u53ef\u4ee5\u65e0\u9650\u5927\uff08\u53d6\u51b3\u4e8e\u5185\u5b58\u5927\u5c0f\uff09\n# \u56e0\u6b64\u65e0\u9700\u8003\u8651\u5927\u6570\u8d8a\u754c\u95ee\u9898\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nm := (i + j) / 2\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nm := i + (j - i) / 2\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nlet m = parseInt((i + j) / 2);\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = parseInt(i + (j - i) / 2);\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa Number \u7684\u53d6\u503c\u8303\u56f4\nlet m = Math.floor((i + j) / 2);\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = Math.floor(i + (j - i) / 2);\n
\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nint m = (i + j) / 2;\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nint m = i + (j - i) / 2;\n
// (i + j) \u6709\u53ef\u80fd\u8d85\u51fa int \u7684\u53d6\u503c\u8303\u56f4\nlet m = (i + j) / 2\n// \u66f4\u6362\u4e3a\u6b64\u5199\u6cd5\u5219\u4e0d\u4f1a\u8d8a\u754c\nlet m = i + (j - 1) / 2\n
\n
"},{"location":"chapter_searching/binary_search/#1022","title":"10.2.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(\\log n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\uff1b\u6bcf\u8f6e\u6392\u9664\u4e00\u534a\u7684\u533a\u95f4\uff0c\u56e0\u6b64\u5faa\u73af\u8f6e\u6570\u4e3a \\(\\log_2 n\\) \uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 i , j \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7a7a\u95f4\u3002

"},{"location":"chapter_searching/binary_search/#1023","title":"10.2.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u4e8c\u5206\u67e5\u627e\u6548\u7387\u5f88\u9ad8\uff0c\u4f53\u73b0\u5728\uff1a

  • \u4e8c\u5206\u67e5\u627e\u65f6\u95f4\u590d\u6742\u5ea6\u4f4e\u3002\u5bf9\u6570\u9636\u5728\u6570\u636e\u91cf\u5f88\u5927\u65f6\u5177\u6709\u5de8\u5927\u4f18\u52bf\uff0c\u4f8b\u5982\uff0c\u5f53\u6570\u636e\u5927\u5c0f \\(n = 2^{20}\\) \u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u9700\u8981 \\(2^{20} = 1048576\\) \u8f6e\u5faa\u73af\uff0c\u800c\u4e8c\u5206\u67e5\u627e\u4ec5\u9700\u8981 \\(\\log_2 2^{20} = 20\\) \u8f6e\u5faa\u73af\u3002
  • \u4e8c\u5206\u67e5\u627e\u4e0d\u9700\u8981\u989d\u5916\u7a7a\u95f4\u3002\u76f8\u5bf9\u4e8e\u501f\u52a9\u989d\u5916\u6570\u636e\u7ed3\u6784\u6765\u5b9e\u73b0\u67e5\u627e\u7684\u7b97\u6cd5\u6765\u8bf4\uff0c\u5176\u66f4\u52a0\u8282\u7ea6\u7a7a\u95f4\u4f7f\u7528\u3002

\u4f46\u5e76\u4e0d\u610f\u5473\u7740\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u5e94\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6709\u5e8f\u6570\u636e\u3002\u5982\u679c\u8f93\u5165\u6570\u636e\u662f\u65e0\u5e8f\u7684\uff0c\u4e3a\u4e86\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\u800c\u4e13\u95e8\u6267\u884c\u6570\u636e\u6392\u5e8f\uff0c\u90a3\u4e48\u662f\u5f97\u4e0d\u507f\u5931\u7684\uff0c\u56e0\u4e3a\u6392\u5e8f\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e00\u822c\u4e3a \\(O(n \\log n)\\) \uff0c\u6bd4\u7ebf\u6027\u67e5\u627e\u548c\u4e8c\u5206\u67e5\u627e\u90fd\u66f4\u5dee\u3002\u518d\u4f8b\u5982\uff0c\u5bf9\u4e8e\u9891\u7e41\u63d2\u5165\u5143\u7d20\u7684\u573a\u666f\uff0c\u4e3a\u4e86\u4fdd\u6301\u6570\u7ec4\u7684\u6709\u5e8f\u6027\uff0c\u9700\u8981\u5c06\u5143\u7d20\u63d2\u5165\u5230\u7279\u5b9a\u4f4d\u7f6e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u4e5f\u662f\u975e\u5e38\u6602\u8d35\u7684\u3002
  • \u4e8c\u5206\u67e5\u627e\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\u3002\u7531\u4e8e\u5728\u4e8c\u5206\u67e5\u627e\u4e2d\uff0c\u8bbf\u95ee\u7d22\u5f15\u662f \u201c\u975e\u8fde\u7eed\u201d \u7684\uff0c\u56e0\u6b64\u94fe\u8868\u6216\u8005\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u90fd\u65e0\u6cd5\u4f7f\u7528\u3002
  • \u5728\u5c0f\u6570\u636e\u91cf\u4e0b\uff0c\u7ebf\u6027\u67e5\u627e\u7684\u6027\u80fd\u66f4\u597d\u3002\u5728\u7ebf\u6027\u67e5\u627e\u4e2d\uff0c\u6bcf\u8f6e\u53ea\u9700\u8981 1 \u6b21\u5224\u65ad\u64cd\u4f5c\uff1b\u800c\u5728\u4e8c\u5206\u67e5\u627e\u4e2d\uff0c\u9700\u8981 1 \u6b21\u52a0\u6cd5\u30011 \u6b21\u9664\u6cd5\u30011 ~ 3 \u6b21\u5224\u65ad\u64cd\u4f5c\u30011 \u6b21\u52a0\u6cd5\uff08\u51cf\u6cd5\uff09\uff0c\u5171 4 ~ 6 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u56e0\u6b64\uff0c\u5728\u6570\u636e\u91cf \\(n\\) \u8f83\u5c0f\u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u53cd\u800c\u6bd4\u4e8c\u5206\u67e5\u627e\u66f4\u5feb\u3002
"},{"location":"chapter_searching/hashing_search/","title":"10.3. \u00a0 \u54c8\u5e0c\u67e5\u627e","text":"

Question

\u5728\u6570\u636e\u91cf\u5f88\u5927\u65f6\uff0c\u300c\u7ebf\u6027\u67e5\u627e\u300d\u592a\u6162\uff1b\u800c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u8981\u6c42\u6570\u636e\u5fc5\u987b\u662f\u6709\u5e8f\u7684\uff0c\u5e76\u4e14\u53ea\u80fd\u5728\u6570\u7ec4\u4e2d\u5e94\u7528\u3002\u90a3\u4e48\u662f\u5426\u6709\u65b9\u6cd5\u53ef\u4ee5\u540c\u65f6\u907f\u514d\u4e0a\u8ff0\u7f3a\u70b9\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\uff0c\u6b64\u65b9\u6cd5\u88ab\u79f0\u4e3a\u300c\u54c8\u5e0c\u67e5\u627e\u300d\u3002

\u300c\u54c8\u5e0c\u67e5\u627e Hash Searching\u300d\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\u6765\u5b58\u50a8\u9700\u8981\u7684\u300c\u952e\u503c\u5bf9 Key Value Pair\u300d\uff0c\u6211\u4eec\u53ef\u4ee5\u5728 \\(O(1)\\) \u65f6\u95f4\u4e0b\u5b9e\u73b0\u201c\u952e \\(\\rightarrow\\) \u503c\u201d\u6620\u5c04\u67e5\u627e\uff0c\u4f53\u73b0\u7740\u201c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u201d\u7684\u7b97\u6cd5\u601d\u60f3\u3002

"},{"location":"chapter_searching/hashing_search/#1031","title":"10.3.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u5982\u679c\u6211\u4eec\u60f3\u8981\u7ed9\u5b9a\u6570\u7ec4\u4e2d\u7684\u4e00\u4e2a\u76ee\u6807\u5143\u7d20 target \uff0c\u83b7\u53d6\u8be5\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u90a3\u4e48\u53ef\u4ee5\u501f\u52a9\u4e00\u4e2a\u54c8\u5e0c\u8868\u5b9e\u73b0\u67e5\u627e\u3002

Fig. \u54c8\u5e0c\u67e5\u627e\u6570\u7ec4\u7d22\u5f15

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hashing_search.java
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(Map<Integer, Integer> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.getOrDefault(target, -1);\n}\n
hashing_search.cpp
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(unordered_map<int, int> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nif (map.find(target) == map.end())\nreturn -1;\nreturn map[target];\n}\n
hashing_search.py
def hashing_search_array(mapp: Dict[int, int], target: int) -> int:\n\"\"\" \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 \"\"\"\n# \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n# \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn mapp.get(target, -1)\n
hashing_search.go
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc hashingSearchArray(m map[int]int, target int) int {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nif index, ok := m[target]; ok {\nreturn index\n} else {\nreturn -1\n}\n}\n
hashing_search.js
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction hashingSearchArray(map, target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.has(target) ? map.get(target) : -1;\n}\n
hashing_search.ts
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction hashingSearchArray(map: Map<number, number>, target: number): number {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.has(target) ? (map.get(target) as number) : -1;\n}\n
hashing_search.c
[class]{}-[func]{hashingSearchArray}\n
hashing_search.cs
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint hashingSearchArray(Dictionary<int, int> map, int target)\n{\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map.GetValueOrDefault(target, -1);\n}\n
hashing_search.swift
/* \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc hashingSearchArray(map: [Int: Int], target: Int) -> Int {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1\nreturn map[target, default: -1]\n}\n
hashing_search.zig
// \u54c8\u5e0c\u67e5\u627e\uff08\u6570\u7ec4\uff09\nfn hashingSearchArray(comptime T: type, map: std.AutoHashMap(T, T), target: T) T {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7d22\u5f15\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de -1   \nif (map.getKey(target) == null) return -1;\nreturn map.get(target).?;\n}\n

\u518d\u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u7ed9\u5b9a\u4e00\u4e2a\u76ee\u6807\u7ed3\u70b9\u503c target \uff0c\u83b7\u53d6\u5bf9\u5e94\u7684\u94fe\u8868\u7ed3\u70b9\u5bf9\u8c61\uff0c\u90a3\u4e48\u4e5f\u53ef\u4ee5\u4f7f\u7528\u54c8\u5e0c\u67e5\u627e\u5b9e\u73b0\u3002

Fig. \u54c8\u5e0c\u67e5\u627e\u94fe\u8868\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig hashing_search.java
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode hashingSearchLinkedList(Map<Integer, ListNode> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.getOrDefault(target, null);\n}\n
hashing_search.cpp
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode* hashingSearchLinkedList(unordered_map<int, ListNode*> map, int target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de nullptr\nif (map.find(target) == map.end())\nreturn nullptr;\nreturn map[target];\n}\n
hashing_search.py
def hashing_search_linkedlist(mapp: Dict[int, ListNode], target: int) -> Optional[ListNode]:\n\"\"\" \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 \"\"\"\n# \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u5143\u7d20\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n# \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de None\nreturn mapp.get(target, None)\n
hashing_search.go
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc hashingSearchLinkedList(m map[int]*ListNode, target int) *ListNode {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de nil\nif node, ok := m[target]; ok {\nreturn node\n} else {\nreturn nil\n}\n}\n
hashing_search.js
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunction hashingSearchLinkedList(map, target) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.has(target) ? map.get(target) : null;\n}\n
hashing_search.ts
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunction hashingSearchLinkedList(map: Map<number, ListNode>, target: number): ListNode | null {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.has(target) ? (map.get(target) as ListNode) : null;\n}\n
hashing_search.c
[class]{}-[func]{hashingSearchLinkedList}\n
hashing_search.cs
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode? hashingSearchLinkedList(Dictionary<int, ListNode> map, int target)\n{\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map.GetValueOrDefault(target);\n}\n
hashing_search.swift
/* \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc hashingSearchLinkedList(map: [Int: ListNode], target: Int) -> ListNode? {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null\nreturn map[target]\n}\n
hashing_search.zig
// \u54c8\u5e0c\u67e5\u627e\uff08\u94fe\u8868\uff09\nfn hashingSearchLinkedList(comptime T: type, map: std.AutoHashMap(T, *inc.ListNode(T)), target: T) ?*inc.ListNode(T) {\n// \u54c8\u5e0c\u8868\u7684 key: \u76ee\u6807\u7ed3\u70b9\u503c\uff0cvalue: \u7ed3\u70b9\u5bf9\u8c61\n// \u82e5\u54c8\u5e0c\u8868\u4e2d\u65e0\u6b64 key \uff0c\u8fd4\u56de null \nif (map.getKey(target) == null) return null;\nreturn map.get(target);\n}\n
"},{"location":"chapter_searching/hashing_search/#1032","title":"10.3.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u54c8\u5e0c\u8868\u7684\u67e5\u627e\u64cd\u4f5c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\u3002

"},{"location":"chapter_searching/hashing_search/#1033","title":"10.3.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u5728\u54c8\u5e0c\u8868\u4e2d\uff0c\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(1)\\) \uff0c\u8fd9\u610f\u5473\u7740\u65e0\u8bba\u662f\u9ad8\u9891\u589e\u5220\u8fd8\u662f\u9ad8\u9891\u67e5\u627e\u573a\u666f\uff0c\u54c8\u5e0c\u67e5\u627e\u7684\u6027\u80fd\u8868\u73b0\u90fd\u975e\u5e38\u597d\u3002\u5f53\u7136\uff0c\u4e00\u5207\u7684\u524d\u63d0\u662f\u4fdd\u8bc1\u54c8\u5e0c\u8868\u672a\u9000\u5316\u3002

\u5373\u4f7f\u5982\u6b64\uff0c\u54c8\u5e0c\u67e5\u627e\u4ecd\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9700\u8981\u6839\u636e\u60c5\u51b5\u7075\u6d3b\u9009\u62e9\u65b9\u6cd5\u3002

  • \u8f85\u52a9\u54c8\u5e0c\u8868 \u9700\u8981\u4f7f\u7528 \\(O(n)\\) \u7684\u989d\u5916\u7a7a\u95f4\uff0c\u610f\u5473\u7740\u9700\u8981\u9884\u7559\u66f4\u591a\u7684\u8ba1\u7b97\u673a\u5185\u5b58\uff1b
  • \u5efa\u7acb\u548c\u7ef4\u62a4\u54c8\u5e0c\u8868\u9700\u8981\u65f6\u95f4\uff0c\u56e0\u6b64\u54c8\u5e0c\u67e5\u627e \u4e0d\u9002\u5408\u9ad8\u9891\u589e\u5220\u3001\u4f4e\u9891\u67e5\u627e\u7684\u4f7f\u7528\u573a\u666f\uff1b
  • \u5f53\u54c8\u5e0c\u51b2\u7a81\u4e25\u91cd\u65f6\uff0c\u54c8\u5e0c\u8868\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \uff1b
  • \u5f53\u6570\u636e\u91cf\u5f88\u5c0f\u65f6\uff0c\u7ebf\u6027\u67e5\u627e\u6bd4\u54c8\u5e0c\u67e5\u627e\u66f4\u5feb\u3002\u8fd9\u662f\u56e0\u4e3a\u8ba1\u7b97\u54c8\u5e0c\u6620\u5c04\u51fd\u6570\u53ef\u80fd\u6bd4\u904d\u5386\u4e00\u4e2a\u5c0f\u578b\u6570\u7ec4\u66f4\u6162\uff1b
"},{"location":"chapter_searching/linear_search/","title":"10.1. \u00a0 \u7ebf\u6027\u67e5\u627e","text":"

\u300c\u7ebf\u6027\u67e5\u627e Linear Search\u300d\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u67e5\u627e\u65b9\u6cd5\uff0c\u5176\u4ece\u6570\u636e\u7ed3\u6784\u7684\u4e00\u7aef\u5f00\u59cb\uff0c\u4f9d\u6b21\u8bbf\u95ee\u6bcf\u4e2a\u5143\u7d20\uff0c\u76f4\u5230\u53e6\u4e00\u7aef\u540e\u505c\u6b62\u3002

"},{"location":"chapter_searching/linear_search/#1011","title":"10.1.1. \u00a0 \u7b97\u6cd5\u5b9e\u73b0","text":"

\u7ebf\u6027\u67e5\u627e\u5b9e\u8d28\u4e0a\u5c31\u662f\u904d\u5386\u6570\u636e\u7ed3\u6784 + \u5224\u65ad\u6761\u4ef6\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u60f3\u8981\u5728\u6570\u7ec4 nums \u4e2d\u67e5\u627e\u76ee\u6807\u5143\u7d20 target \u7684\u5bf9\u5e94\u7d22\u5f15\uff0c\u90a3\u4e48\u53ef\u4ee5\u5728\u6570\u7ec4\u4e2d\u8fdb\u884c\u7ebf\u6027\u67e5\u627e\u3002

Fig. \u5728\u6570\u7ec4\u4e2d\u7ebf\u6027\u67e5\u627e\u5143\u7d20

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linear_search.java
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(int[] nums, int target) {\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.cpp
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(vector<int>& nums, int target) {\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.size(); i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.py
def linear_search_array(nums: List[int], target: int) -> int:\n\"\"\" \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 \"\"\"\n# \u904d\u5386\u6570\u7ec4\nfor i in range(len(nums)):\nif nums[i] == target:  # \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nreturn i\nreturn -1                  # \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\n
linear_search.go
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc linearSearchArray(nums []int, target int) int {\n// \u904d\u5386\u6570\u7ec4\nfor i := 0; i < len(nums); i++ {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif nums[i] == target {\nreturn i\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
linear_search.js
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunction linearSearchArray(nums, target) {\n// \u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] === target) {\nreturn i;\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1; }\n
linear_search.ts
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09*/\nfunction linearSearchArray(nums: number[], target: number): number {\n// \u904d\u5386\u6570\u7ec4\nfor (let i = 0; i < nums.length; i++) {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] === target) {\nreturn i;\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.c
[class]{}-[func]{linearSearchArray}\n
linear_search.cs
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nint linearSearchArray(int[] nums, int target)\n{\n// \u904d\u5386\u6570\u7ec4\nfor (int i = 0; i < nums.Length; i++)\n{\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif (nums[i] == target)\nreturn i;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n
linear_search.swift
/* \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09 */\nfunc linearSearchArray(nums: [Int], target: Int) -> Int {\n// \u904d\u5386\u6570\u7ec4\nfor i in nums.indices {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de\u5176\u7d22\u5f15\nif nums[i] == target {\nreturn i\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1\n}\n
linear_search.zig
// \u7ebf\u6027\u67e5\u627e\uff08\u6570\u7ec4\uff09\nfn linearSearchArray(comptime T: type, nums: std.ArrayList(T), target: T) T {\n// \u904d\u5386\u6570\u7ec4\nfor (nums.items) |num, i| {\n// \u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c \u8fd4\u56de\u5176\u7d22\u5f15\nif (num == target) {\nreturn @intCast(T, i);\n}\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de -1\nreturn -1;\n}\n

\u518d\u6bd4\u5982\uff0c\u6211\u4eec\u60f3\u8981\u5728\u7ed9\u5b9a\u4e00\u4e2a\u76ee\u6807\u7ed3\u70b9\u503c target \uff0c\u8fd4\u56de\u6b64\u7ed3\u70b9\u5bf9\u8c61\uff0c\u4e5f\u53ef\u4ee5\u5728\u94fe\u8868\u4e2d\u8fdb\u884c\u7ebf\u6027\u67e5\u627e\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linear_search.java
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode linearSearchLinkedList(ListNode head, int target) {\n// \u904d\u5386\u94fe\u8868\nwhile (head != null) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val == target)\nreturn head;\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.cpp
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode* linearSearchLinkedList(ListNode* head, int target) {\n// \u904d\u5386\u94fe\u8868\nwhile (head != nullptr) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head->val == target)\nreturn head;\nhead = head->next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de nullptr\nreturn nullptr;\n}\n
linear_search.py
def linear_search_linkedlist(head: ListNode, target: int) -> Optional[ListNode]:\n\"\"\" \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 \"\"\"\n# \u904d\u5386\u94fe\u8868\nwhile head:\nif head.val == target: # \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nreturn head\nhead = head.next\nreturn None                # \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de None\n
linear_search.go
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc linearSearchLinkedList(node *ListNode, target int) *ListNode {\n// \u904d\u5386\u94fe\u8868\nfor node != nil {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif node.Val == target {\nreturn node\n}\nnode = node.Next\n}\n// \u672a\u627e\u5230\u76ee\u6807\u5143\u7d20\uff0c\u8fd4\u56de nil\nreturn nil\n}\n
linear_search.js
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09*/\nfunction linearSearchLinkedList(head, target) {\n// \u904d\u5386\u94fe\u8868\nwhile(head) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif(head.val === target) {\nreturn head;\n}\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.ts
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09*/\nfunction linearSearchLinkedList(head: ListNode | null, target: number): ListNode | null {\n// \u904d\u5386\u94fe\u8868\nwhile (head) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val === target) {\nreturn head;\n}\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.c
[class]{}-[func]{linearSearchLinkedList}\n
linear_search.cs
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nListNode? linearSearchLinkedList(ListNode head, int target)\n{\n// \u904d\u5386\u94fe\u8868\nwhile (head != null)\n{\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.val == target)\nreturn head;\nhead = head.next;\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn null;\n}\n
linear_search.swift
/* \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09 */\nfunc linearSearchLinkedList(head: ListNode?, target: Int) -> ListNode? {\nvar head = head\n// \u904d\u5386\u94fe\u8868\nwhile head != nil {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif head?.val == target {\nreturn head\n}\nhead = head?.next\n}\n// \u672a\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de null\nreturn nil\n}\n
linear_search.zig
// \u7ebf\u6027\u67e5\u627e\uff08\u94fe\u8868\uff09\nfn linearSearchLinkedList(comptime T: type, node: ?*inc.ListNode(T), target: T) ?*inc.ListNode(T) {\nvar head = node;\n// \u904d\u5386\u94fe\u8868\nwhile (head != null) {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8fd4\u56de\u4e4b\nif (head.?.val == target) return head;\nhead = head.?.next;\n}\nreturn null;\n}\n
"},{"location":"chapter_searching/linear_search/#1012","title":"10.1.2. \u00a0 \u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u5176\u4e2d \\(n\\) \u4e3a\u6570\u7ec4\u6216\u94fe\u8868\u957f\u5ea6\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u65e0\u9700\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\u3002

"},{"location":"chapter_searching/linear_search/#1013","title":"10.1.3. \u00a0 \u4f18\u70b9\u4e0e\u7f3a\u70b9","text":"

\u7ebf\u6027\u67e5\u627e\u7684\u901a\u7528\u6027\u6781\u4f73\u3002\u7531\u4e8e\u7ebf\u6027\u67e5\u627e\u662f\u4f9d\u6b21\u8bbf\u95ee\u5143\u7d20\u7684\uff0c\u5373\u6ca1\u6709\u8df3\u8dc3\u8bbf\u95ee\u5143\u7d20\uff0c\u56e0\u6b64\u6570\u7ec4\u6216\u94fe\u8868\u7686\u9002\u7528\u3002

\u7ebf\u6027\u67e5\u627e\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u592a\u9ad8\u3002\u5728\u6570\u636e\u91cf \\(n\\) \u5f88\u5927\u65f6\uff0c\u67e5\u627e\u6548\u7387\u5f88\u4f4e\u3002

"},{"location":"chapter_searching/summary/","title":"10.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u7ebf\u6027\u67e5\u627e\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u67e5\u627e\u65b9\u6cd5\uff0c\u901a\u8fc7\u904d\u5386\u6570\u636e\u7ed3\u6784 + \u5224\u65ad\u6761\u4ef6\u5b9e\u73b0\u67e5\u627e\u3002
  • \u4e8c\u5206\u67e5\u627e\u5229\u7528\u6570\u636e\u7684\u6709\u5e8f\u6027\uff0c\u901a\u8fc7\u5faa\u73af\u4e0d\u65ad\u7f29\u5c0f\u4e00\u534a\u641c\u7d22\u533a\u95f4\u6765\u5b9e\u73b0\u67e5\u627e\uff0c\u5176\u8981\u6c42\u8f93\u5165\u6570\u636e\u662f\u6709\u5e8f\u7684\uff0c\u5e76\u4e14\u4ec5\u9002\u7528\u4e8e\u6570\u7ec4\u6216\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6570\u636e\u7ed3\u6784\u3002
  • \u54c8\u5e0c\u67e5\u627e\u501f\u52a9\u54c8\u5e0c\u8868\u6765\u5b9e\u73b0\u5e38\u6570\u9636\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u67e5\u627e\u64cd\u4f5c\uff0c\u4f53\u73b0\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u7b97\u6cd5\u601d\u60f3\u3002
  • \u4e0b\u8868\u603b\u7ed3\u5bf9\u6bd4\u4e86\u67e5\u627e\u7b97\u6cd5\u7684\u5404\u79cd\u7279\u6027\u548c\u65f6\u95f4\u590d\u6742\u5ea6\u3002
\u7ebf\u6027\u67e5\u627e \u4e8c\u5206\u67e5\u627e \u54c8\u5e0c\u67e5\u627e \u9002\u7528\u6570\u636e\u7ed3\u6784 \u6570\u7ec4\u3001\u94fe\u8868 \u6570\u7ec4 \u6570\u7ec4\u3001\u94fe\u8868 \u8f93\u5165\u6570\u636e\u8981\u6c42 \u65e0 \u6709\u5e8f \u65e0 \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u67e5\u627e / \u63d2\u5165 / \u5220\u9664 \\(O(n)\\) / \\(O(1)\\) / \\(O(n)\\) \\(O(\\log n)\\) / \\(O(n)\\) / \\(O(n)\\) \\(O(1)\\) / \\(O(1)\\) / \\(O(1)\\) \u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u67e5\u627e / \u63d2\u5165 / \u5220\u9664 \\(O(n)\\) / \\(O(1)\\) / \\(O(n)\\) \\(O(\\log n)\\) / \\(O(n)\\) / \\(O(n)\\) \\(O(n)\\) / \\(O(n)\\) / \\(O(n)\\) \u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \\(O(1)\\) \\(O(n)\\)"},{"location":"chapter_sorting/bubble_sort/","title":"11.2. \u00a0 \u5192\u6ce1\u6392\u5e8f","text":"

\u300c\u5192\u6ce1\u6392\u5e8f Bubble Sort\u300d\u662f\u4e00\u79cd\u6700\u57fa\u7840\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u975e\u5e38\u9002\u5408\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u5b66\u4e60\u7684\u6392\u5e8f\u7b97\u6cd5\u3002\u987e\u540d\u601d\u4e49\uff0c\u300c\u5192\u6ce1\u300d\u662f\u8be5\u7b97\u6cd5\u7684\u6838\u5fc3\u64cd\u4f5c\u3002

\u4e3a\u4ec0\u4e48\u53eb\u201c\u5192\u6ce1\u201d

\u5728\u6c34\u4e2d\uff0c\u8d8a\u5927\u7684\u6ce1\u6ce1\u6d6e\u529b\u8d8a\u5927\uff0c\u6240\u4ee5\u6700\u5927\u7684\u6ce1\u6ce1\u4f1a\u6700\u5148\u6d6e\u5230\u6c34\u9762\u3002

\u300c\u5192\u6ce1\u300d\u64cd\u4f5c\u5219\u662f\u5728\u6a21\u62df\u4e0a\u8ff0\u8fc7\u7a0b\uff0c\u5177\u4f53\u505a\u6cd5\u4e3a\uff1a\u4ece\u6570\u7ec4\u6700\u5de6\u7aef\u5f00\u59cb\u5411\u53f3\u904d\u5386\uff0c\u4f9d\u6b21\u5bf9\u6bd4\u76f8\u90bb\u5143\u7d20\u5927\u5c0f\uff0c\u82e5 \u5de6\u5143\u7d20 > \u53f3\u5143\u7d20 \u5219\u5c06\u5b83\u4fe9\u4ea4\u6362\uff0c\u6700\u7ec8\u53ef\u5c06\u6700\u5927\u5143\u7d20\u79fb\u52a8\u81f3\u6570\u7ec4\u6700\u53f3\u7aef\u3002

\u5b8c\u6210\u6b64\u6b21\u5192\u6ce1\u64cd\u4f5c\u540e\uff0c\u6570\u7ec4\u6700\u5927\u5143\u7d20\u5df2\u5728\u6b63\u786e\u4f4d\u7f6e\uff0c\u63a5\u4e0b\u6765\u53ea\u9700\u6392\u5e8f\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u3002

<1><2><3><4><5><6><7>

"},{"location":"chapter_sorting/bubble_sort/#1121","title":"11.2.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u8bbe\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n\\) \uff0c\u5b8c\u6210\u7b2c\u4e00\u8f6e\u300c\u5192\u6ce1\u300d\u540e\uff0c\u6570\u7ec4\u6700\u5927\u5143\u7d20\u5df2\u5728\u6b63\u786e\u4f4d\u7f6e\uff0c\u63a5\u4e0b\u6765\u53ea\u9700\u6392\u5e8f\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u3002
  2. \u540c\u7406\uff0c\u5bf9\u5269\u4f59 \\(n - 1\\) \u4e2a\u5143\u7d20\u6267\u884c\u300c\u5192\u6ce1\u300d\uff0c\u53ef\u5c06\u7b2c\u4e8c\u5927\u5143\u7d20\u4ea4\u6362\u81f3\u6b63\u786e\u4f4d\u7f6e\uff0c\u56e0\u800c\u5f85\u6392\u5e8f\u5143\u7d20\u53ea\u5269 \\(n - 2\\) \u4e2a\u3002
  3. \u4ee5\u6b64\u7c7b\u63a8\u2026\u2026 \u5faa\u73af \\(n - 1\\) \u8f6e\u300c\u5192\u6ce1\u300d\uff0c\u5373\u53ef\u5b8c\u6210\u6574\u4e2a\u6570\u7ec4\u7684\u6392\u5e8f\u3002

Fig. \u5192\u6ce1\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig bubble_sort.java
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(int[] nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.cpp
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\n// \u8fd9\u91cc\u4f7f\u7528\u4e86 std::swap() \u51fd\u6570\nswap(nums[j], nums[j + 1]);\n}\n}\n}\n}\n
bubble_sort.py
def bubble_sort(nums: List[int]) -> None:\n\"\"\" \u5192\u6ce1\u6392\u5e8f \"\"\"\nn: int = len(nums)\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(n - 1, 0, -1):\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j + 1] = nums[j + 1], nums[j]\n
bubble_sort.go
/* \u5192\u6ce1\u6392\u5e8f */\nfunc bubbleSort(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j+1] = nums[j+1], nums[j]\n}\n}\n}\n}\n
bubble_sort.js
/* \u5192\u6ce1\u6392\u5e8f */\nfunction bubbleSort(nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.ts
/* \u5192\u6ce1\u6392\u5e8f */\nfunction bubbleSort(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.c
[class]{}-[func]{bubbleSort}\n
bubble_sort.cs
/* \u5192\u6ce1\u6392\u5e8f */\nvoid bubbleSort(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
bubble_sort.swift
/* \u5192\u6ce1\u6392\u5e8f */\nfunc bubbleSort(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in stride(from: nums.count - 1, to: 0, by: -1) {\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in stride(from: 0, to: i, by: 1) {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\n}\n}\n}\n}\n
bubble_sort.zig
// \u5192\u6ce1\u6392\u5e8f\nfn bubbleSort(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: usize = nums.len - 1;\nwhile (i > 0) : (i -= 1) {\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\n}\n}\n}\n}\n
"},{"location":"chapter_sorting/bubble_sort/#1122","title":"11.2.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u5404\u8f6e\u300c\u5192\u6ce1\u300d\u904d\u5386\u7684\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n - 1\\) , \\(n - 2\\) , \\(\\cdots\\) , \\(2\\) , \\(1\\) \u6b21\uff0c\u6c42\u548c\u4e3a \\(\\frac{(n - 1) n}{2}\\) \uff0c\u56e0\u6b64\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 \\(i\\) , \\(j\\) \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\u3002

\u539f\u5730\u6392\u5e8f\uff1a\u6307\u9488\u53d8\u91cf\u4ec5\u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u989d\u5916\u7a7a\u95f4\u3002

\u7a33\u5b9a\u6392\u5e8f\uff1a\u4e0d\u4ea4\u6362\u76f8\u7b49\u5143\u7d20\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u5f15\u5165 flag \u4f18\u5316\u540e\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \u3002

"},{"location":"chapter_sorting/bubble_sort/#1123","title":"11.2.3. \u00a0 \u6548\u7387\u4f18\u5316","text":"

\u6211\u4eec\u53d1\u73b0\uff0c\u82e5\u5728\u67d0\u8f6e\u300c\u5192\u6ce1\u300d\u4e2d\u672a\u6267\u884c\u4efb\u4f55\u4ea4\u6362\u64cd\u4f5c\uff0c\u5219\u8bf4\u660e\u6570\u7ec4\u5df2\u7ecf\u5b8c\u6210\u6392\u5e8f\uff0c\u53ef\u76f4\u63a5\u8fd4\u56de\u7ed3\u679c\u3002\u8003\u8651\u53ef\u4ee5\u589e\u52a0\u4e00\u4e2a\u6807\u5fd7\u4f4d flag \u6765\u76d1\u542c\u8be5\u60c5\u51b5\uff0c\u82e5\u51fa\u73b0\u5219\u76f4\u63a5\u8fd4\u56de\u3002

\u4f18\u5316\u540e\uff0c\u5192\u6ce1\u6392\u5e8f\u7684\u6700\u5dee\u548c\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4ecd\u4e3a \\(O(n^2)\\) \uff1b\u800c\u5728\u8f93\u5165\u6570\u7ec4 \u5df2\u6392\u5e8f \u65f6\uff0c\u8fbe\u5230 \u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig bubble_sort.java
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(int[] nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.length - 1; i > 0; i--) {\nboolean flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.cpp
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.size() - 1; i > 0; i--) {\nbool flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\n// \u8fd9\u91cc\u4f7f\u7528\u4e86 std::swap() \u51fd\u6570\nswap(nums[j], nums[j + 1]);\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.py
def bubble_sort_with_flag(nums: List[int]) -> None:\n\"\"\" \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09 \"\"\"\nn: int = len(nums)\n# \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in range(n - 1, 0, -1):\nflag: bool = False  # \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n# \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j in range(i):\nif nums[j] > nums[j + 1]:\n# \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j + 1] = nums[j + 1], nums[j]\nflag = True  # \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\nif not flag:\nbreak            # \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n
bubble_sort.go
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunc bubbleSortWithFlag(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := len(nums) - 1; i > 0; i-- {\nflag := false // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor j := 0; j < i; j++ {\nif nums[j] > nums[j+1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nnums[j], nums[j+1] = nums[j+1], nums[j]\nflag = true // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif flag == false { // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\nbreak\n}\n}\n}\n
bubble_sort.js
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunction bubbleSortWithFlag(nums) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\nlet flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.ts
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunction bubbleSortWithFlag(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (let i = nums.length - 1; i > 0; i--) {\nlet flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (let j = 0; j < i; j++) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true; // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break; // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.c
[class]{}-[func]{bubbleSortWithFlag}\n
bubble_sort.cs
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nvoid bubbleSortWithFlag(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor (int i = nums.Length - 1; i > 0; i--)\n{\nbool flag = false; // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nfor (int j = 0; j < i; j++)\n{\nif (nums[j] > nums[j + 1])\n{\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nint tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;  // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif (!flag) break;     // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
bubble_sort.swift
/* \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09*/\nfunc bubbleSortWithFlag(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i in stride(from: nums.count - 1, to: 0, by: -1) {\nvar flag = false // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\nfor j in stride(from: 0, to: i, by: 1) {\nif nums[j] > nums[j + 1] {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nlet tmp = nums[j]\nnums[j] = nums[j + 1]\nnums[j + 1] = tmp\nflag = true // \u8bb0\u5f55\u4ea4\u6362\u5143\u7d20\n}\n}\nif !flag { // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\nbreak\n}\n}\n}\n
bubble_sort.zig
// \u5192\u6ce1\u6392\u5e8f\uff08\u6807\u5fd7\u4f18\u5316\uff09\nfn bubbleSortWithFlag(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nvar i: usize = nums.len - 1;\nwhile (i > 0) : (i -= 1) {\nvar flag = false;   // \u521d\u59cb\u5316\u6807\u5fd7\u4f4d\nvar j: usize = 0;\n// \u5185\u5faa\u73af\uff1a\u5192\u6ce1\u64cd\u4f5c\nwhile (j < i) : (j += 1) {\nif (nums[j] > nums[j + 1]) {\n// \u4ea4\u6362 nums[j] \u4e0e nums[j + 1]\nvar tmp = nums[j];\nnums[j] = nums[j + 1];\nnums[j + 1] = tmp;\nflag = true;\n}\n}\nif (!flag) break;   // \u6b64\u8f6e\u5192\u6ce1\u672a\u4ea4\u6362\u4efb\u4f55\u5143\u7d20\uff0c\u76f4\u63a5\u8df3\u51fa\n}\n}\n
"},{"location":"chapter_sorting/insertion_sort/","title":"11.3. \u00a0 \u63d2\u5165\u6392\u5e8f","text":"

\u300c\u63d2\u5165\u6392\u5e8f Insertion Sort\u300d\u662f\u4e00\u79cd\u57fa\u4e8e \u6570\u7ec4\u63d2\u5165\u64cd\u4f5c \u7684\u6392\u5e8f\u7b97\u6cd5\u3002

\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u539f\u7406\uff1a\u9009\u5b9a\u67d0\u4e2a\u5f85\u6392\u5e8f\u5143\u7d20\u4e3a\u57fa\u51c6\u6570 base\uff0c\u5c06 base \u4e0e\u5176\u5de6\u4fa7\u5df2\u6392\u5e8f\u533a\u95f4\u5143\u7d20\u4f9d\u6b21\u5bf9\u6bd4\u5927\u5c0f\uff0c\u5e76\u63d2\u5165\u5230\u6b63\u786e\u4f4d\u7f6e\u3002

\u56de\u5fc6\u6570\u7ec4\u63d2\u5165\u64cd\u4f5c\uff0c\u6211\u4eec\u9700\u8981\u5c06\u4ece\u76ee\u6807\u7d22\u5f15\u5230 base \u4e4b\u95f4\u7684\u6240\u6709\u5143\u7d20\u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\uff0c\u7136\u540e\u518d\u5c06 base \u8d4b\u503c\u7ed9\u76ee\u6807\u7d22\u5f15\u3002

Fig. \u5355\u6b21\u63d2\u5165\u64cd\u4f5c

"},{"location":"chapter_sorting/insertion_sort/#1131","title":"11.3.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u7b2c 1 \u8f6e\u5148\u9009\u53d6\u6570\u7ec4\u7684 \u7b2c 2 \u4e2a\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6570\u7ec4\u524d 2 \u4e2a\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002
  2. \u7b2c 2 \u8f6e\u9009\u53d6 \u7b2c 3 \u4e2a\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6570\u7ec4\u524d 3 \u4e2a\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002
  3. \u4ee5\u6b64\u7c7b\u63a8\u2026\u2026\u6700\u540e\u4e00\u8f6e\u9009\u53d6 \u6570\u7ec4\u5c3e\u5143\u7d20 \u4e3a base \uff0c\u6267\u884c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u540e\uff0c\u6240\u6709\u5143\u7d20\u5df2\u5b8c\u6210\u6392\u5e8f\u3002

Fig. \u63d2\u5165\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig insertion_sort.java
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(int[] nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.length; i++) {\nint base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.cpp
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(vector<int>& nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.size(); i++) {\nint base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.py
def insertion_sort(nums: List[int]) -> None:\n\"\"\" \u63d2\u5165\u6392\u5e8f \"\"\"\n# \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]   \nfor i in range(1, len(nums)):\nbase: int = nums[i]\nj: int = i - 1\n# \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile j >= 0 and nums[j] > base:\nnums[j + 1] = nums[j]  # 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj -= 1\nnums[j + 1] = base         # 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n
insertion_sort.go
/* \u63d2\u5165\u6392\u5e8f */\nfunc insertionSort(nums []int) {\n// \u5916\u5faa\u73af\uff1a\u5f85\u6392\u5e8f\u5143\u7d20\u6570\u91cf\u4e3a n-1, n-2, ..., 1\nfor i := 1; i < len(nums); i++ {\nbase := nums[i]\nj := i - 1\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nfor j >= 0 && nums[j] > base {\nnums[j+1] = nums[j] // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--\n}\nnums[j+1] = base // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.js
/* \u63d2\u5165\u6392\u5e8f */\nfunction insertionSort(nums) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (let i = 1; i < nums.length; i++) {\nlet base = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.ts
/* \u63d2\u5165\u6392\u5e8f */\nfunction insertionSort(nums: number[]): void {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (let i = 1; i < nums.length; i++) {\nconst base = nums[i];\nlet j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > base) {\nnums[j + 1] = nums[j]; // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = base; // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.c
[class]{}-[func]{insertionSort}\n
insertion_sort.cs
/* \u63d2\u5165\u6392\u5e8f */\nvoid insertionSort(int[] nums)\n{\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor (int i = 1; i < nums.Length; i++)\n{\nint bas = nums[i], j = i - 1;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 0 && nums[j] > bas)\n{\nnums[j + 1] = nums[j]; // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj--;\n}\nnums[j + 1] = bas;         // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.swift
/* \u63d2\u5165\u6392\u5e8f */\nfunc insertionSort(nums: inout [Int]) {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nfor i in stride(from: 1, to: nums.count, by: 1) {\nlet base = nums[i]\nvar j = i - 1\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile j >= 0, nums[j] > base {\nnums[j + 1] = nums[j] // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\nj -= 1\n}\nnums[j + 1] = base // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
insertion_sort.zig
// \u63d2\u5165\u6392\u5e8f\nfn insertionSort(nums: []i32) void {\n// \u5916\u5faa\u73af\uff1abase = nums[1], nums[2], ..., nums[n-1]\nvar i: usize = 1;\nwhile (i < nums.len) : (i += 1) {\nvar base = nums[i];\nvar j: usize = i;\n// \u5185\u5faa\u73af\uff1a\u5c06 base \u63d2\u5165\u5230\u5de6\u8fb9\u7684\u6b63\u786e\u4f4d\u7f6e\nwhile (j >= 1 and nums[j - 1] > base) : (j -= 1) {\nnums[j] = nums[j - 1];  // 1. \u5c06 nums[j] \u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\n}\nnums[j] = base;             // 2. \u5c06 base \u8d4b\u503c\u5230\u6b63\u786e\u4f4d\u7f6e\n}\n}\n
"},{"location":"chapter_sorting/insertion_sort/#1132","title":"11.3.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u5404\u8f6e\u63d2\u5165\u64cd\u4f5c\u5faa\u73af \\(n - 1\\) , \\(n-2\\) , \\(\\cdots\\) , \\(2\\) , \\(1\\) \u6b21\uff0c\u6c42\u548c\u4e3a \\(\\frac{(n - 1) n}{2}\\) \uff0c\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(1)\\) \uff1a\u6307\u9488 \\(i\\) , \\(j\\) \u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\u3002

\u539f\u5730\u6392\u5e8f\uff1a\u6307\u9488\u53d8\u91cf\u4ec5\u4f7f\u7528\u5e38\u6570\u5927\u5c0f\u989d\u5916\u7a7a\u95f4\u3002

\u7a33\u5b9a\u6392\u5e8f\uff1a\u4e0d\u4ea4\u6362\u76f8\u7b49\u5143\u7d20\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u6700\u4f73\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \u3002

"},{"location":"chapter_sorting/insertion_sort/#1133-vs","title":"11.3.3. \u00a0 \u63d2\u5165\u6392\u5e8f vs \u5192\u6ce1\u6392\u5e8f","text":"

Question

\u867d\u7136\u300c\u63d2\u5165\u6392\u5e8f\u300d\u548c\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(n^2)\\) \uff0c\u4f46\u5b9e\u9645\u8fd0\u884c\u901f\u5ea6\u5374\u6709\u5f88\u5927\u5dee\u522b\uff0c\u8fd9\u662f\u4e3a\u4ec0\u4e48\u5462\uff1f

\u56de\u987e\u590d\u6742\u5ea6\u5206\u6790\uff0c\u4e24\u4e2a\u65b9\u6cd5\u7684\u5faa\u73af\u6b21\u6570\u90fd\u662f \\(\\frac{(n - 1) n}{2}\\) \u3002\u4f46\u4e0d\u540c\u7684\u662f\uff0c\u300c\u5192\u6ce1\u64cd\u4f5c\u300d\u662f\u5728\u505a \u5143\u7d20\u4ea4\u6362\uff0c\u9700\u8981\u501f\u52a9\u4e00\u4e2a\u4e34\u65f6\u53d8\u91cf\u5b9e\u73b0\uff0c\u5171 3 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u800c\u300c\u63d2\u5165\u64cd\u4f5c\u300d\u662f\u5728\u505a \u8d4b\u503c\uff0c\u53ea\u9700 1 \u4e2a\u5355\u5143\u64cd\u4f5c\uff1b\u56e0\u6b64\uff0c\u53ef\u4ee5\u7c97\u7565\u4f30\u8ba1\u51fa\u5192\u6ce1\u6392\u5e8f\u7684\u8ba1\u7b97\u5f00\u9500\u7ea6\u4e3a\u63d2\u5165\u6392\u5e8f\u7684 3 \u500d\u3002

\u63d2\u5165\u6392\u5e8f\u8fd0\u884c\u901f\u5ea6\u5feb\uff0c\u5e76\u4e14\u5177\u6709\u539f\u5730\u3001\u7a33\u5b9a\u3001\u81ea\u9002\u5e94\u7684\u4f18\u70b9\uff0c\u56e0\u6b64\u5f88\u53d7\u6b22\u8fce\u3002\u5b9e\u9645\u4e0a\uff0c\u5305\u62ec Java \u5728\u5185\u7684\u8bb8\u591a\u7f16\u7a0b\u8bed\u8a00\u7684\u6392\u5e8f\u5e93\u51fd\u6570\u7684\u5b9e\u73b0\u90fd\u7528\u5230\u4e86\u63d2\u5165\u6392\u5e8f\u3002\u5e93\u51fd\u6570\u7684\u5927\u81f4\u601d\u8def\uff1a

  • \u5bf9\u4e8e \u957f\u6570\u7ec4\uff0c\u91c7\u7528\u57fa\u4e8e\u5206\u6cbb\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u4f8b\u5982\u300c\u5feb\u901f\u6392\u5e8f\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n \\log n)\\) \uff1b
  • \u5bf9\u4e8e \u77ed\u6570\u7ec4\uff0c\u76f4\u63a5\u4f7f\u7528\u300c\u63d2\u5165\u6392\u5e8f\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff1b

\u5728\u6570\u7ec4\u8f83\u77ed\u65f6\uff0c\u590d\u6742\u5ea6\u4e2d\u7684\u5e38\u6570\u9879\uff08\u5373\u6bcf\u8f6e\u4e2d\u7684\u5355\u5143\u64cd\u4f5c\u6570\u91cf\uff09\u5360\u4e3b\u5bfc\u4f5c\u7528\uff0c\u6b64\u65f6\u63d2\u5165\u6392\u5e8f\u8fd0\u884c\u5730\u66f4\u5feb\u3002\u8fd9\u4e2a\u73b0\u8c61\u4e0e\u300c\u7ebf\u6027\u67e5\u627e\u300d\u548c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7684\u60c5\u51b5\u7c7b\u4f3c\u3002

"},{"location":"chapter_sorting/intro_to_sort/","title":"11.1. \u00a0 \u6392\u5e8f\u7b80\u4ecb","text":"

\u300c\u6392\u5e8f\u7b97\u6cd5 Sorting Algorithm\u300d\u4f7f\u5f97\u5217\u8868\u4e2d\u7684\u6240\u6709\u5143\u7d20\u6309\u7167\u4ece\u5c0f\u5230\u5927\u7684\u987a\u5e8f\u6392\u5217\u3002

  • \u5f85\u6392\u5e8f\u7684\u5217\u8868\u7684 \u5143\u7d20\u7c7b\u578b \u53ef\u4ee5\u662f\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u3001\u6216\u5b57\u7b26\u4e32\uff1b
  • \u6392\u5e8f\u7b97\u6cd5\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8bbe\u5b9a \u5224\u65ad\u89c4\u5219\uff0c\u4f8b\u5982\u6570\u5b57\u5927\u5c0f\u3001\u5b57\u7b26 ASCII \u7801\u987a\u5e8f\u3001\u81ea\u5b9a\u4e49\u89c4\u5219\uff1b

Fig. \u6392\u5e8f\u4e2d\u4e0d\u540c\u7684\u5143\u7d20\u7c7b\u578b\u548c\u5224\u65ad\u89c4\u5219

"},{"location":"chapter_sorting/intro_to_sort/#1111","title":"11.1.1. \u00a0 \u8bc4\u4ef7\u7ef4\u5ea6","text":"

\u6392\u5e8f\u7b97\u6cd5\u4e3b\u8981\u53ef\u6839\u636e \u7a33\u5b9a\u6027 \u3001\u5c31\u5730\u6027 \u3001\u81ea\u9002\u5e94\u6027 \u3001\u6bd4\u8f83\u7c7b \u6765\u5206\u7c7b\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_1","title":"\u7a33\u5b9a\u6027","text":"
  • \u300c\u7a33\u5b9a\u6392\u5e8f\u300d\u5728\u5b8c\u6210\u6392\u5e8f\u540e\uff0c\u4e0d\u6539\u53d8 \u76f8\u7b49\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u76f8\u5bf9\u987a\u5e8f\u3002
  • \u300c\u975e\u7a33\u5b9a\u6392\u5e8f\u300d\u5728\u5b8c\u6210\u6392\u5e8f\u540e\uff0c\u76f8\u7b49\u5143\u7d20\u5728\u6570\u7ec4\u4e2d\u7684\u76f8\u5bf9\u4f4d\u7f6e \u53ef\u80fd\u88ab\u6539\u53d8\u3002

\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5b58\u50a8\u5b66\u751f\u4fe1\u606f\u7684\u8868\u683c\uff0c\u7b2c 1, 2 \u5217\u5206\u522b\u662f\u59d3\u540d\u548c\u5e74\u9f84\u3002\u90a3\u4e48\u5728\u4ee5\u4e0b\u793a\u4f8b\u4e2d\uff0c\u300c\u975e\u7a33\u5b9a\u6392\u5e8f\u300d\u4f1a\u5bfc\u81f4\u8f93\u5165\u6570\u636e\u7684\u6709\u5e8f\u6027\u4e22\u5931\u3002\u56e0\u6b64\u300c\u7a33\u5b9a\u6392\u5e8f\u300d\u662f\u5f88\u597d\u7684\u7279\u6027\uff0c\u5728\u591a\u7ea7\u6392\u5e8f\u4e2d\u662f\u5fc5\u987b\u7684\u3002

# \u8f93\u5165\u6570\u636e\u662f\u6309\u7167\u59d3\u540d\u6392\u5e8f\u597d\u7684\n# (name, age)\n('A', 19)\n('B', 18)\n('C', 21)\n('D', 19)\n('E', 23)\n# \u5047\u8bbe\u4f7f\u7528\u975e\u7a33\u5b9a\u6392\u5e8f\u7b97\u6cd5\u6309\u5e74\u9f84\u6392\u5e8f\u5217\u8868\uff0c\n# \u7ed3\u679c\u4e2d ('D', 19) \u548c ('A', 19) \u7684\u76f8\u5bf9\u4f4d\u7f6e\u6539\u53d8\uff0c\n# \u8f93\u5165\u6570\u636e\u6309\u59d3\u540d\u6392\u5e8f\u7684\u6027\u8d28\u4e22\u5931\n('B', 18)\n('D', 19)\n('A', 19)\n('C', 21)\n('E', 23)\n
"},{"location":"chapter_sorting/intro_to_sort/#_2","title":"\u5c31\u5730\u6027","text":"
  • \u300c\u539f\u5730\u6392\u5e8f\u300d\u65e0\u9700\u8f85\u52a9\u6570\u636e\uff0c\u4e0d\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff1b
  • \u300c\u975e\u539f\u5730\u6392\u5e8f\u300d\u9700\u8981\u501f\u52a9\u8f85\u52a9\u6570\u636e\uff0c\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff1b

\u300c\u539f\u5730\u6392\u5e8f\u300d\u4e0d\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff0c\u53ef\u4ee5\u8282\u7ea6\u5185\u5b58\uff1b\u5e76\u4e14\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u7531\u4e8e\u6570\u636e\u64cd\u4f5c\u51cf\u5c11\uff0c\u539f\u5730\u6392\u5e8f\u7684\u8fd0\u884c\u6548\u7387\u4e5f\u66f4\u9ad8\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_3","title":"\u81ea\u9002\u5e94\u6027","text":"
  • \u300c\u81ea\u9002\u5e94\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u53d7\u8f93\u5165\u6570\u636e\u5f71\u54cd\uff0c\u5373\u6700\u4f73 / \u6700\u5dee / \u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u4e0d\u76f8\u7b49\u3002
  • \u300c\u975e\u81ea\u9002\u5e94\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6052\u5b9a\uff0c\u4e0e\u8f93\u5165\u6570\u636e\u65e0\u5173\u3002

\u6211\u4eec\u5e0c\u671b \u6700\u5dee = \u5e73\u5747\uff0c\u5373\u4e0d\u5e0c\u671b\u6392\u5e8f\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u5728\u67d0\u4e9b\u8f93\u5165\u6570\u636e\u4e0b\u53d1\u751f\u52a3\u5316\u3002

"},{"location":"chapter_sorting/intro_to_sort/#_4","title":"\u6bd4\u8f83\u7c7b","text":"
  • \u300c\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u57fa\u4e8e\u5143\u7d20\u4e4b\u95f4\u7684\u6bd4\u8f83\u7b97\u5b50\uff08\u5c0f\u4e8e\u3001\u76f8\u7b49\u3001\u5927\u4e8e\uff09\u6765\u51b3\u5b9a\u5143\u7d20\u7684\u76f8\u5bf9\u987a\u5e8f\u3002
  • \u300c\u975e\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u4e0d\u57fa\u4e8e\u5143\u7d20\u4e4b\u95f4\u7684\u6bd4\u8f83\u7b97\u5b50\u6765\u51b3\u5b9a\u5143\u7d20\u7684\u76f8\u5bf9\u987a\u5e8f\u3002

\u300c\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6700\u4f18\u4e3a \\(O(n \\log n)\\) \uff1b\u800c\u300c\u975e\u6bd4\u8f83\u7c7b\u6392\u5e8f\u300d\u53ef\u4ee5\u8fbe\u5230 \\(O(n)\\) \u7684\u65f6\u95f4\u590d\u6742\u5ea6\uff0c\u4f46\u901a\u7528\u6027\u8f83\u5dee\u3002

"},{"location":"chapter_sorting/intro_to_sort/#1112","title":"11.1.2. \u00a0 \u7406\u60f3\u6392\u5e8f\u7b97\u6cd5","text":"
  • \u8fd0\u884c\u5feb\uff0c\u5373\u65f6\u95f4\u590d\u6742\u5ea6\u4f4e\uff1b
  • \u7a33\u5b9a\u6392\u5e8f\uff0c\u5373\u6392\u5e8f\u540e\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u4e0d\u53d8\u5316\uff1b
  • \u539f\u5730\u6392\u5e8f\uff0c\u5373\u8fd0\u884c\u4e2d\u4e0d\u4f7f\u7528\u989d\u5916\u7684\u8f85\u52a9\u7a7a\u95f4\uff1b
  • \u6b63\u5411\u81ea\u9002\u5e94\u6027\uff0c\u5373\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u4e0d\u4f1a\u5728\u67d0\u4e9b\u8f93\u5165\u6570\u636e\u4e0b\u53d1\u751f\u52a3\u5316\uff1b

\u7136\u800c\uff0c\u6ca1\u6709\u6392\u5e8f\u7b97\u6cd5\u540c\u65f6\u5177\u5907\u4ee5\u4e0a\u6240\u6709\u7279\u6027\u3002\u6392\u5e8f\u7b97\u6cd5\u7684\u9009\u578b\u4f7f\u7528\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5217\u8868\u7c7b\u578b\u3001\u5217\u8868\u957f\u5ea6\u3001\u5143\u7d20\u5206\u5e03\u7b49\u56e0\u7d20\u3002

"},{"location":"chapter_sorting/merge_sort/","title":"11.5. \u00a0 \u5f52\u5e76\u6392\u5e8f","text":"

\u300c\u5f52\u5e76\u6392\u5e8f Merge Sort\u300d\u662f\u7b97\u6cd5\u4e2d\u201c\u5206\u6cbb\u601d\u60f3\u201d\u7684\u5178\u578b\u4f53\u73b0\uff0c\u5176\u6709\u300c\u5212\u5206\u300d\u548c\u300c\u5408\u5e76\u300d\u4e24\u4e2a\u9636\u6bb5\uff1a

  1. \u5212\u5206\u9636\u6bb5\uff1a\u901a\u8fc7\u9012\u5f52\u4e0d\u65ad \u5c06\u6570\u7ec4\u4ece\u4e2d\u70b9\u4f4d\u7f6e\u5212\u5206\u5f00\uff0c\u5c06\u957f\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\u8f6c\u5316\u4e3a\u77ed\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\uff1b
  2. \u5408\u5e76\u9636\u6bb5\uff1a\u5212\u5206\u5230\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\uff0c\u5f00\u59cb\u5411\u4e0a\u5408\u5e76\uff0c\u4e0d\u65ad\u5c06 \u5de6\u3001\u53f3\u4e24\u4e2a\u77ed\u6392\u5e8f\u6570\u7ec4 \u5408\u5e76\u4e3a \u4e00\u4e2a\u957f\u6392\u5e8f\u6570\u7ec4\uff0c\u76f4\u81f3\u5408\u5e76\u81f3\u539f\u6570\u7ec4\u65f6\u5b8c\u6210\u6392\u5e8f\uff1b

Fig. \u5f52\u5e76\u6392\u5e8f\u7684\u5212\u5206\u4e0e\u5408\u5e76\u9636\u6bb5

"},{"location":"chapter_sorting/merge_sort/#1151","title":"11.5.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"

\u300c\u9012\u5f52\u5212\u5206\u300d \u4ece\u9876\u81f3\u5e95\u9012\u5f52\u5730 \u5c06\u6570\u7ec4\u4ece\u4e2d\u70b9\u5207\u4e3a\u4e24\u4e2a\u5b50\u6570\u7ec4\uff0c\u76f4\u81f3\u957f\u5ea6\u4e3a 1 \uff1b

  1. \u8ba1\u7b97\u6570\u7ec4\u4e2d\u70b9 mid \uff0c\u9012\u5f52\u5212\u5206\u5de6\u5b50\u6570\u7ec4\uff08\u533a\u95f4 [left, mid] \uff09\u548c\u53f3\u5b50\u6570\u7ec4\uff08\u533a\u95f4 [mid + 1, right] \uff09\uff1b
  2. \u9012\u5f52\u6267\u884c 1. \u6b65\u9aa4\uff0c\u76f4\u81f3\u5b50\u6570\u7ec4\u533a\u95f4\u957f\u5ea6\u4e3a 1 \u65f6\uff0c\u7ec8\u6b62\u9012\u5f52\u5212\u5206\uff1b

\u300c\u56de\u6eaf\u5408\u5e76\u300d \u4ece\u5e95\u81f3\u9876\u5730\u5c06\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\u5408\u5e76\u4e3a\u4e00\u4e2a \u6709\u5e8f\u6570\u7ec4 \uff1b

\u9700\u8981\u6ce8\u610f\uff0c\u7531\u4e8e\u4ece\u957f\u5ea6\u4e3a 1 \u7684\u5b50\u6570\u7ec4\u5f00\u59cb\u5408\u5e76\uff0c\u6240\u4ee5 \u6bcf\u4e2a\u5b50\u6570\u7ec4\u90fd\u662f\u6709\u5e8f\u7684\u3002\u56e0\u6b64\uff0c\u5408\u5e76\u4efb\u52a1\u672c\u8d28\u662f\u8981 \u5c06\u4e24\u4e2a\u6709\u5e8f\u5b50\u6570\u7ec4\u5408\u5e76\u4e3a\u4e00\u4e2a\u6709\u5e8f\u6570\u7ec4\u3002

<1><2><3><4><5><6><7><8><9><10>

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5f52\u5e76\u6392\u5e8f\u7684\u9012\u5f52\u987a\u5e8f\u5c31\u662f\u4e8c\u53c9\u6811\u7684\u300c\u540e\u5e8f\u904d\u5386\u300d\u3002

  • \u540e\u5e8f\u904d\u5386\uff1a\u5148\u9012\u5f52\u5de6\u5b50\u6811\u3001\u518d\u9012\u5f52\u53f3\u5b50\u6811\u3001\u6700\u540e\u5904\u7406\u6839\u7ed3\u70b9\u3002
  • \u5f52\u5e76\u6392\u5e8f\uff1a\u5148\u9012\u5f52\u5de6\u5b50\u6811\u3001\u518d\u9012\u5f52\u53f3\u5b50\u6811\u3001\u6700\u540e\u5904\u7406\u5408\u5e76\u3002
JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig merge_sort.java
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(int[] nums, int left, int mid, int right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nint[] tmp = Arrays.copyOfRange(nums, left, right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(int[] nums, int left, int right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.cpp
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(vector<int>& nums, int left, int mid, int right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nvector<int> tmp(nums.begin() + left, nums.begin() + right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(vector<int>& nums, int left, int right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.py
def merge(nums: List[int], left: int, mid: int, right: int) -> None:\n\"\"\" \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 \"\"\"\n# \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n# \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\n# \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4 \u501f\u52a9 copy\u6a21\u5757\ntmp: List[int] = nums[left:right + 1].copy()\n# \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nleft_start: int = 0\nleft_end: int = mid - left\n# \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nright_start: int = mid + 1 - left\nright_end: int = right - left\n# i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\ni: int = left_start\nj: int = right_start\n# \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k in range(left, right + 1):\n# \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > left_end:\nnums[k] = tmp[j]\nj += 1\n# \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelif j > right_end or tmp[i] <= tmp[j]:\nnums[k] = tmp[i]\ni += 1\n# \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse:\nnums[k] = tmp[j]\nj += 1\ndef merge_sort(nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5f52\u5e76\u6392\u5e8f \"\"\"\n# \u7ec8\u6b62\u6761\u4ef6\nif left >= right:\nreturn                        # \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n# \u5212\u5206\u9636\u6bb5\nmid: int = (left + right) // 2    # \u8ba1\u7b97\u4e2d\u70b9\nmerge_sort(nums, left, mid)       # \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmerge_sort(nums, mid + 1, right)  # \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n# \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right)\n
merge_sort.go
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunc merge(nums []int, left, mid, right int) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4 \u501f\u52a9 copy \u6a21\u5757\ntmp := make([]int, right-left+1)\nfor i := left; i <= right; i++ {\ntmp[i-left] = nums[i]\n}\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nleftStart, leftEnd := left-left, mid-left\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nrightStart, rightEnd := mid+1-left, right-left\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\ni, j := leftStart, rightStart\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k := left; k <= right; k++ {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > leftEnd {\nnums[k] = tmp[j]\nj++\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if j > rightEnd || tmp[i] <= tmp[j] {\nnums[k] = tmp[i]\ni++\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j]\nj++\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunc mergeSort(nums []int, left, right int) {\n// \u7ec8\u6b62\u6761\u4ef6\nif left >= right {\nreturn\n}\n// \u5212\u5206\u9636\u6bb5\nmid := (left + right) / 2\nmergeSort(nums, left, mid)\nmergeSort(nums, mid+1, right)\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right)\n}\n
merge_sort.js
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunction merge(nums, left, mid, right) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = nums.slice(left, right + 1);   // \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nlet leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nlet rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nlet i = leftStart, j = rightStart;                // \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (let k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if (j > rightEnd || tmp[i] <= tmp[j]) {\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j++];\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunction mergeSort(nums, left, right) {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nlet mid = Math.floor((left + right) / 2);    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.ts
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunction merge(nums: number[], left: number, mid: number, right: number): void {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = nums.slice(left, right + 1);\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nlet i = leftStart, j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (let k = left; k <= right; k++) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if (j > rightEnd || tmp[i] <= tmp[j]) {\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j++];\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunction mergeSort(nums: number[], left: number, right: number): void {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return; // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nlet mid = Math.floor((left + right) / 2); // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid); // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.c
\n
merge_sort.cs
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nvoid merge(int[] nums, int left, int mid, int right)\n{\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nint[] tmp = nums[left..(right + 1)];\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nint leftStart = left - left, leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nint rightStart = mid + 1 - left, rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nint i = leftStart, j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor (int k = left; k <= right; k++)\n{\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd)\nnums[k] = tmp[j++];\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if (j > rightEnd || tmp[i] <= tmp[j])\nnums[k] = tmp[i++];\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse\nnums[k] = tmp[j++];\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nvoid mergeSort(int[] nums, int left, int right)\n{\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;       // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nint mid = (left + right) / 2;    // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums, left, mid);      // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums, mid + 1, right); // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums, left, mid, right);\n}\n
merge_sort.swift
/* \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4 */\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfunc merge(nums: inout [Int], left: Int, mid: Int, right: Int) {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nlet tmp = Array(nums[left ..< (right + 1)])\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet leftStart = left - left\nlet leftEnd = mid - left\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15\nlet rightStart = mid + 1 - left\nlet rightEnd = right - left\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nvar i = leftStart\nvar j = rightStart\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nfor k in left ... right {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif i > leftEnd {\nnums[k] = tmp[j]\nj += 1\n}\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\nelse if j > rightEnd || tmp[i] <= tmp[j] {\nnums[k] = tmp[i]\ni += 1\n}\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nelse {\nnums[k] = tmp[j]\nj += 1\n}\n}\n}\n/* \u5f52\u5e76\u6392\u5e8f */\nfunc mergeSort(nums: inout [Int], left: Int, right: Int) {\n// \u7ec8\u6b62\u6761\u4ef6\nif left >= right { // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nreturn\n}\n// \u5212\u5206\u9636\u6bb5\nlet mid = (left + right) / 2 // \u8ba1\u7b97\u4e2d\u70b9\nmergeSort(nums: &nums, left: left, right: mid) // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\nmergeSort(nums: &nums, left: mid + 1, right: right) // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\nmerge(nums: &nums, left: left, mid: mid, right: right)\n}\n
merge_sort.zig
// \u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\n// \u5de6\u5b50\u6570\u7ec4\u533a\u95f4 [left, mid]\n// \u53f3\u5b50\u6570\u7ec4\u533a\u95f4 [mid + 1, right]\nfn merge(nums: []i32, left: usize, mid: usize, right: usize) !void {\n// \u521d\u59cb\u5316\u8f85\u52a9\u6570\u7ec4\nvar mem_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);\ndefer mem_arena.deinit();\nconst mem_allocator = mem_arena.allocator();\nvar tmp = try mem_allocator.alloc(i32, right + 1 - left);\nstd.mem.copy(i32, tmp, nums[left..right+1]);\n// \u5de6\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15  \nvar leftStart = left - left;\nvar leftEnd = mid - left;\n// \u53f3\u5b50\u6570\u7ec4\u7684\u8d77\u59cb\u7d22\u5f15\u548c\u7ed3\u675f\u7d22\u5f15       \nvar rightStart = mid + 1 - left;\nvar rightEnd = right - left;\n// i, j \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u7684\u9996\u5143\u7d20\nvar i = leftStart;\nvar j = rightStart;\n// \u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u6765\u5408\u5e76\u5de6\u5b50\u6570\u7ec4\u548c\u53f3\u5b50\u6570\u7ec4\nvar k = left;\nwhile (k <= right) : (k += 1) {\n// \u82e5\u201c\u5de6\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\nif (i > leftEnd) {\nnums[k] = tmp[j];\nj += 1;\n// \u5426\u5219\uff0c\u82e5\u201c\u53f3\u5b50\u6570\u7ec4\u5df2\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u6216\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 <= \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u5de6\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 i++\n} else if  (j > rightEnd or tmp[i] <= tmp[j]) {\nnums[k] = tmp[i];\ni += 1;\n// \u5426\u5219\uff0c\u82e5\u201c\u5de6\u53f3\u5b50\u6570\u7ec4\u90fd\u672a\u5168\u90e8\u5408\u5e76\u5b8c\u201d\u4e14\u201c\u5de6\u5b50\u6570\u7ec4\u5143\u7d20 > \u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u201d\uff0c\u5219\u9009\u53d6\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\uff0c\u5e76\u4e14 j++\n} else {\nnums[k] = tmp[j];\nj += 1;\n}\n}\n}\n// \u5f52\u5e76\u6392\u5e8f\nfn mergeSort(nums: []i32, left: usize, right: usize) !void {\n// \u7ec8\u6b62\u6761\u4ef6\nif (left >= right) return;              // \u5f53\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\n// \u5212\u5206\u9636\u6bb5\nvar mid = (left + right) / 2;           // \u8ba1\u7b97\u4e2d\u70b9\ntry mergeSort(nums, left, mid);         // \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\ntry mergeSort(nums, mid + 1, right);    // \u9012\u5f52\u53f3\u5b50\u6570\u7ec4\n// \u5408\u5e76\u9636\u6bb5\ntry merge(nums, left, mid, right);\n}\n

\u4e0b\u9762\u91cd\u70b9\u89e3\u91ca\u4e00\u4e0b\u5408\u5e76\u65b9\u6cd5 merge() \u7684\u6d41\u7a0b\uff1a

  1. \u521d\u59cb\u5316\u4e00\u4e2a\u8f85\u52a9\u6570\u7ec4 tmp \u6682\u5b58\u5f85\u5408\u5e76\u533a\u95f4 [left, right] \u5185\u7684\u5143\u7d20\uff0c\u540e\u7eed\u901a\u8fc7\u8986\u76d6\u539f\u6570\u7ec4 nums \u7684\u5143\u7d20\u6765\u5b9e\u73b0\u5408\u5e76\uff1b
  2. \u521d\u59cb\u5316\u6307\u9488 i , j , k \u5206\u522b\u6307\u5411\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\u3001\u539f\u6570\u7ec4\u7684\u9996\u5143\u7d20\uff1b
  3. \u5faa\u73af\u5224\u65ad tmp[i] \u548c tmp[j] \u7684\u5927\u5c0f\uff0c\u5c06\u8f83\u5c0f\u7684\u5148\u8986\u76d6\u81f3 nums[k] \uff0c\u6307\u9488 i , j \u6839\u636e\u5224\u65ad\u7ed3\u679c\u4ea4\u66ff\u524d\u8fdb\uff08\u6307\u9488 k \u4e5f\u524d\u8fdb\uff09\uff0c\u76f4\u81f3\u4e24\u4e2a\u5b50\u6570\u7ec4\u90fd\u904d\u5386\u5b8c\uff0c\u5373\u53ef\u5b8c\u6210\u5408\u5e76\u3002

\u5408\u5e76\u65b9\u6cd5 merge() \u4ee3\u7801\u4e2d\u7684\u4e3b\u8981\u96be\u70b9\uff1a

  • nums \u7684\u5f85\u5408\u5e76\u533a\u95f4\u4e3a [left, right] \uff0c\u800c\u56e0\u4e3a tmp \u53ea\u590d\u5236\u4e86 nums \u8be5\u533a\u95f4\u5143\u7d20\uff0c\u6240\u4ee5 tmp \u5bf9\u5e94\u533a\u95f4\u4e3a [0, right - left] \uff0c\u9700\u8981\u7279\u522b\u6ce8\u610f\u4ee3\u7801\u4e2d\u5404\u4e2a\u53d8\u91cf\u7684\u542b\u4e49\u3002
  • \u5224\u65ad tmp[i] \u548c tmp[j] \u7684\u5927\u5c0f\u7684\u64cd\u4f5c\u4e2d\uff0c\u8fd8 \u9700\u8003\u8651\u5f53\u5b50\u6570\u7ec4\u904d\u5386\u5b8c\u6210\u540e\u7684\u7d22\u5f15\u8d8a\u754c\u95ee\u9898\uff0c\u5373 i > leftEnd \u548c j > rightEnd \u7684\u60c5\u51b5\uff0c\u7d22\u5f15\u8d8a\u754c\u7684\u4f18\u5148\u7ea7\u662f\u6700\u9ad8\u7684\uff0c\u4f8b\u5982\u5982\u679c\u5de6\u5b50\u6570\u7ec4\u5df2\u7ecf\u88ab\u5408\u5e76\u5b8c\u4e86\uff0c\u90a3\u4e48\u4e0d\u7528\u7ee7\u7eed\u5224\u65ad\uff0c\u76f4\u63a5\u5408\u5e76\u53f3\u5b50\u6570\u7ec4\u5143\u7d20\u5373\u53ef\u3002
"},{"location":"chapter_sorting/merge_sort/#1152","title":"11.5.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"
  • \u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n \\log n)\\) \uff1a\u5212\u5206\u5f62\u6210\u9ad8\u5ea6\u4e3a \\(\\log n\\) \u7684\u9012\u5f52\u6811\uff0c\u6bcf\u5c42\u5408\u5e76\u7684\u603b\u64cd\u4f5c\u6570\u91cf\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n \\log n)\\) \u65f6\u95f4\u3002
  • \u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u9700\u501f\u52a9\u8f85\u52a9\u6570\u7ec4\u5b9e\u73b0\u5408\u5e76\uff0c\u4f7f\u7528 \\(O(n)\\) \u5927\u5c0f\u7684\u989d\u5916\u7a7a\u95f4\uff1b\u9012\u5f52\u6df1\u5ea6\u4e3a \\(\\log n\\) \uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002
  • \u975e\u539f\u5730\u6392\u5e8f\uff1a\u8f85\u52a9\u6570\u7ec4\u9700\u8981\u4f7f\u7528 \\(O(n)\\) \u989d\u5916\u7a7a\u95f4\u3002
  • \u7a33\u5b9a\u6392\u5e8f\uff1a\u5728\u5408\u5e76\u65f6\u53ef\u4fdd\u8bc1\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u4e0d\u53d8\u3002
  • \u975e\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u5bf9\u4e8e\u4efb\u610f\u8f93\u5165\u6570\u636e\uff0c\u5f52\u5e76\u6392\u5e8f\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u76f8\u540c\u3002
"},{"location":"chapter_sorting/merge_sort/#1153","title":"11.5.3. \u00a0 \u94fe\u8868\u6392\u5e8f *","text":"

\u5f52\u5e76\u6392\u5e8f\u6709\u4e00\u4e2a\u5f88\u7279\u522b\u7684\u4f18\u52bf\uff0c\u7528\u4e8e\u6392\u5e8f\u94fe\u8868\u65f6\u6709\u5f88\u597d\u7684\u6027\u80fd\u8868\u73b0\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u53ef\u88ab\u4f18\u5316\u81f3 \\(O(1)\\) \uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u7531\u4e8e\u94fe\u8868\u53ef\u4ec5\u901a\u8fc7\u6539\u53d8\u6307\u9488\u6765\u5b9e\u73b0\u7ed3\u70b9\u589e\u5220\uff0c\u56e0\u6b64\u201c\u5c06\u4e24\u4e2a\u77ed\u6709\u5e8f\u94fe\u8868\u5408\u5e76\u4e3a\u4e00\u4e2a\u957f\u6709\u5e8f\u94fe\u8868\u201d\u65e0\u9700\u4f7f\u7528\u989d\u5916\u7a7a\u95f4\uff0c\u5373\u56de\u6eaf\u5408\u5e76\u9636\u6bb5\u4e0d\u7528\u50cf\u6392\u5e8f\u6570\u7ec4\u4e00\u6837\u5efa\u7acb\u8f85\u52a9\u6570\u7ec4 tmp \uff1b
  • \u901a\u8fc7\u4f7f\u7528\u300c\u8fed\u4ee3\u300d\u4ee3\u66ff\u300c\u9012\u5f52\u5212\u5206\u300d\uff0c\u53ef\u7701\u53bb\u9012\u5f52\u4f7f\u7528\u7684\u6808\u5e27\u7a7a\u95f4\uff1b

\u8be6\u60c5\u53c2\u8003\uff1a148. \u6392\u5e8f\u94fe\u8868

"},{"location":"chapter_sorting/quick_sort/","title":"11.4. \u00a0 \u5feb\u901f\u6392\u5e8f","text":"

\u300c\u5feb\u901f\u6392\u5e8f Quick Sort\u300d\u662f\u4e00\u79cd\u57fa\u4e8e\u201c\u5206\u6cbb\u601d\u60f3\u201d\u7684\u6392\u5e8f\u7b97\u6cd5\uff0c\u901f\u5ea6\u5f88\u5feb\u3001\u5e94\u7528\u5f88\u5e7f\u3002

\u5feb\u901f\u6392\u5e8f\u7684\u6838\u5fc3\u64cd\u4f5c\u4e3a\u300c\u54e8\u5175\u5212\u5206\u300d\uff0c\u5176\u76ee\u6807\u4e3a\uff1a\u9009\u53d6\u6570\u7ec4\u67d0\u4e2a\u5143\u7d20\u4e3a \u57fa\u51c6\u6570\uff0c\u5c06\u6240\u6709\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\u79fb\u52a8\u81f3\u5176\u5de6\u8fb9\uff0c\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\u79fb\u52a8\u81f3\u5176\u53f3\u8fb9\u3002\u300c\u54e8\u5175\u5212\u5206\u300d\u7684\u5b9e\u73b0\u6d41\u7a0b\u4e3a\uff1a

  1. \u4ee5\u6570\u7ec4\u6700\u5de6\u7aef\u5143\u7d20\u4f5c\u4e3a\u57fa\u51c6\u6570\uff0c\u521d\u59cb\u5316\u4e24\u4e2a\u6307\u9488 i , j \u6307\u5411\u6570\u7ec4\u4e24\u7aef\uff1b
  2. \u8bbe\u7f6e\u4e00\u4e2a\u5faa\u73af\uff0c\u6bcf\u8f6e\u4e2d\u4f7f\u7528 i / j \u5206\u522b\u5bfb\u627e\u9996\u4e2a\u6bd4\u57fa\u51c6\u6570\u5927 / \u5c0f\u7684\u5143\u7d20\uff0c\u5e76\u4ea4\u6362\u6b64\u4e24\u5143\u7d20\uff1b
  3. \u4e0d\u65ad\u5faa\u73af\u6b65\u9aa4 2. \uff0c\u76f4\u81f3 i , j \u76f8\u9047\u65f6\u8df3\u51fa\uff0c\u6700\u7ec8\u628a\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u4e2a\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\uff1b

\u300c\u54e8\u5175\u5212\u5206\u300d\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u539f\u6570\u7ec4\u88ab\u5212\u5206\u6210\u4e24\u4e2a\u90e8\u5206\uff0c\u5373 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4\uff0c\u4e14\u6ee1\u8db3 \u5de6\u5b50\u6570\u7ec4\u4efb\u610f\u5143\u7d20 < \u57fa\u51c6\u6570 < \u53f3\u5b50\u6570\u7ec4\u4efb\u610f\u5143\u7d20\u3002\u56e0\u6b64\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u53ea\u9700\u8981\u6392\u5e8f\u4e24\u4e2a\u5b50\u6570\u7ec4\u5373\u53ef\u3002

<1><2><3><4><5><6><7><8><9>

\u5feb\u901f\u6392\u5e8f\u7684\u5206\u6cbb\u601d\u60f3

\u54e8\u5175\u5212\u5206\u7684\u5b9e\u8d28\u662f\u5c06 \u4e00\u4e2a\u957f\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898 \u7b80\u5316\u4e3a \u4e24\u4e2a\u77ed\u6570\u7ec4\u7684\u6392\u5e8f\u95ee\u9898\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(int[] nums, int i, int j) {\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(int[] nums, int left, int right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.cpp
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(vector<int>& nums, int i, int j) {\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(vector<int>& nums, int left, int right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.py
def partition(self, nums: List[int], left: int, right: int) -> int:\n\"\"\" \u54e8\u5175\u5212\u5206 \"\"\"\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j = left, right\nwhile i < j:\nwhile i < j and nums[j] >= nums[left]:\nj -= 1  # \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile i < j and nums[i] <= nums[left]:\ni += 1  # \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n# \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n# \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i  # \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n
quick_sort.go
/* \u54e8\u5175\u5212\u5206 */\nfunc (q *quickSort) partition(nums []int, left, right int) int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j := left, right\nfor i < j {\nfor i < j && nums[j] >= nums[left] {\nj-- // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nfor i < j && nums[i] <= nums[left] {\ni++ // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n}\n// \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.js
/* \u5143\u7d20\u4ea4\u6362 */\nswap(nums, i, j) {\nlet tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\npartition(nums, left, right) {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.ts
/* \u5143\u7d20\u4ea4\u6362 */\nswap(nums: number[], i: number, j: number): void {\nlet tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\npartition(nums: number[], left: number, right: number): number {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n// \u5143\u7d20\u4ea4\u6362\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.c
[class]{quickSort}-[func]{partition}\n
quick_sort.cs
/* \u5143\u7d20\u4ea4\u6362 */\nvoid swap(int[] nums, int i, int j)\n{\nint tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n/* \u54e8\u5175\u5212\u5206 */\nint partition(int[] nums, int left, int right)\n{\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j)\n{\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.swift
/* \u5143\u7d20\u4ea4\u6362 */\nfunc swap(nums: inout [Int], i: Int, j: Int) {\nlet tmp = nums[i]\nnums[i] = nums[j]\nnums[j] = tmp\n}\n/* \u54e8\u5175\u5212\u5206 */\nfunc partition(nums: inout [Int], left: Int, right: Int) -> Int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left\nvar j = right\nwhile i < j {\nwhile i < j, nums[j] >= nums[left] {\nj -= 1 // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile i < j, nums[i] <= nums[left] {\ni += 1 // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nswap(nums: &nums, i: i, j: j) // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums: &nums, i: i, j: left) // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.zig
// \u5143\u7d20\u4ea4\u6362\nfn swap(nums: []i32, i: usize, j: usize) void {\nvar tmp = nums[i];\nnums[i] = nums[j];\nnums[j] = tmp;\n}\n// \u54e8\u5175\u5212\u5206\nfn partition(nums: []i32, left: usize, right: usize) usize {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left;\nvar j = right;\nwhile (i < j) {\nwhile (i < j and nums[j] >= nums[left]) j -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j and nums[i] <= nums[left]) i += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j);   // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);    // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;               // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
"},{"location":"chapter_sorting/quick_sort/#1141","title":"11.4.1. \u00a0 \u7b97\u6cd5\u6d41\u7a0b","text":"
  1. \u9996\u5148\uff0c\u5bf9\u6570\u7ec4\u6267\u884c\u4e00\u6b21\u300c\u54e8\u5175\u5212\u5206\u300d\uff0c\u5f97\u5230\u5f85\u6392\u5e8f\u7684 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4\uff1b
  2. \u63a5\u4e0b\u6765\uff0c\u5bf9 \u5de6\u5b50\u6570\u7ec4 \u548c \u53f3\u5b50\u6570\u7ec4 \u5206\u522b \u9012\u5f52\u6267\u884c\u300c\u54e8\u5175\u5212\u5206\u300d\u2026\u2026
  3. \u76f4\u81f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6 \u7ec8\u6b62\u9012\u5f52\uff0c\u5373\u53ef\u5b8c\u6210\u5bf9\u6574\u4e2a\u6570\u7ec4\u7684\u6392\u5e8f\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5feb\u901f\u6392\u5e8f\u548c\u300c\u4e8c\u5206\u67e5\u627e\u300d\u7684\u539f\u7406\u7c7b\u4f3c\uff0c\u90fd\u662f\u4ee5\u5bf9\u6570\u9636\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u7f29\u5c0f\u5904\u7406\u533a\u95f4\u3002

Fig. \u5feb\u901f\u6392\u5e8f\u6d41\u7a0b

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(int[] nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.cpp
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(vector<int>& nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.py
def quick_sort(self, nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5feb\u901f\u6392\u5e8f \"\"\"\n# \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right:\nreturn\n# \u54e8\u5175\u5212\u5206\npivot: int = self.partition(nums, left, right)\n# \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nself.quick_sort(nums, left, pivot - 1)\nself.quick_sort(nums, pivot + 1, right)\n
quick_sort.go
/* \u5feb\u901f\u6392\u5e8f */\nfunc (q *quickSort) quickSort(nums []int, left, right int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right {\nreturn\n}\n// \u54e8\u5175\u5212\u5206\npivot := q.partition(nums, left, right)\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nq.quickSort(nums, left, pivot-1)\nq.quickSort(nums, pivot+1, right)\n}\n
quick_sort.js
/* \u5feb\u901f\u6392\u5e8f */\nquickSort(nums, left, right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) return;\n// \u54e8\u5175\u5212\u5206\nconst pivot = this.partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nthis.quickSort(nums, left, pivot - 1);\nthis.quickSort(nums, pivot + 1, right);\n}\n
quick_sort.ts
/* \u5feb\u901f\u6392\u5e8f */\nquickSort(nums: number[], left: number, right: number): void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) {\nreturn;\n}\n// \u54e8\u5175\u5212\u5206\nconst pivot = this.partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nthis.quickSort(nums, left, pivot - 1);\nthis.quickSort(nums, pivot + 1, right);\n}\n
quick_sort.c
[class]{quickSort}-[func]{quickSort}\n
quick_sort.cs
/* \u5feb\u901f\u6392\u5e8f */\nvoid quickSort(int[] nums, int left, int right)\n{\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right)\nreturn;\n// \u54e8\u5175\u5212\u5206\nint pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
quick_sort.swift
/* \u5feb\u901f\u6392\u5e8f */\nfunc quickSort(nums: inout [Int], left: Int, right: Int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif left >= right {\nreturn\n}\n// \u54e8\u5175\u5212\u5206\nlet pivot = partition(nums: &nums, left: left, right: right)\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums: &nums, left: left, right: pivot - 1)\nquickSort(nums: &nums, left: pivot + 1, right: right)\n}\n
quick_sort.zig
// \u5feb\u901f\u6392\u5e8f\nfn quickSort(nums: []i32, left: usize, right: usize) void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nif (left >= right) return;\n// \u54e8\u5175\u5212\u5206\nvar pivot = partition(nums, left, right);\n// \u9012\u5f52\u5de6\u5b50\u6570\u7ec4\u3001\u53f3\u5b50\u6570\u7ec4\nquickSort(nums, left, pivot - 1);\nquickSort(nums, pivot + 1, right);\n}\n
"},{"location":"chapter_sorting/quick_sort/#1142","title":"11.4.2. \u00a0 \u7b97\u6cd5\u7279\u6027","text":"

\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n \\log n)\\) \uff1a\u5e73\u5747\u60c5\u51b5\u4e0b\uff0c\u54e8\u5175\u5212\u5206\u7684\u9012\u5f52\u5c42\u6570\u4e3a \\(\\log n\\) \uff0c\u6bcf\u5c42\u4e2d\u7684\u603b\u5faa\u73af\u6570\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n \\log n)\\) \u65f6\u95f4\u3002

\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6 \\(O(n^2)\\) \uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u5c06\u957f\u5ea6\u4e3a \\(n\\) \u7684\u6570\u7ec4\u5212\u5206\u4e3a\u957f\u5ea6\u4e3a \\(0\\) \u548c \\(n - 1\\) \u7684\u4e24\u4e2a\u5b50\u6570\u7ec4\uff0c\u6b64\u65f6\u9012\u5f52\u5c42\u6570\u8fbe\u5230 \\(n\\) \u5c42\uff0c\u6bcf\u5c42\u4e2d\u7684\u5faa\u73af\u6570\u4e3a \\(n\\) \uff0c\u603b\u4f53\u4f7f\u7528 \\(O(n^2)\\) \u65f6\u95f4\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6 \\(O(n)\\) \uff1a\u8f93\u5165\u6570\u7ec4\u5b8c\u5168\u5012\u5e8f\u4e0b\uff0c\u8fbe\u5230\u6700\u5dee\u9012\u5f52\u6df1\u5ea6 \\(n\\) \u3002

\u539f\u5730\u6392\u5e8f\uff1a\u53ea\u5728\u9012\u5f52\u4e2d\u4f7f\u7528 \\(O(\\log n)\\) \u5927\u5c0f\u7684\u6808\u5e27\u7a7a\u95f4\u3002

\u975e\u7a33\u5b9a\u6392\u5e8f\uff1a\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u53ef\u80fd\u6539\u53d8\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u3002

\u81ea\u9002\u5e94\u6392\u5e8f\uff1a\u6700\u5dee\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n^2)\\) \u3002

"},{"location":"chapter_sorting/quick_sort/#1143","title":"11.4.3. \u00a0 \u5feb\u6392\u4e3a\u4ec0\u4e48\u5feb\uff1f","text":"

\u4ece\u547d\u540d\u80fd\u591f\u770b\u51fa\uff0c\u5feb\u901f\u6392\u5e8f\u5728\u6548\u7387\u65b9\u9762\u4e00\u5b9a\u201c\u6709\u4e24\u628a\u5237\u5b50\u201d\u3002\u5feb\u901f\u6392\u5e8f\u7684\u5e73\u5747\u65f6\u95f4\u590d\u6742\u5ea6\u867d\u7136\u4e0e\u300c\u5f52\u5e76\u6392\u5e8f\u300d\u548c\u300c\u5806\u6392\u5e8f\u300d\u4e00\u81f4\uff0c\u4f46\u5b9e\u9645 \u6548\u7387\u66f4\u9ad8\uff0c\u8fd9\u662f\u56e0\u4e3a\uff1a

  • \u51fa\u73b0\u6700\u5dee\u60c5\u51b5\u7684\u6982\u7387\u5f88\u4f4e\uff1a\u867d\u7136\u5feb\u901f\u6392\u5e8f\u7684\u6700\u5dee\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n^2)\\) \uff0c\u4e0d\u5982\u5f52\u5e76\u6392\u5e8f\uff0c\u4f46\u7edd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u5feb\u901f\u6392\u5e8f\u53ef\u4ee5\u8fbe\u5230 \\(O(n \\log n)\\) \u7684\u590d\u6742\u5ea6\u3002
  • \u7f13\u5b58\u4f7f\u7528\u6548\u7387\u9ad8\uff1a\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u65f6\uff0c\u5c06\u6574\u4e2a\u5b50\u6570\u7ec4\u52a0\u8f7d\u5165\u7f13\u5b58\u4e2d\uff0c\u8bbf\u95ee\u5143\u7d20\u6548\u7387\u5f88\u9ad8\u3002\u800c\u8bf8\u5982\u300c\u5806\u6392\u5e8f\u300d\u9700\u8981\u8df3\u8dc3\u5f0f\u8bbf\u95ee\u5143\u7d20\uff0c\u56e0\u6b64\u4e0d\u5177\u6709\u6b64\u7279\u6027\u3002
  • \u590d\u6742\u5ea6\u7684\u5e38\u6570\u7cfb\u6570\u4f4e\uff1a\u5728\u63d0\u53ca\u7684\u4e09\u79cd\u7b97\u6cd5\u4e2d\uff0c\u5feb\u901f\u6392\u5e8f\u7684 \u6bd4\u8f83\u3001\u8d4b\u503c\u3001\u4ea4\u6362 \u4e09\u79cd\u64cd\u4f5c\u7684\u603b\u4f53\u6570\u91cf\u6700\u5c11\uff08\u7c7b\u4f3c\u4e8e\u300c\u63d2\u5165\u6392\u5e8f\u300d\u5feb\u4e8e\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u7684\u539f\u56e0\uff09\u3002
"},{"location":"chapter_sorting/quick_sort/#1144","title":"11.4.4. \u00a0 \u57fa\u51c6\u6570\u4f18\u5316","text":"

\u666e\u901a\u5feb\u901f\u6392\u5e8f\u5728\u67d0\u4e9b\u8f93\u5165\u4e0b\u7684\u65f6\u95f4\u6548\u7387\u53d8\u5dee\u3002\u4e3e\u4e2a\u6781\u7aef\u4f8b\u5b50\uff0c\u5047\u8bbe\u8f93\u5165\u6570\u7ec4\u662f\u5b8c\u5168\u5012\u5e8f\u7684\uff0c\u7531\u4e8e\u6211\u4eec\u9009\u53d6\u6700\u5de6\u7aef\u5143\u7d20\u4e3a\u57fa\u51c6\u6570\uff0c\u90a3\u4e48\u5728\u54e8\u5175\u5212\u5206\u5b8c\u6210\u540e\uff0c\u57fa\u51c6\u6570\u88ab\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u53f3\u7aef\uff0c\u4ece\u800c \u5de6\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a \\(n - 1\\)\u3001\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a \\(0\\) \u3002\u8fd9\u6837\u8fdb\u4e00\u6b65\u9012\u5f52\u4e0b\u53bb\uff0c\u6bcf\u8f6e\u54e8\u5175\u5212\u5206\u540e\u7684\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u90fd\u4e3a \\(0\\) \uff0c\u5206\u6cbb\u7b56\u7565\u5931\u6548\uff0c\u5feb\u901f\u6392\u5e8f\u9000\u5316\u4e3a\u300c\u5192\u6ce1\u6392\u5e8f\u300d\u4e86\u3002

\u4e3a\u4e86\u5c3d\u91cf\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u53d1\u751f\uff0c\u6211\u4eec\u53ef\u4ee5\u4f18\u5316\u4e00\u4e0b\u57fa\u51c6\u6570\u7684\u9009\u53d6\u7b56\u7565\u3002\u9996\u5148\uff0c\u5728\u54e8\u5175\u5212\u5206\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5 \u968f\u673a\u9009\u53d6\u4e00\u4e2a\u5143\u7d20\u4f5c\u4e3a\u57fa\u51c6\u6570\u3002\u4f46\u5982\u679c\u8fd0\u6c14\u5f88\u5dee\uff0c\u6bcf\u6b21\u90fd\u9009\u62e9\u5230\u6bd4\u8f83\u5dee\u7684\u57fa\u51c6\u6570\uff0c\u90a3\u4e48\u6548\u7387\u4f9d\u7136\u4e0d\u597d\u3002

\u8fdb\u4e00\u6b65\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6570\u7ec4\u4e2d\u9009\u53d6 3 \u4e2a\u5019\u9009\u5143\u7d20\uff08\u4e00\u822c\u4e3a\u6570\u7ec4\u7684\u9996\u3001\u5c3e\u3001\u4e2d\u70b9\u5143\u7d20\uff09\uff0c\u5e76\u5c06\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\u4f5c\u4e3a\u57fa\u51c6\u6570\uff0c\u8fd9\u6837\u57fa\u51c6\u6570\u201c\u65e2\u4e0d\u5927\u4e5f\u4e0d\u5c0f\u201d\u7684\u6982\u7387\u5c31\u5927\u5927\u63d0\u5347\u4e86\u3002\u5f53\u7136\uff0c\u5982\u679c\u6570\u7ec4\u5f88\u957f\u7684\u8bdd\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u9009\u53d6\u66f4\u591a\u5019\u9009\u5143\u7d20\uff0c\u6765\u8fdb\u4e00\u6b65\u63d0\u5347\u7b97\u6cd5\u7684\u7a33\u5065\u6027\u3002\u91c7\u53d6\u8be5\u65b9\u6cd5\u540e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n^2)\\) \u7684\u6982\u7387\u6781\u4f4e\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(int[] nums, int left, int mid, int right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(int[] nums, int left, int right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.cpp
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(vector<int>& nums, int left, int mid, int right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(vector<int>& nums, int left, int right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.py
def median_three(self, nums: List[int], left: int, mid: int, right: int) -> int:\n\"\"\" \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 \"\"\"\n# \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n# \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (nums[left] < nums[mid]) ^ (nums[left] < nums[right]):\nreturn left\nelif (nums[mid] < nums[left]) ^ (nums[mid] < nums[right]):\nreturn mid\nreturn right\ndef partition(self, nums: List[int], left: int, right: int) -> int:\n\"\"\" \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 \"\"\"\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nmed: int = self.median_three(nums, left, (left + right) // 2, right)\n# \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nnums[left], nums[med] = nums[med], nums[left]\n# \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j = left, right\nwhile i < j:\nwhile i < j and nums[j] >= nums[left]:\nj -= 1  # \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile i < j and nums[i] <= nums[left]:\ni += 1  # \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n# \u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n# \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i  # \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n
quick_sort.go
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nfunc (q *quickSortMedian) medianThree(nums []int, left, mid, right int) int {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\uff08!= \u5728\u8fd9\u91cc\u8d77\u5230\u5f02\u6216\u7684\u4f5c\u7528\uff09\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (nums[left] < nums[mid]) != (nums[left] < nums[right]) {\nreturn left\n} else if (nums[mid] < nums[left]) != (nums[mid] < nums[right]) {\nreturn mid\n}\nreturn right\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09*/\nfunc (q *quickSortMedian) partition(nums []int, left, right int) int {\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nmed := q.medianThree(nums, left, (left+right)/2, right)\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nnums[left], nums[med] = nums[med], nums[left]\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\ni, j := left, right\nfor i < j {\nfor i < j && nums[j] >= nums[left] {\nj-- //\u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nfor i < j && nums[i] <= nums[left] {\ni++ //\u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\n//\u5143\u7d20\u4ea4\u6362\nnums[i], nums[j] = nums[j], nums[i]\n}\n//\u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nnums[i], nums[left] = nums[left], nums[i]\nreturn i //\u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.js
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nmedianThree(nums, left, mid, right) {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right])) return left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right])) return mid;\nelse return right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\npartition(nums, left, right) {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = this.medianThree(nums, left, Math.floor((left + right) / 2), right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nthis.swap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) j--; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left]) i++; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.ts
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nmedianThree(nums: number[], left: number, mid: number, right: number): number {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif (Number(nums[left] < nums[mid]) ^ Number(nums[left] < nums[right])) {\nreturn left;\n} else if (Number(nums[mid] < nums[left]) ^ Number(nums[mid] < nums[right])) {\nreturn mid;\n} else {\nreturn right;\n}\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\npartition(nums: number[], left: number, right: number): number {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = this.medianThree(nums, left, Math.floor((left + right) / 2), right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nthis.swap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nlet i = left, j = right;\nwhile (i < j) {\nwhile (i < j && nums[j] >= nums[left]) {\nj--; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nwhile (i < j && nums[i] <= nums[left]) {\ni++; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\n}\nthis.swap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nthis.swap(nums, i, left); // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i; // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.c
[class]{quickSortMedian}-[func]{medianThree}\n[class]{quickSortMedian}-[func]{partition}\n
quick_sort.cs
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nint medianThree(int[] nums, int left, int mid, int right)\n{\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))\nreturn left;\nelse if ((nums[mid] < nums[left]) ^ (nums[mid] < nums[right]))\nreturn mid;\nelse\nreturn right;\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nint partition(int[] nums, int left, int right)\n{\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nint med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nint i = left, j = right;\nwhile (i < j)\n{\nwhile (i < j && nums[j] >= nums[left])\nj--;          // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j && nums[i] <= nums[left])\ni++;          // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j); // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);  // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;             // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
quick_sort.swift
/* \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570 */\nfunc medianThree(nums: [Int], left: Int, mid: Int, right: Int) -> Int {\nif (nums[left] < nums[mid]) != (nums[left] < nums[right]) {\nreturn left\n} else if (nums[mid] < nums[left]) != (nums[mid] < nums[right]) {\nreturn mid\n} else {\nreturn right\n}\n}\n/* \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09 */\nfunc partitionMedian(nums: inout [Int], left: Int, right: Int) -> Int {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nlet med = medianThree(nums: nums, left: left, mid: (left + right) / 2, right: right)\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums: &nums, i: left, j: med)\nreturn partition(nums: &nums, left: left, right: right)\n}\n
quick_sort.zig
// \u9009\u53d6\u4e09\u4e2a\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nfn medianThree(nums: []i32, left: usize, mid: usize, right: usize) usize {\n// \u6b64\u5904\u4f7f\u7528\u5f02\u6216\u8fd0\u7b97\u6765\u7b80\u5316\u4ee3\u7801\n// \u5f02\u6216\u89c4\u5219\u4e3a 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1\nif ((nums[left] < nums[mid]) != (nums[left] < nums[right])) {\nreturn left;\n} else if ((nums[mid] < nums[left]) != (nums[mid] < nums[right])) {\nreturn mid;\n} else {\nreturn right;\n}\n}\n// \u54e8\u5175\u5212\u5206\uff08\u4e09\u6570\u53d6\u4e2d\u503c\uff09\nfn partition(nums: []i32, left: usize, right: usize) usize {\n// \u9009\u53d6\u4e09\u4e2a\u5019\u9009\u5143\u7d20\u7684\u4e2d\u4f4d\u6570\nvar med = medianThree(nums, left, (left + right) / 2, right);\n// \u5c06\u4e2d\u4f4d\u6570\u4ea4\u6362\u81f3\u6570\u7ec4\u6700\u5de6\u7aef\nswap(nums, left, med);\n// \u4ee5 nums[left] \u4f5c\u4e3a\u57fa\u51c6\u6570\nvar i = left;\nvar j = right;\nwhile (i < j) {\nwhile (i < j and nums[j] >= nums[left]) j -= 1; // \u4ece\u53f3\u5411\u5de6\u627e\u9996\u4e2a\u5c0f\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nwhile (i < j and nums[i] <= nums[left]) i += 1; // \u4ece\u5de6\u5411\u53f3\u627e\u9996\u4e2a\u5927\u4e8e\u57fa\u51c6\u6570\u7684\u5143\u7d20\nswap(nums, i, j);   // \u4ea4\u6362\u8fd9\u4e24\u4e2a\u5143\u7d20\n}\nswap(nums, i, left);    // \u5c06\u57fa\u51c6\u6570\u4ea4\u6362\u81f3\u4e24\u5b50\u6570\u7ec4\u7684\u5206\u754c\u7ebf\nreturn i;               // \u8fd4\u56de\u57fa\u51c6\u6570\u7684\u7d22\u5f15\n}\n
"},{"location":"chapter_sorting/quick_sort/#1145","title":"11.4.5. \u00a0 \u5c3e\u9012\u5f52\u4f18\u5316","text":"

\u666e\u901a\u5feb\u901f\u6392\u5e8f\u5728\u67d0\u4e9b\u8f93\u5165\u4e0b\u7684\u7a7a\u95f4\u6548\u7387\u53d8\u5dee\u3002\u4ecd\u7136\u4ee5\u5b8c\u5168\u5012\u5e8f\u7684\u8f93\u5165\u6570\u7ec4\u4e3a\u4f8b\uff0c\u7531\u4e8e\u6bcf\u8f6e\u54e8\u5175\u5212\u5206\u540e\u53f3\u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 0 \uff0c\u90a3\u4e48\u5c06\u5f62\u6210\u4e00\u4e2a\u9ad8\u5ea6\u4e3a \\(n - 1\\) \u7684\u9012\u5f52\u6811\uff0c\u6b64\u65f6\u4f7f\u7528\u7684\u6808\u5e27\u7a7a\u95f4\u5927\u5c0f\u52a3\u5316\u81f3 \\(O(n)\\) \u3002

\u4e3a\u4e86\u907f\u514d\u6808\u5e27\u7a7a\u95f4\u7684\u7d2f\u79ef\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6bcf\u8f6e\u54e8\u5175\u6392\u5e8f\u5b8c\u6210\u540e\uff0c\u5224\u65ad\u4e24\u4e2a\u5b50\u6570\u7ec4\u7684\u957f\u5ea6\u5927\u5c0f\uff0c\u4ec5\u9012\u5f52\u6392\u5e8f\u8f83\u77ed\u7684\u5b50\u6570\u7ec4\u3002\u7531\u4e8e\u8f83\u77ed\u7684\u5b50\u6570\u7ec4\u957f\u5ea6\u4e0d\u4f1a\u8d85\u8fc7 \\(\\frac{n}{2}\\) \uff0c\u56e0\u6b64\u8fd9\u6837\u505a\u80fd\u4fdd\u8bc1\u9012\u5f52\u6df1\u5ea6\u4e0d\u8d85\u8fc7 \\(\\log n\\) \uff0c\u5373\u6700\u5dee\u7a7a\u95f4\u590d\u6742\u5ea6\u88ab\u4f18\u5316\u81f3 \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig quick_sort.java
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(int[] nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.cpp
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(vector<int>& nums, int left, int right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.py
def quick_sort(self, nums: List[int], left: int, right: int) -> None:\n\"\"\" \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 \"\"\"\n# \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile left < right:\n# \u54e8\u5175\u5212\u5206\u64cd\u4f5c\npivot: int = self.partition(nums, left, right)\n# \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif pivot - left < right - pivot:\nself.quick_sort(nums, left, pivot - 1)  # \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1     # \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\nelse:\nself.quick_sort(nums, pivot + 1, right)  # \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1    # \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n
quick_sort.go
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09*/\nfunc (q *quickSortTailCall) quickSort(nums []int, left, right int) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nfor left < right {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\npivot := q.partition(nums, left, right)\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif pivot-left < right-pivot {\nq.quickSort(nums, left, pivot-1) // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1                 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nq.quickSort(nums, pivot+1, right) // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1                 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.js
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nquickSort(nums, left, right) {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = this.partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nthis.quickSort(nums, left, pivot - 1); // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nthis.quickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.ts
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nquickSort(nums: number[], left: number, right: number): void {\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = this.partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nthis.quickSort(nums, left, pivot - 1); // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nthis.quickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.c
[class]{quickSortTailCall}-[func]{quickSort}\n
quick_sort.cs
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nvoid quickSort(int[] nums, int left, int right)\n{\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile (left < right)\n{\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nint pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot)\n{\nquickSort(nums, left, pivot - 1);  // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n}\nelse\n{\nquickSort(nums, pivot + 1, right); // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1; // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.swift
/* \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09 */\nfunc quickSortTailCall(nums: inout [Int], left: Int, right: Int) {\nvar left = left\nvar right = right\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\nwhile left < right {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nlet pivot = partition(nums: &nums, left: left, right: right)\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left) < (right - pivot) {\nquickSortTailCall(nums: &nums, left: left, right: pivot - 1) // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSortTailCall(nums: &nums, left: pivot + 1, right: right) // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1 // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
quick_sort.zig
// \u5feb\u901f\u6392\u5e8f\uff08\u5c3e\u9012\u5f52\u4f18\u5316\uff09\nfn quickSort(nums: []i32, left_: usize, right_: usize) void {\nvar left = left_;\nvar right = right_;\n// \u5b50\u6570\u7ec4\u957f\u5ea6\u4e3a 1 \u65f6\u7ec8\u6b62\u9012\u5f52\nwhile (left < right) {\n// \u54e8\u5175\u5212\u5206\u64cd\u4f5c\nvar pivot = partition(nums, left, right);\n// \u5bf9\u4e24\u4e2a\u5b50\u6570\u7ec4\u4e2d\u8f83\u77ed\u7684\u90a3\u4e2a\u6267\u884c\u5feb\u6392\nif (pivot - left < right - pivot) {\nquickSort(nums, left, pivot - 1);   // \u9012\u5f52\u6392\u5e8f\u5de6\u5b50\u6570\u7ec4\nleft = pivot + 1;                   // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [pivot + 1, right]\n} else {\nquickSort(nums, pivot + 1, right);  // \u9012\u5f52\u6392\u5e8f\u53f3\u5b50\u6570\u7ec4\nright = pivot - 1;                  // \u5269\u4f59\u5f85\u6392\u5e8f\u533a\u95f4\u4e3a [left, pivot - 1]\n}\n}\n}\n
"},{"location":"chapter_sorting/summary/","title":"11.6. \u00a0 \u5c0f\u7ed3","text":"
  • \u5192\u6ce1\u6392\u5e8f\u901a\u8fc7\u4ea4\u6362\u76f8\u90bb\u5143\u7d20\u6765\u5b9e\u73b0\u6392\u5e8f\u3002\u901a\u8fc7\u589e\u52a0\u6807\u5fd7\u4f4d\u5b9e\u73b0\u63d0\u524d\u8fd4\u56de\uff0c\u6211\u4eec\u53ef\u5c06\u5192\u6ce1\u6392\u5e8f\u7684\u6700\u4f73\u65f6\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(N)\\) \u3002
  • \u63d2\u5165\u6392\u5e8f\u6bcf\u8f6e\u5c06\u5f85\u6392\u5e8f\u533a\u95f4\u5185\u5143\u7d20\u63d2\u5165\u81f3\u5df2\u6392\u5e8f\u533a\u95f4\u7684\u6b63\u786e\u4f4d\u7f6e\uff0c\u4ece\u800c\u5b9e\u73b0\u6392\u5e8f\u3002\u63d2\u5165\u6392\u5e8f\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u867d\u4e3a \\(O(N^2)\\) \uff0c\u4f46\u56e0\u4e3a\u603b\u4f53\u64cd\u4f5c\u5c11\u800c\u5f88\u53d7\u6b22\u8fce\uff0c\u4e00\u822c\u7528\u4e8e\u5c0f\u6570\u636e\u91cf\u7684\u6392\u5e8f\u5de5\u4f5c\u3002
  • \u5feb\u901f\u6392\u5e8f\u57fa\u4e8e\u54e8\u5175\u5212\u5206\u64cd\u4f5c\u5b9e\u73b0\u6392\u5e8f\u3002\u5728\u54e8\u5175\u5212\u5206\u4e2d\uff0c\u6709\u53ef\u80fd\u6bcf\u6b21\u90fd\u9009\u53d6\u5230\u6700\u5dee\u7684\u57fa\u51c6\u6570\uff0c\u4ece\u800c\u5bfc\u81f4\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(N^2)\\) \uff0c\u901a\u8fc7\u5f15\u5165\u4e2d\u4f4d\u6570\u57fa\u51c6\u6570\u6216\u968f\u673a\u57fa\u51c6\u6570\u53ef\u5927\u5927\u964d\u4f4e\u52a3\u5316\u6982\u7387\u3002\u5c3e\u9012\u5f52\u65b9\u6cd5\u53ef\u4ee5\u6709\u6548\u51cf\u5c0f\u9012\u5f52\u6df1\u5ea6\uff0c\u5c06\u7a7a\u95f4\u590d\u6742\u5ea6\u4f18\u5316\u81f3 \\(O(\\log N)\\) \u3002
  • \u5f52\u5e76\u6392\u5e8f\u5305\u542b\u5212\u5206\u548c\u5408\u5e76\u4e24\u4e2a\u9636\u6bb5\uff0c\u662f\u5206\u800c\u6cbb\u4e4b\u7684\u6807\u51c6\u4f53\u73b0\u3002\u5bf9\u4e8e\u5f52\u5e76\u6392\u5e8f\uff0c\u6392\u5e8f\u6570\u7ec4\u9700\u8981\u501f\u52a9\u8f85\u52a9\u6570\u7ec4\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(N)\\) \uff1b\u800c\u6392\u5e8f\u94fe\u8868\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u53ef\u4ee5\u88ab\u4f18\u5316\u81f3 \\(O(1)\\) \u3002
  • \u4e0b\u56fe\u603b\u7ed3\u5bf9\u6bd4\u4e86\u5404\u4e2a\u6392\u5e8f\u7b97\u6cd5\u7684\u8fd0\u884c\u6548\u7387\u4e0e\u7279\u6027\u3002\u5176\u4e2d\uff0c\u6876\u6392\u5e8f\u4e2d \\(k\\) \u4e3a\u6876\u7684\u6570\u91cf\uff1b\u57fa\u6570\u6392\u5e8f\u4ec5\u9002\u7528\u4e8e\u6b63\u6574\u6570\u3001\u5b57\u7b26\u4e32\u3001\u7279\u5b9a\u683c\u5f0f\u7684\u6d6e\u70b9\u6570\uff0c\\(k\\) \u4e3a\u6700\u5927\u6570\u5b57\u7684\u4f4d\u6570\u3002

Fig. \u6392\u5e8f\u7b97\u6cd5\u5bf9\u6bd4

  • \u603b\u4f53\u6765\u770b\uff0c\u6211\u4eec\u8ffd\u6c42\u8fd0\u884c\u5feb\u3001\u7a33\u5b9a\u3001\u539f\u5730\u3001\u6b63\u5411\u81ea\u9002\u5e94\u6027\u7684\u6392\u5e8f\u3002\u663e\u7136\uff0c\u5982\u540c\u5176\u5b83\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u4e00\u6837\uff0c\u540c\u65f6\u6ee1\u8db3\u8fd9\u4e9b\u6761\u4ef6\u7684\u6392\u5e8f\u7b97\u6cd5\u5e76\u4e0d\u5b58\u5728\uff0c\u6211\u4eec\u9700\u8981\u6839\u636e\u95ee\u9898\u7279\u70b9\u6765\u9009\u62e9\u6392\u5e8f\u7b97\u6cd5\u3002
"},{"location":"chapter_stack_and_queue/deque/","title":"5.3. \u00a0 \u53cc\u5411\u961f\u5217","text":"

\u5bf9\u4e8e\u961f\u5217\uff0c\u6211\u4eec\u53ea\u80fd\u5728\u5934\u90e8\u5220\u9664\u6216\u5728\u5c3e\u90e8\u6dfb\u52a0\u5143\u7d20\uff0c\u800c\u300c\u53cc\u5411\u961f\u5217 Deque\u300d\u66f4\u52a0\u7075\u6d3b\uff0c\u5728\u5176\u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u80fd\u6267\u884c\u5143\u7d20\u6dfb\u52a0\u6216\u5220\u9664\u64cd\u4f5c\u3002

Fig. \u53cc\u5411\u961f\u5217\u7684\u64cd\u4f5c

"},{"location":"chapter_stack_and_queue/deque/#531","title":"5.3.1. \u00a0 \u53cc\u5411\u961f\u5217\u5e38\u7528\u64cd\u4f5c","text":"

\u53cc\u5411\u961f\u5217\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff0c\u65b9\u6cd5\u540d\u9700\u6839\u636e\u8bed\u8a00\u6765\u786e\u5b9a\u3002

\u65b9\u6cd5\u540d \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 pushFirst() \u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u9996 \\(O(1)\\) pushLast() \u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u5c3e \\(O(1)\\) popFirst() \u5220\u9664\u961f\u9996\u5143\u7d20 \\(O(1)\\) popLast() \u5220\u9664\u961f\u5c3e\u5143\u7d20 \\(O(1)\\) peekFirst() \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \\(O(1)\\) peekLast() \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \\(O(1)\\)

\u76f8\u540c\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u53cc\u5411\u961f\u5217\u7c7b\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig deque.java
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\nDeque<Integer> deque = new LinkedList<>();\n/* \u5143\u7d20\u5165\u961f */\ndeque.offerLast(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.offerLast(5);\ndeque.offerLast(4);\ndeque.offerFirst(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.offerFirst(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint peekFirst = deque.peekFirst();  // \u961f\u9996\u5143\u7d20\nint peekLast = deque.peekLast();    // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\nint popFirst = deque.pollFirst();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\nint popLast = deque.pollLast();    // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.size();\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = deque.isEmpty();\n
deque.cpp
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\ndeque<int> deque;\n/* \u5143\u7d20\u5165\u961f */\ndeque.push_back(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.push_back(5);\ndeque.push_back(4);\ndeque.push_front(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.push_front(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint front = deque.front(); // \u961f\u9996\u5143\u7d20\nint back = deque.back();   // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.pop_front();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.pop_back();   // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.size();\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty = deque.empty();\n
deque.py
\"\"\" \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 \"\"\"\ndeque: Deque[int] = collections.deque()\n\"\"\" \u5143\u7d20\u5165\u961f \"\"\"\ndeque.append(2)      # \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.append(5)\ndeque.append(4)\ndeque.appendleft(3)  # \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.appendleft(1)\n\"\"\" \u8bbf\u95ee\u5143\u7d20 \"\"\"\nfront: int = deque[0]  # \u961f\u9996\u5143\u7d20\nrear: int = deque[-1]  # \u961f\u5c3e\u5143\u7d20\n\"\"\" \u5143\u7d20\u51fa\u961f \"\"\"\npop_front: int = deque.popleft()  # \u961f\u9996\u5143\u7d20\u51fa\u961f\npop_rear: int = deque.pop()       # \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(deque)\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(deque) == 0\n
deque_test.go
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// \u5728 Go \u4e2d\uff0c\u5c06 list \u4f5c\u4e3a\u53cc\u5411\u961f\u5217\u4f7f\u7528\ndeque := list.New()\n/* \u5143\u7d20\u5165\u961f */\ndeque.PushBack(2)      // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.PushBack(5)\ndeque.PushBack(4)\ndeque.PushFront(3)     // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.PushFront(1)\n/* \u8bbf\u95ee\u5143\u7d20 */\nfront := deque.Front() // \u961f\u9996\u5143\u7d20\nrear := deque.Back()   // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.Remove(front)    // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.Remove(rear)     // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize := deque.Len()\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty := deque.Len() == 0\n
deque.js
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// JavaScript \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u7aef\u961f\u5217\uff0c\u53ea\u80fd\u628a Array \u5f53\u4f5c\u53cc\u7aef\u961f\u5217\u6765\u4f7f\u7528\nconst deque = [];\n/* \u5143\u7d20\u5165\u961f */\ndeque.push(2);\ndeque.push(5);\ndeque.push(4);\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cunshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\ndeque.unshift(3);\ndeque.unshift(1);\nconsole.log(\"\u53cc\u5411\u961f\u5217 deque = \", deque);\n/* \u8bbf\u95ee\u5143\u7d20 */\nconst peekFirst = deque[0];\nconsole.log(\"\u961f\u9996\u5143\u7d20 peekFirst = \" + peekFirst);\nconst peekLast = deque[deque.length - 1];\nconsole.log(\"\u961f\u5c3e\u5143\u7d20 peekLast = \" + peekLast);\n/* \u5143\u7d20\u51fa\u961f */\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst popFront = deque.shift();\nconsole.log(\"\u961f\u9996\u51fa\u961f\u5143\u7d20 popFront = \" + popFront + \"\uff0c\u961f\u9996\u51fa\u961f\u540e deque = \" + deque);\nconst popBack = deque.pop();\nconsole.log(\"\u961f\u5c3e\u51fa\u961f\u5143\u7d20 popBack = \" + popBack + \"\uff0c\u961f\u5c3e\u51fa\u961f\u540e deque = \" + deque);\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = deque.length;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u957f\u5ea6 size = \" + size);\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst isEmpty = size === 0;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a = \" + isEmpty);\n
deque.ts
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// TypeScript \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u7aef\u961f\u5217\uff0c\u53ea\u80fd\u628a Array \u5f53\u4f5c\u53cc\u7aef\u961f\u5217\u6765\u4f7f\u7528\nconst deque: number[] = [];\n/* \u5143\u7d20\u5165\u961f */\ndeque.push(2);\ndeque.push(5);\ndeque.push(4);\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cunshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\ndeque.unshift(3);\ndeque.unshift(1);\nconsole.log(\"\u53cc\u5411\u961f\u5217 deque = \", deque);\n/* \u8bbf\u95ee\u5143\u7d20 */\nconst peekFirst: number = deque[0];\nconsole.log(\"\u961f\u9996\u5143\u7d20 peekFirst = \" + peekFirst);\nconst peekLast: number = deque[deque.length - 1];\nconsole.log(\"\u961f\u5c3e\u5143\u7d20 peekLast = \" + peekLast);\n/* \u5143\u7d20\u51fa\u961f */\n// \u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u662f\u6570\u7ec4\uff0cshift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst popFront: number = deque.shift() as number;\nconsole.log(\"\u961f\u9996\u51fa\u961f\u5143\u7d20 popFront = \" + popFront + \"\uff0c\u961f\u9996\u51fa\u961f\u540e deque = \" + deque);\nconst popBack: number = deque.pop() as number;\nconsole.log(\"\u961f\u5c3e\u51fa\u961f\u5143\u7d20 popBack = \" + popBack + \"\uff0c\u961f\u5c3e\u51fa\u961f\u540e deque = \" + deque);\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nconst size: number = deque.length;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u957f\u5ea6 size = \" + size);\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst isEmpty: boolean = size === 0;\nconsole.log(\"\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a = \" + isEmpty);\n
deque.c
\n
deque.cs
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// \u5728 C# \u4e2d\uff0c\u5c06\u94fe\u8868 LinkedList \u770b\u4f5c\u53cc\u5411\u961f\u5217\u6765\u4f7f\u7528\nLinkedList<int> deque = new LinkedList<int>();\n/* \u5143\u7d20\u5165\u961f */\ndeque.AddLast(2);   // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.AddLast(5);\ndeque.AddLast(4);\ndeque.AddFirst(3);  // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.AddFirst(1);\n/* \u8bbf\u95ee\u5143\u7d20 */\nint peekFirst = deque.First.Value;  // \u961f\u9996\u5143\u7d20\nint peekLast = deque.Last.Value;    // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\ndeque.RemoveFirst();  // \u961f\u9996\u5143\u7d20\u51fa\u961f\ndeque.RemoveLast();   // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size = deque.Count;\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = deque.Count == 0;\n
deque.swift
/* \u521d\u59cb\u5316\u53cc\u5411\u961f\u5217 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u53cc\u5411\u961f\u5217\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u53cc\u5411\u961f\u5217\u6765\u4f7f\u7528\nvar deque: [Int] = []\n/* \u5143\u7d20\u5165\u961f */\ndeque.append(2) // \u6dfb\u52a0\u81f3\u961f\u5c3e\ndeque.append(5)\ndeque.append(4)\ndeque.insert(3, at: 0) // \u6dfb\u52a0\u81f3\u961f\u9996\ndeque.insert(1, at: 0)\n/* \u8bbf\u95ee\u5143\u7d20 */\nlet peekFirst = deque.first! // \u961f\u9996\u5143\u7d20\nlet peekLast = deque.last! // \u961f\u5c3e\u5143\u7d20\n/* \u5143\u7d20\u51fa\u961f */\n// \u4f7f\u7528 Array \u6a21\u62df\u65f6 popFirst \u7684\u590d\u6742\u5ea6\u4e3a O(n)\nlet popFirst = deque.removeFirst() // \u961f\u9996\u5143\u7d20\u51fa\u961f\nlet popLast = deque.removeLast() // \u961f\u5c3e\u5143\u7d20\u51fa\u961f\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nlet size = deque.count\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = deque.isEmpty\n
deque.zig
\n
"},{"location":"chapter_stack_and_queue/deque/#532","title":"5.3.2. \u00a0 \u53cc\u5411\u961f\u5217\u5b9e\u73b0 *","text":"

\u4e0e\u961f\u5217\u7c7b\u4f3c\uff0c\u53cc\u5411\u961f\u5217\u540c\u6837\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u6216\u6570\u7ec4\u6765\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/deque/#_1","title":"\u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u56de\u5fc6\u4e0a\u8282\u5185\u5bb9\uff0c\u7531\u4e8e\u53ef\u4ee5\u65b9\u4fbf\u5730\u5220\u9664\u94fe\u8868\u5934\u7ed3\u70b9\uff08\u5bf9\u5e94\u51fa\u961f\u64cd\u4f5c\uff09\uff0c\u4ee5\u53ca\u5728\u94fe\u8868\u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0\u65b0\u7ed3\u70b9\uff08\u5bf9\u5e94\u5165\u961f\u64cd\u4f5c\uff09\uff0c\u56e0\u6b64\u6211\u4eec\u4f7f\u7528\u666e\u901a\u5355\u5411\u94fe\u8868\u6765\u5b9e\u73b0\u961f\u5217\u3002

\u800c\u53cc\u5411\u961f\u5217\u7684\u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u53ef\u4ee5\u6267\u884c\u5165\u961f\u4e0e\u51fa\u961f\u64cd\u4f5c\uff0c\u6362\u8a00\u4e4b\uff0c\u53cc\u5411\u961f\u5217\u7684\u64cd\u4f5c\u662f\u201c\u9996\u5c3e\u5bf9\u79f0\u201d\u7684\uff0c\u4e5f\u9700\u8981\u5b9e\u73b0\u53e6\u4e00\u4e2a\u5bf9\u79f0\u65b9\u5411\u7684\u64cd\u4f5c\u3002\u56e0\u6b64\uff0c\u53cc\u5411\u961f\u5217\u9700\u8981\u4f7f\u7528\u300c\u53cc\u5411\u94fe\u8868\u300d\u6765\u5b9e\u73b0\u3002

\u6211\u4eec\u5c06\u53cc\u5411\u94fe\u8868\u7684\u5934\u7ed3\u70b9\u548c\u5c3e\u7ed3\u70b9\u5206\u522b\u770b\u4f5c\u53cc\u5411\u961f\u5217\u7684\u961f\u9996\u548c\u961f\u5c3e\uff0c\u5e76\u4e14\u5b9e\u73b0\u5728\u4e24\u7aef\u90fd\u80fd\u6dfb\u52a0\u4e0e\u5220\u9664\u7ed3\u70b9\u3002

LinkedListDequepushLast()pushFirst()popLast()popFirst()

\u4ee5\u4e0b\u662f\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_deque.java
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nint val;       // \u7ed3\u70b9\u503c\nListNode next; // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nListNode prev; // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nListNode(int val) {\nthis.val = val;\nprev = next = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate ListNode front, rear; // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear\nprivate int queSize = 0;      // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npublic LinkedListDeque() {\nfront = rear = null;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f\u64cd\u4f5c */\nprivate void push(int num, boolean isFront) {\nListNode node = new ListNode(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (isEmpty())\nfront = rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if (isFront) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront.prev = node;\nnode.next = front;\nfront = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear.next = node;\nnode.prev = rear;\nrear = node;  // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize++; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\npublic void pushFirst(int num) {\npush(num, true);\n}\n/* \u961f\u5c3e\u5165\u961f */\npublic void pushLast(int num) {\npush(num, false);\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nprivate Integer pop(boolean isFront) {\n// \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de null\nif (isEmpty())\nreturn null;\nint val;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (isFront) {\nval = front.val; // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nListNode fNext = front.next;\nif (fNext != null) {\nfNext.prev = null;\nfront.next = null;\n}\nfront = fNext;   // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = rear.val;  // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nListNode rPrev = rear.prev;\nif (rPrev != null) {\nrPrev.next = null;\nrear.prev = null;\n}\nrear = rPrev;    // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize--; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n}\n/* \u961f\u9996\u51fa\u961f */\npublic Integer popFirst() {\nreturn pop(true);\n}\n/* \u961f\u5c3e\u51fa\u961f */\npublic Integer popLast() {\nreturn pop(false);\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic Integer peekFirst() {\nreturn isEmpty() ? null : front.val;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npublic Integer peekLast() {\nreturn isEmpty() ? null : rear.val;\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\npublic int[] toArray() {\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_deque.cpp
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nstruct DoublyListNode {\nint val;               // \u7ed3\u70b9\u503c\nDoublyListNode *next;  // \u540e\u7ee7\u7ed3\u70b9\u6307\u9488\nDoublyListNode *prev;  // \u524d\u9a71\u7ed3\u70b9\u6307\u9488\nDoublyListNode(int val) : val(val), prev(nullptr), next(nullptr) {}\n};\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate:\nDoublyListNode *front, *rear; // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear\nint queSize = 0;              // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nLinkedListDeque() : front(nullptr), rear(nullptr) {}\n/* \u6790\u6784\u65b9\u6cd5 */\n~LinkedListDeque() {\n// \u91ca\u653e\u5185\u5b58\nDoublyListNode *pre, *cur = front;\nwhile (cur != nullptr) {\npre = cur;\ncur = cur->next;\ndelete pre;\n}\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f\u64cd\u4f5c */\nvoid push(int num, bool isFront) {\nDoublyListNode *node = new DoublyListNode(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (isEmpty())\nfront = rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if (isFront) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront->prev = node;\nnode->next = front;\nfront = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear->next = node;\nnode->prev = rear;\nrear = node;  // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize++; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\nvoid pushFirst(int num) {\npush(num, true);\n}\n/* \u961f\u5c3e\u5165\u961f */\nvoid pushLast(int num) {\npush(num, false);\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nint pop(bool isFront) {\n// \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de -1\nif (isEmpty())\nreturn -1;\nint val;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (isFront) {\nval = front->val; // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nDoublyListNode *fNext = front->next;\nif (fNext != nullptr) {\nfNext->prev = nullptr;\nfront->next = nullptr;\n}\nfront = fNext;   // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = rear->val; // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nDoublyListNode *rPrev = rear->prev;\nif (rPrev != nullptr) {\nrPrev->next = nullptr;\nrear->prev = nullptr;\n}\nrear = rPrev;    // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize--; // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n}\n/* \u961f\u9996\u51fa\u961f */\nint popFirst() {\nreturn pop(true);\n}\n/* \u961f\u5c3e\u51fa\u961f */\nint popLast() {\nreturn pop(false);\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peekFirst() {\nreturn isEmpty() ? -1 : front->val;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nint peekLast() {\nreturn isEmpty() ? -1 : rear->val;\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\nDoublyListNode *node = front;\nvector<int> res(size());\nfor (int i = 0; i < res.size(); i++) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_deque.py
class ListNode:\n\"\"\" \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 \"\"\"\ndef __init__(self, val: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.val: int = val\nself.next: Optional[ListNode] = None  # \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nself.prev: Optional[ListNode] = None  # \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nclass LinkedListDeque:\n\"\"\" \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 \"\"\"\ndef __init__(self) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.front: Optional[ListNode] = None # \u5934\u7ed3\u70b9 front\nself.rear: Optional[ListNode] = None  # \u5c3e\u7ed3\u70b9 rear\nself.__size: int = 0        # \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.size() == 0\ndef push(self, num: int, is_front: bool) -> None:\n\"\"\" \u5165\u961f\u64cd\u4f5c \"\"\"\nnode = ListNode(num)\n# \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif self.is_empty():\nself.front = self.rear = node\n# \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelif is_front:\n# \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nself.front.prev = node\nnode.next = self.front\nself.front = node  # \u66f4\u65b0\u5934\u7ed3\u70b9\n# \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\nelse:\n# \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nself.rear.next = node\nnode.prev = self.rear\nself.rear = node  # \u66f4\u65b0\u5c3e\u7ed3\u70b9\nself.__size += 1  # \u66f4\u65b0\u961f\u5217\u957f\u5ea6\ndef push_first(self, num: int) -> None:\n\"\"\" \u961f\u9996\u5165\u961f \"\"\"\nself.push(num, True)\ndef push_last(self, num: int) -> None:\n\"\"\" \u961f\u5c3e\u5165\u961f \"\"\"\nself.push(num, False)\ndef pop(self, is_front: bool) -> int:\n\"\"\" \u51fa\u961f\u64cd\u4f5c \"\"\"\n# \u82e5\u961f\u5217\u4e3a\u7a7a\uff0c\u76f4\u63a5\u8fd4\u56de None\nif self.is_empty():\nreturn None\n# \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif is_front:\nval: int = self.front.val  # \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n# \u5220\u9664\u5934\u7ed3\u70b9\nfnext: Optional[ListNode] = self.front.next\nif fnext != None:\nfnext.prev = None\nself.front.next = None\nself.front = fnext  # \u66f4\u65b0\u5934\u7ed3\u70b9\n# \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\nelse:\nval: int = self.rear.val  # \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n# \u5220\u9664\u5c3e\u7ed3\u70b9\nrprev: Optional[ListNode] = self.rear.prev\nif rprev != None:\nrprev.next = None\nself.rear.prev = None\nself.rear = rprev  # \u66f4\u65b0\u5c3e\u7ed3\u70b9\nself.__size -= 1  # \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val\ndef pop_first(self) -> int:\n\"\"\" \u961f\u9996\u51fa\u961f \"\"\"\nreturn self.pop(True)\ndef pop_last(self) -> int:\n\"\"\" \u961f\u5c3e\u51fa\u961f \"\"\"\nreturn self.pop(False)\ndef peek_first(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nreturn None if self.is_empty() else self.front.val\ndef peek_last(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \"\"\"\nreturn None if self.is_empty() else self.rear.val\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 \"\"\"\nnode: Optional[ListNode] = self.front\nres: List[int] = [0] * self.size()\nfor i in range(self.size()):\nres[i] = node.val\nnode = node.next\nreturn res\n
linkedlist_deque.go
/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\ntype linkedListDeque struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u53cc\u7aef\u961f\u5217 */\nfunc newLinkedListDeque() *linkedListDeque {\nreturn &linkedListDeque{\ndata: list.New(),\n}\n}\n/* \u961f\u9996\u5143\u7d20\u5165\u961f */\nfunc (s *linkedListDeque) pushFirst(value any) {\ns.data.PushFront(value)\n}\n/* \u961f\u5c3e\u5143\u7d20\u5165\u961f */\nfunc (s *linkedListDeque) pushLast(value any) {\ns.data.PushBack(value)\n}\n/* \u961f\u9996\u5143\u7d20\u51fa\u961f */\nfunc (s *linkedListDeque) popFirst() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u961f\u5c3e\u5143\u7d20\u51fa\u961f */\nfunc (s *linkedListDeque) popLast() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (s *linkedListDeque) peekFirst() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc (s *linkedListDeque) peekLast() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\nreturn e.Value\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (s *linkedListDeque) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListDeque) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListDeque) toList() *list.List {\nreturn s.data\n}\n
linkedlist_deque.js
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nprev;   // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nnext;   // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nval;    // \u7ed3\u70b9\u503c\nconstructor(val) {\nthis.val = val;\nthis.next = null;\nthis.prev = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\n#front;  // \u5934\u7ed3\u70b9 front\n#rear;   // \u5c3e\u7ed3\u70b9 rear\n#queSize;    // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nconstructor() {\nthis.#front = null;\nthis.#rear = null;\nthis.#queSize = 0;\n}\n/* \u961f\u5c3e\u5165\u961f\u64cd\u4f5c */\npushLast(val) {\nconst node = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.#queSize === 0) {\nthis.#front = node;\nthis.#rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nthis.#rear.next = node;\nnode.prev = this.#rear;\nthis.#rear = node; // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nthis.#queSize++;\n}\n/* \u961f\u9996\u5165\u961f\u64cd\u4f5c */\npushFirst(val) {\nconst node = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.#queSize === 0) {\nthis.#front = node;\nthis.#rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nthis.#front.prev = node;\nnode.next = this.#front;\nthis.#front = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\nthis.#queSize++;\n}\n/* \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c */\npopLast() {\nif (this.#queSize === 0) {\nreturn null;\n}\nconst value = this.#rear.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet temp = this.#rear.prev;\nif (temp !== null) {\ntemp.next = null;\nthis.#rear.prev = null;\n}\nthis.#rear = temp;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\nthis.#queSize--;\nreturn value;\n}\n/* \u961f\u9996\u51fa\u961f\u64cd\u4f5c */\npopFirst() {\nif (this.#queSize === 0) {\nreturn null;\n}\nconst value = this.#front.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet temp = this.#front.next;\nif (temp !== null) {\ntemp.prev = null;\nthis.#front.next = null;\n}\nthis.#front = temp;   // \u66f4\u65b0\u5934\u7ed3\u70b9\nthis.#queSize--;\nreturn value;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast() {\nreturn this.#queSize === 0 ? null : this.#rear.val;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst() {\nreturn this.#queSize === 0 ? null : this.#front.val;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.#queSize === 0;\n}\n/* \u6253\u5370\u53cc\u5411\u961f\u5217 */\nprint() {\nconst arr = [];\nlet temp = this.#front;\nwhile (temp !== null) {\narr.push(temp.val);\ntemp = temp.next;\n}\nconsole.log(\"[\" + arr.join(\", \") + \"]\");\n}\n}\n
linkedlist_deque.ts
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nprev: ListNode;     // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nnext: ListNode;     // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528 (\u6307\u9488)\nval: number;        // \u7ed3\u70b9\u503c\nconstructor(val: number) {\nthis.val = val;\nthis.next = null;\nthis.prev = null;\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate front: ListNode;    // \u5934\u7ed3\u70b9 front\nprivate rear: ListNode;     // \u5c3e\u7ed3\u70b9 rear\nprivate queSize: number;        // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nconstructor() {\nthis.front = null;\nthis.rear = null;\nthis.queSize = 0;\n}\n/* \u961f\u5c3e\u5165\u961f\u64cd\u4f5c */\npushLast(val: number): void {\nconst node: ListNode = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.queSize === 0) {\nthis.front = node;\nthis.rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nthis.rear.next = node;\nnode.prev = this.rear;\nthis.rear = node; // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nthis.queSize++;\n}\n/* \u961f\u9996\u5165\u961f\u64cd\u4f5c */\npushFirst(val: number): void {\nconst node: ListNode = new ListNode(val);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (this.queSize === 0) {\nthis.front = node;\nthis.rear = node;\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nthis.front.prev = node;\nnode.next = this.front;\nthis.front = node; // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\nthis.queSize++;\n}\n/* \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c */\npopLast(): number {\nif (this.queSize === 0) {\nreturn null;\n}\nconst value: number = this.rear.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet temp: ListNode = this.rear.prev;\nif (temp !== null) {\ntemp.next = null;\nthis.rear.prev = null;\n}\nthis.rear = temp;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\nthis.queSize--;\nreturn value;\n}\n/* \u961f\u9996\u51fa\u961f\u64cd\u4f5c */\npopFirst(): number {\nif (this.queSize === 0) {\nreturn null;\n}\nconst value: number = this.front.val; // \u5b58\u50a8\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet temp: ListNode = this.front.next;\nif (temp !== null) {\ntemp.prev = null;\nthis.front.next = null;\n}\nthis.front = temp;   // \u66f4\u65b0\u5934\u7ed3\u70b9\nthis.queSize--;\nreturn value;\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast(): number {\nreturn this.queSize === 0 ? null : this.rear.val;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst(): number {\nreturn this.queSize === 0 ? null : this.front.val;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.queSize === 0;\n}\n/* \u6253\u5370\u53cc\u5411\u961f\u5217 */\nprint(): void {\nconst arr: number[] = [];\nlet temp: ListNode = this.front;\nwhile (temp !== null) {\narr.push(temp.val);\ntemp = temp.next;\n}\nconsole.log(\"[\" + arr.join(\", \") + \"]\");\n}\n}\n
linkedlist_deque.c
[class]{ListNode}-[func]{}\n[class]{LinkedListDeque}-[func]{}\n
linkedlist_deque.cs
[class]{ListNode}-[func]{}\n[class]{LinkedListDeque}-[func]{}\n
linkedlist_deque.swift
/* \u53cc\u5411\u94fe\u8868\u7ed3\u70b9 */\nclass ListNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar next: ListNode? // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nvar prev: ListNode? // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\ninit(val: Int) {\nself.val = val\n}\n}\n/* \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass LinkedListDeque {\nprivate var front: ListNode? // \u5934\u7ed3\u70b9 front\nprivate var rear: ListNode? // \u5c3e\u7ed3\u70b9 rear\nprivate var queSize: Int // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\ninit() {\nqueSize = 0\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u961f\u64cd\u4f5c */\nprivate func push(num: Int, isFront: Bool) {\nlet node = ListNode(val: num)\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif isEmpty() {\nfront = node\nrear = node\n}\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\nelse if isFront {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nfront?.prev = node\nnode.next = front\nfront = node // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\nelse {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nrear?.next = node\nnode.prev = rear\nrear = node // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize += 1 // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n}\n/* \u961f\u9996\u5165\u961f */\nfunc pushFirst(num: Int) {\npush(num: num, isFront: true)\n}\n/* \u961f\u5c3e\u5165\u961f */\nfunc pushLast(num: Int) {\npush(num: num, isFront: false)\n}\n/* \u51fa\u961f\u64cd\u4f5c */\nprivate func pop(isFront: Bool) -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\nlet val: Int\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif isFront {\nval = front!.val // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nlet fNext = front?.next\nif fNext != nil {\nfNext?.prev = nil\nfront?.next = nil\n}\nfront = fNext // \u66f4\u65b0\u5934\u7ed3\u70b9\n}\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\nelse {\nval = rear!.val // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nlet rPrev = rear?.prev\nif rPrev != nil {\nrPrev?.next = nil\nrear?.prev = nil\n}\nrear = rPrev // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nqueSize -= 1 // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val\n}\n/* \u961f\u9996\u51fa\u961f */\nfunc popFirst() -> Int {\npop(isFront: true)\n}\n/* \u961f\u5c3e\u51fa\u961f */\nfunc popLast() -> Int {\npop(isFront: false)\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peekFirst() -> Int? {\nisEmpty() ? nil : front?.val\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc peekLast() -> Int? {\nisEmpty() ? nil : rear?.val\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nfunc toArray() -> [Int] {\nvar node = front\nvar res = Array(repeating: 0, count: size())\nfor i in res.indices {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_deque.zig
// \u53cc\u5411\u94fe\u8868\u7ed3\u70b9\nfn ListNode(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nval: T = undefined,     // \u7ed3\u70b9\u503c\nnext: ?*Self = null,    // \u540e\u7ee7\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\nprev: ?*Self = null,    // \u524d\u9a71\u7ed3\u70b9\u5f15\u7528\uff08\u6307\u9488\uff09\n// Initialize a list node with specific value\npub fn init(self: *Self, x: i32) void {\nself.val = x;\nself.next = null;\nself.prev = null;\n}\n};\n}\n// \u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217\nfn LinkedListDeque(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nfront: ?*ListNode(T) = null,                    // \u5934\u7ed3\u70b9 front\nrear: ?*ListNode(T) = null,                     // \u5c3e\u7ed3\u70b9 rear\nque_size: usize = 0,                             // \u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u961f\u5217\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.front = null;\nself.rear = null;\nself.que_size = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.que_size;\n}\n// \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u5165\u961f\u64cd\u4f5c\npub fn push(self: *Self, num: T, is_front: bool) !void {\nvar node = try self.mem_allocator.create(ListNode(T));\nnode.init(num);\n// \u82e5\u94fe\u8868\u4e3a\u7a7a\uff0c\u5219\u4ee4 front, rear \u90fd\u6307\u5411 node\nif (self.isEmpty()) {\nself.front = node;\nself.rear = node;\n// \u961f\u9996\u5165\u961f\u64cd\u4f5c\n} else if (is_front) {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5934\u90e8\nself.front.?.prev = node;\nnode.next = self.front;\nself.front = node;  // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u5165\u961f\u64cd\u4f5c\n} else {\n// \u5c06 node \u6dfb\u52a0\u81f3\u94fe\u8868\u5c3e\u90e8\nself.rear.?.next = node;\nnode.prev = self.rear;\nself.rear = node;   // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nself.que_size += 1;      // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\n} // \u961f\u9996\u5165\u961f\npub fn pushFirst(self: *Self, num: T) !void {\ntry self.push(num, true);\n} // \u961f\u5c3e\u5165\u961f\npub fn pushLast(self: *Self, num: T) !void {\ntry self.push(num, false);\n} // \u51fa\u961f\u64cd\u4f5c\npub fn pop(self: *Self, is_front: bool) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nvar val: T = undefined;\n// \u961f\u9996\u51fa\u961f\u64cd\u4f5c\nif (is_front) {\nval = self.front.?.val;     // \u6682\u5b58\u5934\u7ed3\u70b9\u503c\n// \u5220\u9664\u5934\u7ed3\u70b9\nvar fNext = self.front.?.next;\nif (fNext != null) {\nfNext.?.prev = null;\nself.front.?.next = null;\n}\nself.front = fNext;         // \u66f4\u65b0\u5934\u7ed3\u70b9\n// \u961f\u5c3e\u51fa\u961f\u64cd\u4f5c\n} else {\nval = self.rear.?.val;      // \u6682\u5b58\u5c3e\u7ed3\u70b9\u503c\n// \u5220\u9664\u5c3e\u7ed3\u70b9\nvar rPrev = self.rear.?.prev;\nif (rPrev != null) {\nrPrev.?.next = null;\nself.rear.?.prev = null;\n}\nself.rear = rPrev;          // \u66f4\u65b0\u5c3e\u7ed3\u70b9\n}\nself.que_size -= 1;              // \u66f4\u65b0\u961f\u5217\u957f\u5ea6\nreturn val;\n} // \u961f\u9996\u51fa\u961f\npub fn popFirst(self: *Self) T {\nreturn self.pop(true);\n} // \u961f\u5c3e\u51fa\u961f\npub fn popLast(self: *Self) T {\nreturn self.pop(false);\n} // \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peekFirst(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn self.front.?.val;\n}  // \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20\npub fn peekLast(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn self.rear.?.val;\n}\n// \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370\npub fn toArray(self: *Self) ![]T {\nvar node = self.front;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[i] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/deque/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u4e0e\u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u961f\u5217\u7c7b\u4f3c\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528\u73af\u5f62\u6570\u7ec4\u6765\u5b9e\u73b0\u53cc\u5411\u961f\u5217\u3002\u5728\u5b9e\u73b0\u961f\u5217\u7684\u57fa\u7840\u4e0a\uff0c\u589e\u52a0\u5b9e\u73b0\u201c\u961f\u9996\u5165\u961f\u201d\u548c\u201c\u961f\u5c3e\u51fa\u961f\u201d\u65b9\u6cd5\u5373\u53ef\u3002

ArrayDequepushLast()pushFirst()popLast()popFirst()

\u4ee5\u4e0b\u662f\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_deque.java
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\npublic ArrayDeque(int capacity) {\nthis.nums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity() {\nreturn nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn queSize == 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nprivate int index(int i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + capacity()) % capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npublic void pushFirst(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num;\nqueSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npublic void pushLast(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nint rear = index(front + queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npublic int popFirst() {\nint num = peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(front + 1);\nqueSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npublic int popLast() {\nint num = peekLast();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peekFirst() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn nums[front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npublic int peekLast() {\nif (isEmpty())\nthrow new EmptyStackException();\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nint last = index(front + queSize - 1);\nreturn nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\npublic int[] toArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[index(j)];\n}\nreturn res;\n}\n}\n
array_deque.cpp
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate:\nvector<int> nums;  // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nint front;         // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nint queSize;       // \u53cc\u5411\u961f\u5217\u957f\u5ea6\npublic:\n/* \u6784\u9020\u65b9\u6cd5 */\nArrayDeque(int capacity) {\nnums.resize(capacity);\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\nint capacity() {\nreturn nums.size();\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty() {\nreturn queSize == 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nint index(int i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + capacity()) % capacity();\n}\n/* \u961f\u9996\u5165\u961f */\nvoid pushFirst(int num) {\nif (queSize == capacity()) {\ncout << \"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num;\nqueSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\nvoid pushLast(int num) {\nif (queSize == capacity()) {\ncout << \"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nint rear = index(front + queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\nint popFirst() {\nint num = peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(front + 1);\nqueSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\nint popLast() {\nint num = peekLast();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peekFirst() {\nif (isEmpty())\nthrow out_of_range(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\nreturn nums[front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nint peekLast() {\nif (isEmpty())\nthrow out_of_range(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nint last = index(front + queSize - 1);\nreturn nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> res(queSize);\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[index(j)];\n}\nreturn res;\n}\n};\n
array_deque.py
class ArrayDeque:\n\"\"\" \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 \"\"\"\ndef __init__(self, capacity: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__nums: List[int] = [0] * capacity\nself.__front: int = 0\nself.__size: int = 0\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf \"\"\"\nreturn len(self.__nums)\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__size == 0\ndef index(self, i: int) -> int:\n\"\"\" \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 \"\"\"\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n# \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n# \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + self.capacity()) % self.capacity()\ndef push_first(self, num: int) -> None:\n\"\"\" \u961f\u9996\u5165\u961f \"\"\"\nif self.__size == self.capacity():\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n# \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nself.__front = self.index(self.__front - 1)\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nself.__nums[self.__front] = num\nself.__size += 1\ndef push_last(self, num: int) -> None:\n\"\"\" \u961f\u5c3e\u5165\u961f \"\"\"\nif self.__size == self.capacity():\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n# \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nrear = self.index(self.__front + self.__size)\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.__nums[rear] = num\nself.__size += 1\ndef pop_first(self) -> int:\n\"\"\" \u961f\u9996\u51fa\u961f \"\"\"\nnum = self.peek_first()\n# \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nself.__front = self.index(self.__front + 1)\nself.__size -= 1\nreturn num\ndef pop_last(self) -> int:\n\"\"\" \u961f\u5c3e\u51fa\u961f \"\"\"\nnum = self.peek_last()\nself.__size -= 1\nreturn num\ndef peek_first(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\"\nreturn self.__nums[self.__front]\ndef peek_last(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\"\n# \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nlast = self.index(self.__front + self.__size - 1)\nreturn self.__nums[last]\ndef to_array(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 \"\"\"\n# \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nres = []\nfor i in range(self.__size):\nres.append(self.__nums[self.index(self.__front + i)])\nreturn res\n
array_deque.go
[class]{ArrayDeque}-[func]{}\n
array_deque.js
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\n#nums;       // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\n#front;      // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\n#queSize;    // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(capacity) {\nthis.#nums = new Array(capacity);\nthis.#front = 0;\nthis.#queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\ncapacity() {\nreturn this.#nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.#queSize === 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nindex(i) {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + this.capacity()) % this.capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npushFirst(num) {\nif (this.#queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nthis.#front = this.index(this.#front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nthis.#nums[this.#front] = num;\nthis.#queSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npushLast(num) {\nif (this.#queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nconst rear = this.index(this.#front + this.#queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.#nums[rear] = num;\nthis.#queSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npopFirst() {\nconst num = this.peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nthis.#front = this.index(this.#front + 1);\nthis.#queSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npopLast() {\nconst num = this.peekLast();\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst() {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\nreturn this.#nums[this.#front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast() {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nconst last = this.index(this.#front + this.#queSize - 1);\nreturn this.#nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\ntoArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst res = [];\nfor (let i = 0, j = this.#front; i < this.#queSize; i++, j++) {\nres[i] = this.#nums[this.index(j)];\n}\nreturn res;\n}\n}\n
array_deque.ts
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate nums: number[];     // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate front: number;      // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate queSize: number;    // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\nconstructor(capacity: number) {\nthis.nums = new Array(capacity);\nthis.front = 0;\nthis.queSize = 0;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\ncapacity(): number {\nreturn this.nums.length;\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nsize(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.queSize === 0;\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nindex(i: number): number {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\nreturn (i + this.capacity()) % this.capacity();\n}\n/* \u961f\u9996\u5165\u961f */\npushFirst(num: number): void {\nif (this.queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nthis.front = this.index(this.front - 1);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nthis.nums[this.front] = num;\nthis.queSize++;\n}\n/* \u961f\u5c3e\u5165\u961f */\npushLast(num: number): void {\nif (this.queSize === this.capacity()) {\nconsole.log(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nconst rear: number = this.index(this.front + this.queSize);\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.nums[rear] = num;\nthis.queSize++;\n}\n/* \u961f\u9996\u51fa\u961f */\npopFirst(): number {\nconst num: number = this.peekFirst();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nthis.front = this.index(this.front + 1);\nthis.queSize--;\nreturn num;\n}\n/* \u961f\u5c3e\u51fa\u961f */\npopLast(): number {\nconst num: number = this.peekLast();\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeekFirst(): number {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\nreturn this.nums[this.front];\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\npeekLast(): number {\nif (this.isEmpty())\nthrow new Error(\"The Deque Is Empty.\");\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nconst last = this.index(this.front + this.queSize - 1);\nreturn this.nums[last];\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\ntoArray(): number[] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst res: number[] = [];\nfor (let i = 0, j = this.front; i < this.queSize; i++, j++) {\nres[i] = this.nums[this.index(j)];\n}\nreturn res;\n}\n}\n
array_deque.c
[class]{ArrayDeque}-[func]{}\n
array_deque.cs
[class]{ArrayDeque}-[func]{}\n
array_deque.swift
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u53cc\u5411\u961f\u5217 */\nclass ArrayDeque {\nprivate var nums: [Int] // \u7528\u4e8e\u5b58\u50a8\u53cc\u5411\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate var front: Int // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate var queSize: Int // \u53cc\u5411\u961f\u5217\u957f\u5ea6\n/* \u6784\u9020\u65b9\u6cd5 */\ninit(capacity: Int) {\nnums = Array(repeating: 0, count: capacity)\nfront = 0\nqueSize = 0\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u5bb9\u91cf */\nfunc capacity() -> Int {\nnums.count\n}\n/* \u83b7\u53d6\u53cc\u5411\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u53cc\u5411\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u8ba1\u7b97\u73af\u5f62\u6570\u7ec4\u7d22\u5f15 */\nprivate func index(i: Int) -> Int {\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\u5b9e\u73b0\u6570\u7ec4\u9996\u5c3e\u76f8\u8fde\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u56de\u5230\u5934\u90e8\n// \u5f53 i \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\uff0c\u56de\u5230\u5c3e\u90e8\n(i + capacity()) % capacity()\n}\n/* \u961f\u9996\u5165\u961f */\nfunc pushFirst(num: Int) {\nif size() == capacity() {\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u961f\u9996\u6307\u9488\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 front \u8d8a\u8fc7\u6570\u7ec4\u5934\u90e8\u540e\u56de\u5230\u5c3e\u90e8\nfront = index(i: front - 1)\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u9996\nnums[front] = num\nqueSize += 1\n}\n/* \u961f\u5c3e\u5165\u961f */\nfunc pushLast(num: Int) {\nif size() == capacity() {\nprint(\"\u53cc\u5411\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\nlet rear = index(i: front + size())\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num\nqueSize += 1\n}\n/* \u961f\u9996\u51fa\u961f */\nfunc popFirst() -> Int {\nlet num = peekFirst()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\nfront = index(i: front + 1)\nqueSize -= 1\nreturn num\n}\n/* \u961f\u5c3e\u51fa\u961f */\nfunc popLast() -> Int {\nlet num = peekLast()\nqueSize -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peekFirst() -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn nums[front]\n}\n/* \u8bbf\u95ee\u961f\u5c3e\u5143\u7d20 */\nfunc peekLast() -> Int {\nif isEmpty() {\nfatalError(\"\u53cc\u5411\u961f\u5217\u4e3a\u7a7a\")\n}\n// \u8ba1\u7b97\u5c3e\u5143\u7d20\u7d22\u5f15\nlet last = index(i: front + size() - 1)\nreturn nums[last]\n}\n/* \u8fd4\u56de\u6570\u7ec4\u7528\u4e8e\u6253\u5370 */\nfunc toArray() -> [Int] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = Array(repeating: 0, count: size())\nfor (i, j) in sequence(first: (0, front), next: { $0 < self.size() - 1 ? ($0 + 1, $1 + 1) : nil }) {\nres[i] = nums[index(i: j)]\n}\nreturn res\n}\n}\n
array_deque.zig
[class]{ArrayDeque}-[func]{}\n
"},{"location":"chapter_stack_and_queue/deque/#533","title":"5.3.3. \u00a0 \u53cc\u5411\u961f\u5217\u5e94\u7528","text":"

\u53cc\u5411\u961f\u5217\u540c\u65f6\u8868\u73b0\u51fa\u6808\u4e0e\u961f\u5217\u7684\u903b\u8f91\uff0c\u56e0\u6b64\u53ef\u4ee5\u5b9e\u73b0\u4e24\u8005\u7684\u6240\u6709\u5e94\u7528\uff0c\u5e76\u4e14\u63d0\u4f9b\u66f4\u9ad8\u7684\u81ea\u7531\u5ea6\u3002

\u6211\u4eec\u77e5\u9053\uff0c\u8f6f\u4ef6\u7684\u201c\u64a4\u9500\u201d\u529f\u80fd\u9700\u8981\u4f7f\u7528\u6808\u6765\u5b9e\u73b0\uff1b\u7cfb\u7edf\u628a\u6bcf\u4e00\u6b21\u66f4\u6539\u64cd\u4f5c push \u5230\u6808\u4e2d\uff0c\u7136\u540e\u901a\u8fc7 pop \u5b9e\u73b0\u64a4\u9500\u3002\u7136\u800c\uff0c\u8003\u8651\u5230\u7cfb\u7edf\u8d44\u6e90\u6709\u9650\uff0c\u8f6f\u4ef6\u4e00\u822c\u4f1a\u9650\u5236\u64a4\u9500\u7684\u6b65\u6570\uff08\u4f8b\u5982\u4ec5\u5141\u8bb8\u4fdd\u5b58 \\(50\\) \u6b65\uff09\uff0c\u90a3\u4e48\u5f53\u6808\u7684\u957f\u5ea6 \\(> 50\\) \u65f6\uff0c\u8f6f\u4ef6\u5c31\u9700\u8981\u5728\u6808\u5e95\uff08\u5373\u961f\u9996\uff09\u6267\u884c\u5220\u9664\uff0c\u4f46\u6808\u65e0\u6cd5\u5b9e\u73b0\uff0c\u6b64\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u53cc\u5411\u961f\u5217\u6765\u66ff\u4ee3\u6808\u3002\u6ce8\u610f\uff0c\u201c\u64a4\u9500\u201d\u7684\u6838\u5fc3\u903b\u8f91\u4ecd\u7136\u662f\u6808\u7684\u5148\u5165\u540e\u51fa\uff0c\u53ea\u662f\u53cc\u5411\u961f\u5217\u53ef\u4ee5\u66f4\u52a0\u7075\u6d3b\u5730\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/","title":"5.2. \u00a0 \u961f\u5217","text":"

\u300c\u961f\u5217 Queue\u300d\u662f\u4e00\u79cd\u9075\u5faa\u300c\u5148\u5165\u5148\u51fa first in, first out\u300d\u6570\u636e\u64cd\u4f5c\u89c4\u5219\u7684\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002\u987e\u540d\u601d\u4e49\uff0c\u961f\u5217\u6a21\u62df\u7684\u662f\u6392\u961f\u73b0\u8c61\uff0c\u5373\u5916\u9762\u7684\u4eba\u4e0d\u65ad\u52a0\u5165\u961f\u5217\u5c3e\u90e8\uff0c\u800c\u5904\u4e8e\u961f\u5217\u5934\u90e8\u7684\u4eba\u4e0d\u65ad\u5730\u79bb\u5f00\u3002

\u6211\u4eec\u5c06\u961f\u5217\u5934\u90e8\u79f0\u4e3a\u300c\u961f\u9996\u300d\uff0c\u961f\u5217\u5c3e\u90e8\u79f0\u4e3a\u300c\u961f\u5c3e\u300d\uff0c\u5c06\u628a\u5143\u7d20\u52a0\u5165\u961f\u5c3e\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u5165\u961f\u300d\uff0c\u5220\u9664\u961f\u9996\u5143\u7d20\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u51fa\u961f\u300d\u3002

Fig. \u961f\u5217\u7684\u5148\u5165\u5148\u51fa\u89c4\u5219

"},{"location":"chapter_stack_and_queue/queue/#521","title":"5.2.1. \u00a0 \u961f\u5217\u5e38\u7528\u64cd\u4f5c","text":"

\u961f\u5217\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\u3002\u9700\u8981\u6ce8\u610f\uff0c\u4e0d\u540c\u7f16\u7a0b\u8bed\u8a00\u7684\u65b9\u6cd5\u540d\u662f\u4e0d\u540c\u7684\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u91c7\u7528\u4e0e\u6808\u76f8\u540c\u7684\u65b9\u6cd5\u547d\u540d\u3002

\u65b9\u6cd5\u540d \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 push() \u5143\u7d20\u5165\u961f\uff0c\u5373\u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u961f\u5c3e \\(O(1)\\) pop() \u961f\u9996\u5143\u7d20\u51fa\u961f \\(O(1)\\) peek() \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u961f\u5217\u7c7b\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig queue.java
/* \u521d\u59cb\u5316\u961f\u5217 */\nQueue<Integer> queue = new LinkedList<>();\n/* \u5143\u7d20\u5165\u961f */\nqueue.offer(1);\nqueue.offer(3);\nqueue.offer(2);\nqueue.offer(5);\nqueue.offer(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek = queue.peek();\n/* \u5143\u7d20\u51fa\u961f */\nint pop = queue.poll();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.size();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = queue.isEmpty();\n
queue.cpp
/* \u521d\u59cb\u5316\u961f\u5217 */\nqueue<int> queue;\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint front = queue.front();\n/* \u5143\u7d20\u51fa\u961f */\nqueue.pop();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.size();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty = queue.empty();\n
queue.py
\"\"\" \u521d\u59cb\u5316\u961f\u5217 \"\"\"\n# \u5728 Python \u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u5c06\u53cc\u5411\u961f\u5217\u7c7b deque \u770b\u4f5c\u961f\u5217\u4f7f\u7528\n# \u867d\u7136 queue.Queue() \u662f\u7eaf\u6b63\u7684\u961f\u5217\u7c7b\uff0c\u4f46\u4e0d\u592a\u597d\u7528\uff0c\u56e0\u6b64\u4e0d\u5efa\u8bae\nque: Deque[int] = collections.deque()\n\"\"\" \u5143\u7d20\u5165\u961f \"\"\"\nque.append(1)\nque.append(3)\nque.append(2)\nque.append(5)\nque.append(4)\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nfront: int = que[0];\n\"\"\" \u5143\u7d20\u51fa\u961f \"\"\"\npop: int = que.popleft()\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(que)\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(que) == 0\n
queue_test.go
/* \u521d\u59cb\u5316\u961f\u5217 */\n// \u5728 Go \u4e2d\uff0c\u5c06 list \u4f5c\u4e3a\u961f\u5217\u6765\u4f7f\u7528\nqueue := list.New()\n/* \u5143\u7d20\u5165\u961f */\nqueue.PushBack(1)\nqueue.PushBack(3)\nqueue.PushBack(2)\nqueue.PushBack(5)\nqueue.PushBack(4)\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek := queue.Front()\n/* \u5143\u7d20\u51fa\u961f */\npop := queue.Front()\nqueue.Remove(pop)\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nsize := queue.Len()\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty := queue.Len() == 0\n
queue.js
/* \u521d\u59cb\u5316\u961f\u5217 */\n// JavaScript \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528\nconst queue = [];\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nconst peek = queue[0];\n/* \u5143\u7d20\u51fa\u961f */\n// \u5e95\u5c42\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 shift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst pop = queue.shift();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = queue.length;\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst empty = queue.length === 0;\n
queue.ts
/* \u521d\u59cb\u5316\u961f\u5217 */\n// TypeScript \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528 \nconst queue: number[] = [];\n/* \u5143\u7d20\u5165\u961f */\nqueue.push(1);\nqueue.push(3);\nqueue.push(2);\nqueue.push(5);\nqueue.push(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nconst peek = queue[0];\n/* \u5143\u7d20\u51fa\u961f */\n// \u5e95\u5c42\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 shift() \u65b9\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(n)\nconst pop = queue.shift();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nconst size = queue.length;\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nconst empty = queue.length === 0;\n
queue.c
\n
queue.cs
/* \u521d\u59cb\u5316\u961f\u5217 */\nQueue<int> queue = new();\n/* \u5143\u7d20\u5165\u961f */\nqueue.Enqueue(1);\nqueue.Enqueue(3);\nqueue.Enqueue(2);\nqueue.Enqueue(5);\nqueue.Enqueue(4);\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek = queue.Peek();\n/* \u5143\u7d20\u51fa\u961f */\nint pop = queue.Dequeue();\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size = queue.Count();\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = queue.Count() == 0;\n
queue.swift
/* \u521d\u59cb\u5316\u961f\u5217 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u961f\u5217\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u961f\u5217\u6765\u4f7f\u7528\nvar queue: [Int] = []\n/* \u5143\u7d20\u5165\u961f */\nqueue.append(1)\nqueue.append(3)\nqueue.append(2)\nqueue.append(5)\nqueue.append(4)\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nlet peek = queue.first!\n/* \u5143\u7d20\u51fa\u961f */\n// \u7531\u4e8e\u662f\u6570\u7ec4\uff0c\u56e0\u6b64 removeFirst \u7684\u590d\u6742\u5ea6\u4e3a O(n)\nlet pool = queue.removeFirst()\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nlet size = queue.count\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = queue.isEmpty\n
queue.zig
\n
"},{"location":"chapter_stack_and_queue/queue/#522","title":"5.2.2. \u00a0 \u961f\u5217\u5b9e\u73b0","text":"

\u961f\u5217\u9700\u8981\u4e00\u79cd\u53ef\u4ee5\u5728\u4e00\u7aef\u6dfb\u52a0\uff0c\u5e76\u5728\u53e6\u4e00\u7aef\u5220\u9664\u7684\u6570\u636e\u7ed3\u6784\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u94fe\u8868\u6216\u6570\u7ec4\u6765\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/#_1","title":"\u57fa\u4e8e\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u6211\u4eec\u5c06\u94fe\u8868\u7684\u300c\u5934\u7ed3\u70b9\u300d\u548c\u300c\u5c3e\u7ed3\u70b9\u300d\u5206\u522b\u770b\u4f5c\u662f\u961f\u9996\u548c\u961f\u5c3e\uff0c\u5e76\u89c4\u5b9a\u961f\u5c3e\u53ea\u53ef\u6dfb\u52a0\u7ed3\u70b9\uff0c\u961f\u9996\u53ea\u53ef\u5220\u9664\u7ed3\u70b9\u3002

LinkedListQueuepush()pop()

\u4ee5\u4e0b\u662f\u4f7f\u7528\u94fe\u8868\u5b9e\u73b0\u961f\u5217\u7684\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_queue.java
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate ListNode front, rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nprivate int queSize = 0;\npublic LinkedListQueue() {\nfront = null;\nrear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u961f */\npublic void push(int num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == null) {\nfront = node;\nrear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nrear.next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop() {\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front.next;\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek() {\nif (size() == 0)\nthrow new EmptyStackException();\nreturn front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray() {\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.cpp
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate:\nListNode *front, *rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nint queSize;\npublic:\nLinkedListQueue() {\nfront = nullptr;\nrear = nullptr;\nqueSize = 0;\n}\n~LinkedListQueue() {\ndelete front;\ndelete rear;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn queSize == 0;\n}\n/* \u5165\u961f */\nvoid push(int num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode* node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == nullptr) {\nfront = node;\nrear = node;\n}\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse {\nrear->next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\nvoid pop() {\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nListNode *tmp = front;\nfront = front->next;\n// \u91ca\u653e\u5185\u5b58\ndelete tmp; queSize--;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek() {\nif (size() == 0)\nthrow out_of_range(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn front->val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Vector \u5e76\u8fd4\u56de */\nvector<int> toVector() {\nListNode* node = front;\nvector<int> res(size());\nfor (int i = 0; i < res.size(); i++) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_queue.py
class LinkedListQueue:\n\"\"\" \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__front: Optional[ListNode] = None  # \u5934\u7ed3\u70b9 front\nself.__rear: Optional[ListNode] = None   # \u5c3e\u7ed3\u70b9 rear\nself.__size: int = 0\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn not self.__front\ndef push(self, num: int) -> None:\n\"\"\" \u5165\u961f \"\"\"\n# \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nnode = ListNode(num)\n# \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif self.__front is None:\nself.__front = node\nself.__rear = node\n# \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse:\nself.__rear.next = node\nself.__rear = node\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u961f \"\"\"\nnum = self.peek()\n# \u5220\u9664\u5934\u7ed3\u70b9\nself.__front = self.__front.next\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nif self.size() == 0:\nprint(\"\u961f\u5217\u4e3a\u7a7a\")\nreturn False\nreturn self.__front.val\ndef to_list(self) -> List[int]:\n\"\"\" \u8f6c\u5316\u4e3a\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nqueue = []\ntemp = self.__front\nwhile temp:\nqueue.append(temp.val)\ntemp = temp.next\nreturn queue\n
linkedlist_queue.go
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\ntype linkedListQueue struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list \u6765\u5b9e\u73b0\u961f\u5217\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u961f\u5217 */\nfunc newLinkedListQueue() *linkedListQueue {\nreturn &linkedListQueue{\ndata: list.New(),\n}\n}\n/* \u5165\u961f */\nfunc (s *linkedListQueue) push(value any) {\ns.data.PushBack(value)\n}\n/* \u51fa\u961f */\nfunc (s *linkedListQueue) pop() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (s *linkedListQueue) peek() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Front()\nreturn e.Value\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (s *linkedListQueue) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListQueue) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListQueue) toList() *list.List {\nreturn s.data\n}\n
linkedlist_queue.js
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\n#front;  // \u5934\u7ed3\u70b9 #front\n#rear;   // \u5c3e\u7ed3\u70b9 #rear\n#queSize = 0;\nconstructor() {\nthis.#front = null;\nthis.#rear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.size === 0;\n}\n/* \u5165\u961f */\npush(num) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nconst node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (!this.#front) {\nthis.#front = node;\nthis.#rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nthis.#rear.next = node;\nthis.#rear = node;\n}\nthis.#queSize++;\n}\n/* \u51fa\u961f */\npop() {\nconst num = this.peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nthis.#front = this.#front.next;\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek() {\nif (this.size === 0)\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.#front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray() {\nlet node = this.#front;\nconst res = new Array(this.size);\nfor (let i = 0; i < res.length; i++) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.ts
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate front: ListNode | null; // \u5934\u7ed3\u70b9 front\nprivate rear: ListNode | null; // \u5c3e\u7ed3\u70b9 rear\nprivate queSize: number = 0;\nconstructor() {\nthis.front = null;\nthis.rear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.size === 0;\n}\n/* \u5165\u961f */\npush(num: number): void {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nconst node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (!this.front) {\nthis.front = node;\nthis.rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nthis.rear!.next = node;\nthis.rear = node;\n}\nthis.queSize++;\n}\n/* \u51fa\u961f */\npop(): number {\nconst num = this.peek();\nif (!this.front) throw new Error('\u961f\u5217\u4e3a\u7a7a');\n// \u5220\u9664\u5934\u7ed3\u70b9\nthis.front = this.front.next;\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek(): number {\nif (this.size === 0) throw new Error('\u961f\u5217\u4e3a\u7a7a');\nreturn this.front!.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray(): number[] {\nlet node = this.front;\nconst res = new Array<number>(this.size);\nfor (let i = 0; i < res.length; i++) {\nres[i] = node!.val;\nnode = node!.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.c
[class]{linkedListQueue}-[func]{}\n
linkedlist_queue.cs
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue\n{\nprivate ListNode? front, rear;  // \u5934\u7ed3\u70b9 front \uff0c\u5c3e\u7ed3\u70b9 rear \nprivate int queSize = 0;\npublic LinkedListQueue()\n{\nfront = null;\nrear = null;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u961f */\npublic void push(int num)\n{\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nListNode node = new ListNode(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (front == null)\n{\nfront = node;\nrear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n}\nelse if (rear != null)\n{\nrear.next = node;\nrear = node;\n}\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop()\n{\nint num = peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front?.next;\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek()\n{\nif (size() == 0 || front == null)\nthrow new Exception();\nreturn front.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nif (front == null)\nreturn Array.Empty<int>();\nListNode node = front;\nint[] res = new int[size()];\nfor (int i = 0; i < res.Length; i++)\n{\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_queue.swift
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217 */\nclass LinkedListQueue {\nprivate var front: ListNode? // \u5934\u7ed3\u70b9\nprivate var rear: ListNode? // \u5c3e\u7ed3\u70b9\nprivate var _size = 0\ninit() {}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\n_size\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u961f */\nfunc push(num: Int) {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nlet node = ListNode(x: num)\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif front == nil {\nfront = node\nrear = node\n}\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\nelse {\nrear?.next = node\nrear = node\n}\n_size += 1\n}\n/* \u51fa\u961f */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n// \u5220\u9664\u5934\u7ed3\u70b9\nfront = front?.next\n_size -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn front!.val\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nvar node = front\nvar res = Array(repeating: 0, count: size())\nfor i in res.indices {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_queue.zig
// \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u961f\u5217\nfn LinkedListQueue(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nfront: ?*inc.ListNode(T) = null,                // \u5934\u7ed3\u70b9 front\nrear: ?*inc.ListNode(T) = null,                 // \u5c3e\u7ed3\u70b9 rear\nque_size: usize = 0,                             // \u961f\u5217\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u961f\u5217\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.front = null;\nself.rear = null;\nself.que_size = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.que_size;\n}\n// \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.size() == 0) @panic(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn self.front.?.val;\n}  // \u5165\u961f\npub fn push(self: *Self, num: T) !void {\n// \u5c3e\u7ed3\u70b9\u540e\u6dfb\u52a0 num\nvar node = try self.mem_allocator.create(inc.ListNode(T));\nnode.init(num);\n// \u5982\u679c\u961f\u5217\u4e3a\u7a7a\uff0c\u5219\u4ee4\u5934\u3001\u5c3e\u7ed3\u70b9\u90fd\u6307\u5411\u8be5\u7ed3\u70b9\nif (self.front == null) {\nself.front = node;\nself.rear = node;\n// \u5982\u679c\u961f\u5217\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06\u8be5\u7ed3\u70b9\u6dfb\u52a0\u5230\u5c3e\u7ed3\u70b9\u540e\n} else {\nself.rear.?.next = node;\nself.rear = node;\n}\nself.que_size += 1;\n} // \u51fa\u961f\npub fn pop(self: *Self) T {\nvar num = self.peek();\n// \u5220\u9664\u5934\u7ed3\u70b9\nself.front = self.front.?.next;\nself.que_size -= 1;\nreturn num;\n} // \u5c06\u94fe\u8868\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\nvar node = self.front;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[i] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/queue/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u6570\u7ec4\u7684\u5220\u9664\u9996\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \uff0c\u8fd9\u4f1a\u5bfc\u81f4\u51fa\u961f\u64cd\u4f5c\u6548\u7387\u4f4e\u4e0b\u3002\u7136\u800c\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u53d6\u4e0b\u8ff0\u7684\u5de7\u5999\u65b9\u6cd5\u6765\u907f\u514d\u8fd9\u4e2a\u95ee\u9898\u3002

\u8003\u8651\u501f\u52a9\u4e00\u4e2a\u53d8\u91cf front \u6765\u6307\u5411\u961f\u9996\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u5e76\u7ef4\u62a4\u53d8\u91cf queSize \u6765\u8bb0\u5f55\u961f\u5217\u957f\u5ea6\u3002\u6211\u4eec\u5b9a\u4e49 rear = front + queSize \uff0c\u8be5\u516c\u5f0f\u8ba1\u7b97\u51fa\u6765\u7684 rear \u6307\u5411\u201c\u961f\u5c3e\u5143\u7d20\u7d22\u5f15 \\(+1\\) \u201d\u7684\u4f4d\u7f6e\u3002

\u5728\u8be5\u8bbe\u8ba1\u4e0b\uff0c\u6570\u7ec4\u4e2d\u5305\u542b\u5143\u7d20\u7684\u6709\u6548\u533a\u95f4\u4e3a [front, rear - 1] \uff0c\u8fdb\u800c

  • \u5bf9\u4e8e\u5165\u961f\u64cd\u4f5c\uff0c\u5c06\u8f93\u5165\u5143\u7d20\u8d4b\u503c\u7ed9 rear \u7d22\u5f15\u5904\uff0c\u5e76\u5c06 queSize \u81ea\u589e \\(1\\) \u5373\u53ef\uff1b
  • \u5bf9\u4e8e\u51fa\u961f\u64cd\u4f5c\uff0c\u4ec5\u9700\u5c06 front \u81ea\u589e \\(1\\) \uff0c\u5e76\u5c06 queSize \u81ea\u51cf \\(1\\) \u5373\u53ef\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u5165\u961f\u4e0e\u51fa\u961f\u64cd\u4f5c\u90fd\u4ec5\u9700\u5355\u6b21\u64cd\u4f5c\u5373\u53ef\u5b8c\u6210\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(1)\\) \u3002

ArrayQueuepush()pop()

\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u80fd\u4f1a\u53d1\u73b0\u4e00\u4e2a\u95ee\u9898\uff1a\u5728\u4e0d\u65ad\u5165\u961f\u4e0e\u51fa\u961f\u7684\u8fc7\u7a0b\u4e2d\uff0cfront \u548c rear \u90fd\u5728\u5411\u53f3\u79fb\u52a8\uff0c\u5728\u5230\u8fbe\u6570\u7ec4\u5c3e\u90e8\u540e\u5c31\u65e0\u6cd5\u7ee7\u7eed\u79fb\u52a8\u4e86\u3002\u4e3a\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u6211\u4eec\u8003\u8651\u5c06\u6570\u7ec4\u770b\u4f5c\u662f\u9996\u5c3e\u76f8\u63a5\u7684\uff0c\u8fd9\u6837\u7684\u6570\u7ec4\u88ab\u79f0\u4e3a\u300c\u73af\u5f62\u6570\u7ec4\u300d\u3002

\u5bf9\u4e8e\u73af\u5f62\u6570\u7ec4\uff0c\u6211\u4eec\u9700\u8981\u4ee4 front \u6216 rear \u5728\u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\uff0c\u76f4\u63a5\u7ed5\u56de\u5230\u6570\u7ec4\u5934\u90e8\u63a5\u7eed\u904d\u5386\u3002\u8fd9\u79cd\u5468\u671f\u6027\u89c4\u5f8b\u53ef\u4ee5\u901a\u8fc7\u300c\u53d6\u4f59\u64cd\u4f5c\u300d\u6765\u5b9e\u73b0\uff0c\u8be6\u60c5\u8bf7\u89c1\u4ee5\u4e0b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_queue.java
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u961f\u5217\u957f\u5ea6\npublic ArrayQueue(int capacity) {\nnums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity() {\nreturn nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn queSize == 0;\n}\n/* \u5165\u961f */\npublic void push(int num) {\nif (queSize == capacity()) {\nSystem.out.println(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop() {\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn nums[front];\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\npublic int[] toArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++) {\nres[i] = nums[j % capacity()];\n}\nreturn res;\n}\n}\n
array_queue.cpp
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate:\nint *nums;       // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nint front;       // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nint queSize;     // \u961f\u5217\u957f\u5ea6\nint queCapacity; // \u961f\u5217\u5bb9\u91cf\npublic:\nArrayQueue(int capacity) {\n// \u521d\u59cb\u5316\u6570\u7ec4\nnums = new int[capacity];\nqueCapacity = capacity;\nfront = queSize = 0;\n}\n~ArrayQueue() {\ndelete[] nums;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nint capacity() {\nreturn queCapacity;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nint size() {\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn size() == 0;\n}\n/* \u5165\u961f */\nvoid push(int num) {\nif (queSize == queCapacity) {\ncout << \"\u961f\u5217\u5df2\u6ee1\" << endl;\nreturn;\n}\n// \u8ba1\u7b97\u961f\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % queCapacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\nvoid pop() {\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % queCapacity;\nqueSize--;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nint peek() {\nif (empty())\nthrow out_of_range(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn nums[front];\n}\n/* \u5c06\u6570\u7ec4\u8f6c\u5316\u4e3a Vector \u5e76\u8fd4\u56de */\nvector<int> toVector() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvector<int> arr(queSize);\nfor (int i = 0, j = front; i < queSize; i++, j++) {\narr[i] = nums[j % queCapacity];\n}\nreturn arr;\n}\n};\n
array_queue.py
class ArrayQueue:\n\"\"\" \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 \"\"\"\ndef __init__(self, size: int) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__nums: List[int] = [0] * size  # \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nself.__front: int = 0          # \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nself.__size: int = 0           # \u961f\u5217\u957f\u5ea6\ndef capacity(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf \"\"\"\nreturn len(self.__nums)\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__size == 0\ndef push(self, num: int) -> None:\n\"\"\" \u5165\u961f \"\"\"\nassert self.__size < self.capacity(), \"\u961f\u5217\u5df2\u6ee1\"\n# \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n# \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nrear: int = (self.__front + self.__size) % self.capacity()\n# \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.__nums[rear] = num\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u961f \"\"\"\nnum: int = self.peek()\n# \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nself.__front = (self.__front + 1) % self.capacity()\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u961f\u9996\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u961f\u5217\u4e3a\u7a7a\"\nreturn self.__nums[self.__front]\ndef to_list(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nres: List[int] = [0] * self.size()\nj: int = self.__front\nfor i in range(self.size()):\nres[i] = self.__nums[(j % self.capacity())]\nj += 1\nreturn res\n
array_queue.go
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\ntype arrayQueue struct {\nnums        []int // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nfront       int   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nqueSize     int   // \u961f\u5217\u957f\u5ea6\nqueCapacity int   // \u961f\u5217\u5bb9\u91cf\uff08\u5373\u6700\u5927\u5bb9\u7eb3\u5143\u7d20\u6570\u91cf\uff09\n}\n/* \u521d\u59cb\u5316\u961f\u5217 */\nfunc newArrayQueue(queCapacity int) *arrayQueue {\nreturn &arrayQueue{\nnums:        make([]int, queCapacity),\nqueCapacity: queCapacity,\nfront:       0,\nqueSize:     0,\n}\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc (q *arrayQueue) size() int {\nreturn q.queSize\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc (q *arrayQueue) isEmpty() bool {\nreturn q.queSize == 0\n}\n/* \u5165\u961f */\nfunc (q *arrayQueue) push(num int) {\n// \u5f53 rear == queCapacity \u8868\u793a\u961f\u5217\u5df2\u6ee1\nif q.queSize == q.queCapacity {\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nrear := (q.front + q.queSize) % q.queCapacity\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nq.nums[rear] = num\nq.queSize++\n}\n/* \u51fa\u961f */\nfunc (q *arrayQueue) pop() any {\nnum := q.peek()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nq.front = (q.front + 1) % q.queCapacity\nq.queSize--\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc (q *arrayQueue) peek() any {\nif q.isEmpty() {\nreturn nil\n}\nreturn q.nums[q.front]\n}\n/* \u83b7\u53d6 Slice \u7528\u4e8e\u6253\u5370 */\nfunc (q *arrayQueue) toSlice() []int {\nrear := (q.front + q.queSize)\nif rear >= q.queCapacity {\nrear %= q.queCapacity\nreturn append(q.nums[q.front:], q.nums[:rear]...)\n}\nreturn q.nums[q.front:rear]\n}\n
array_queue.js
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\n#nums;         // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\n#front = 0;    // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\n#queSize = 0;  // \u961f\u5217\u957f\u5ea6\nconstructor(capacity) {\nthis.#nums = new Array(capacity);\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nget capacity() {\nreturn this.#nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nempty() {\nreturn this.#queSize == 0;\n}\n/* \u5165\u961f */\npush(num) {\nif (this.size == this.capacity) {\nconsole.log(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nconst rear = (this.#front + this.size) % this.capacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.#nums[rear] = num;\nthis.#queSize++;\n}\n/* \u51fa\u961f */\npop() {\nconst num = this.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nthis.#front = (this.#front + 1) % this.capacity;\nthis.#queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek() {\nif (this.empty())\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.#nums[this.#front];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst arr = new Array(this.size);\nfor (let i = 0, j = this.#front; i < this.size; i++, j++) {\narr[i] = this.#nums[j % this.capacity];\n}\nreturn arr;\n}\n}\n
array_queue.ts
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate nums: number[];  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate front: number;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate queSize: number; // \u961f\u5217\u957f\u5ea6\nconstructor(capacity: number) {\nthis.nums = new Array(capacity);\nthis.front = this.queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nget capacity(): number {\nreturn this.nums.length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nempty(): boolean {\nreturn this.queSize == 0;\n}\n/* \u5165\u961f */\npush(num: number): void {\nif (this.size == this.capacity) {\nconsole.log(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nconst rear = (this.front + this.queSize) % this.capacity;\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nthis.nums[rear] = num;\nthis.queSize++;\n}\n/* \u51fa\u961f */\npop(): number {\nconst num = this.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nthis.front = (this.front + 1) % this.capacity;\nthis.queSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npeek(): number {\nif (this.empty())\nthrow new Error(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn this.nums[this.front];\n}\n/* \u8fd4\u56de Array */\ntoArray(): number[] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nconst arr = new Array(this.size);\nfor (let i = 0, j = this.front; i < this.size; i++, j++) {\narr[i] = this.nums[j % this.capacity];\n}\nreturn arr;\n}\n}\n
array_queue.c
[class]{arrayQueue}-[func]{}\n
array_queue.cs
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue\n{\nprivate int[] nums;  // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate int front;   // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate int queSize; // \u961f\u5217\u957f\u5ea6\npublic ArrayQueue(int capacity)\n{\nnums = new int[capacity];\nfront = queSize = 0;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\npublic int capacity()\n{\nreturn nums.Length;\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn queSize;\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn queSize == 0;\n}\n/* \u5165\u961f */\npublic void push(int num)\n{\nif (queSize == capacity())\n{\nConsole.WriteLine(\"\u961f\u5217\u5df2\u6ee1\");\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nint rear = (front + queSize) % capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num;\nqueSize++;\n}\n/* \u51fa\u961f */\npublic int pop()\n{\nint num = peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity();\nqueSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\npublic int peek()\n{\nif (isEmpty())\nthrow new Exception();\nreturn nums[front];\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\npublic int[] toArray()\n{\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nint[] res = new int[queSize];\nfor (int i = 0, j = front; i < queSize; i++, j++)\n{\nres[i] = nums[j % this.capacity()];\n}\nreturn res;\n}\n}\n
array_queue.swift
/* \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217 */\nclass ArrayQueue {\nprivate var nums: [Int] // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4\nprivate var front = 0 // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nprivate var queSize = 0 // \u961f\u5217\u957f\u5ea6\ninit(capacity: Int) {\n// \u521d\u59cb\u5316\u6570\u7ec4\nnums = Array(repeating: 0, count: capacity)\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf */\nfunc capacity() -> Int {\nnums.count\n}\n/* \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nqueSize\n}\n/* \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nqueSize == 0\n}\n/* \u5165\u961f */\nfunc push(num: Int) {\nif size() == capacity() {\nprint(\"\u961f\u5217\u5df2\u6ee1\")\nreturn\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nlet rear = (front + queSize) % capacity()\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nnums[rear] = num\nqueSize += 1\n}\n/* \u51fa\u961f */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nfront = (front + 1) % capacity()\nqueSize -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u961f\u9996\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u961f\u5217\u4e3a\u7a7a\")\n}\nreturn nums[front]\n}\n/* \u8fd4\u56de\u6570\u7ec4 */\nfunc toArray() -> [Int] {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = Array(repeating: 0, count: queSize)\nfor (i, j) in sequence(first: (0, front), next: { $0 < self.queSize - 1 ? ($0 + 1, $1 + 1) : nil }) {\nres[i] = nums[j % capacity()]\n}\nreturn res\n}\n}\n
array_queue.zig
// \u57fa\u4e8e\u73af\u5f62\u6570\u7ec4\u5b9e\u73b0\u7684\u961f\u5217\nfn ArrayQueue(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nnums: []T = undefined,                          // \u7528\u4e8e\u5b58\u50a8\u961f\u5217\u5143\u7d20\u7684\u6570\u7ec4     \ncap: usize = 0,                                 // \u961f\u5217\u5bb9\u91cf\nfront: usize = 0,                               // \u961f\u9996\u6307\u9488\uff0c\u6307\u5411\u961f\u9996\u5143\u7d20\nqueSize: usize = 0,                             // \u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e + 1\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6570\u7ec4\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator, cap: usize) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.cap = cap;\nself.nums = try self.mem_allocator.alloc(T, self.cap);\nstd.mem.set(T, self.nums, @as(T, 0));\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u5bb9\u91cf\npub fn capacity(self: *Self) usize {\nreturn self.cap;\n}\n// \u83b7\u53d6\u961f\u5217\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.queSize;\n}\n// \u5224\u65ad\u961f\u5217\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.queSize == 0;\n}\n// \u5165\u961f\npub fn push(self: *Self, num: T) !void {\nif (self.size() == self.capacity()) {\nstd.debug.print(\"\u961f\u5217\u5df2\u6ee1\\n\", .{});\nreturn;\n}\n// \u8ba1\u7b97\u5c3e\u6307\u9488\uff0c\u6307\u5411\u961f\u5c3e\u7d22\u5f15 + 1\n// \u901a\u8fc7\u53d6\u4f59\u64cd\u4f5c\uff0c\u5b9e\u73b0 rear \u8d8a\u8fc7\u6570\u7ec4\u5c3e\u90e8\u540e\u56de\u5230\u5934\u90e8\nvar rear = (self.front + self.queSize) % self.capacity();\n// \u5c06 num \u6dfb\u52a0\u81f3\u961f\u5c3e\nself.nums[rear] = num;\nself.queSize += 1;\n} // \u51fa\u961f\npub fn pop(self: *Self) T {\nvar num = self.peek();\n// \u961f\u9996\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u82e5\u8d8a\u8fc7\u5c3e\u90e8\u5219\u8fd4\u56de\u5230\u6570\u7ec4\u5934\u90e8\nself.front = (self.front + 1) % self.capacity();\nself.queSize -= 1;\nreturn num;\n} // \u8bbf\u95ee\u961f\u9996\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u961f\u5217\u4e3a\u7a7a\");\nreturn self.nums[self.front];\n} // \u8fd4\u56de\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\n// \u4ec5\u8f6c\u6362\u6709\u6548\u957f\u5ea6\u8303\u56f4\u5185\u7684\u5217\u8868\u5143\u7d20\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nvar j: usize = self.front;\nwhile (i < self.size()) : ({ i += 1; j += 1; }) {\nres[i] = self.nums[j % self.capacity()];\n}\nreturn res;\n}\n};\n}\n

\u4ee5\u4e0a\u5b9e\u73b0\u7684\u961f\u5217\u4ecd\u5b58\u5728\u5c40\u9650\u6027\uff0c\u5373\u957f\u5ea6\u4e0d\u53ef\u53d8\u3002\u4e0d\u8fc7\u8fd9\u4e2a\u95ee\u9898\u5f88\u5bb9\u6613\u89e3\u51b3\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6570\u7ec4\u66ff\u6362\u4e3a\u5217\u8868\uff08\u5373\u52a8\u6001\u6570\u7ec4\uff09\uff0c\u4ece\u800c\u5f15\u5165\u6269\u5bb9\u673a\u5236\u3002\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u5c1d\u8bd5\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_stack_and_queue/queue/#523","title":"5.2.3. \u00a0 \u4e24\u79cd\u5b9e\u73b0\u5bf9\u6bd4","text":"

\u4e0e\u6808\u7684\u7ed3\u8bba\u4e00\u81f4\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_stack_and_queue/queue/#524","title":"5.2.4. \u00a0 \u961f\u5217\u5178\u578b\u5e94\u7528","text":"
  • \u6dd8\u5b9d\u8ba2\u5355\u3002\u8d2d\u7269\u8005\u4e0b\u5355\u540e\uff0c\u8ba2\u5355\u5c31\u88ab\u52a0\u5165\u5230\u961f\u5217\u4e4b\u4e2d\uff0c\u968f\u540e\u7cfb\u7edf\u518d\u6839\u636e\u987a\u5e8f\u4f9d\u6b21\u5904\u7406\u961f\u5217\u4e2d\u7684\u8ba2\u5355\u3002\u5728\u53cc\u5341\u4e00\u65f6\uff0c\u5728\u77ed\u65f6\u95f4\u5185\u4f1a\u4ea7\u751f\u6d77\u91cf\u7684\u8ba2\u5355\uff0c\u5982\u4f55\u5904\u7406\u300c\u9ad8\u5e76\u53d1\u300d\u5219\u662f\u5de5\u7a0b\u5e08\u4eec\u9700\u8981\u91cd\u70b9\u601d\u8003\u7684\u95ee\u9898\u3002
  • \u5404\u79cd\u5f85\u529e\u4e8b\u9879\u3002\u4efb\u4f55\u9700\u8981\u5b9e\u73b0\u201c\u5148\u6765\u540e\u5230\u201d\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u6253\u5370\u673a\u7684\u4efb\u52a1\u961f\u5217\u3001\u9910\u5385\u7684\u51fa\u9910\u961f\u5217\u7b49\u7b49\u3002
"},{"location":"chapter_stack_and_queue/stack/","title":"5.1. \u00a0 \u6808","text":"

\u300c\u6808 Stack\u300d\u662f\u4e00\u79cd\u9075\u5faa\u300c\u5148\u5165\u540e\u51fa first in, last out\u300d\u6570\u636e\u64cd\u4f5c\u89c4\u5219\u7684\u7ebf\u6027\u6570\u636e\u7ed3\u6784\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u6808\u7c7b\u6bd4\u4e3a\u653e\u5728\u684c\u9762\u4e0a\u7684\u4e00\u645e\u76d8\u5b50\uff0c\u5982\u679c\u9700\u8981\u62ff\u51fa\u5e95\u90e8\u7684\u76d8\u5b50\uff0c\u5219\u9700\u8981\u5148\u5c06\u4e0a\u9762\u7684\u76d8\u5b50\u4f9d\u6b21\u53d6\u51fa\u3002

\u201c\u76d8\u5b50\u201d\u662f\u4e00\u79cd\u5f62\u8c61\u6bd4\u55bb\uff0c\u6211\u4eec\u5c06\u76d8\u5b50\u66ff\u6362\u4e3a\u4efb\u610f\u4e00\u79cd\u5143\u7d20\uff08\u4f8b\u5982\u6574\u6570\u3001\u5b57\u7b26\u3001\u5bf9\u8c61\u7b49\uff09\uff0c\u5c31\u5f97\u5230\u4e86\u6808\u6570\u636e\u7ed3\u6784\u3002

\u6211\u4eec\u5c06\u8fd9\u4e00\u645e\u5143\u7d20\u7684\u9876\u90e8\u79f0\u4e3a\u300c\u6808\u9876\u300d\uff0c\u5c06\u5e95\u90e8\u79f0\u4e3a\u300c\u6808\u5e95\u300d\uff0c\u5c06\u628a\u5143\u7d20\u6dfb\u52a0\u5230\u6808\u9876\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u5165\u6808\u300d\uff0c\u5c06\u5220\u9664\u6808\u9876\u5143\u7d20\u7684\u64cd\u4f5c\u79f0\u4e3a\u300c\u51fa\u6808\u300d\u3002

Fig. \u6808\u7684\u5148\u5165\u540e\u51fa\u89c4\u5219

"},{"location":"chapter_stack_and_queue/stack/#511","title":"5.1.1. \u00a0 \u6808\u5e38\u7528\u64cd\u4f5c","text":"

\u6808\u7684\u5e38\u7528\u64cd\u4f5c\u89c1\u4e0b\u8868\uff0c\u65b9\u6cd5\u540d\u9700\u6839\u636e\u7f16\u7a0b\u8bed\u8a00\u6765\u786e\u5b9a\uff0c\u6b64\u5904\u6211\u4eec\u4ee5\u5e38\u89c1\u7684 push , pop , peek \u4e3a\u4f8b\u3002

\u65b9\u6cd5 \u63cf\u8ff0 \u65f6\u95f4\u590d\u6742\u5ea6 push() \u5143\u7d20\u5165\u6808\uff08\u6dfb\u52a0\u81f3\u6808\u9876\uff09 \\(O(1)\\) pop() \u6808\u9876\u5143\u7d20\u51fa\u6808 \\(O(1)\\) peek() \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \\(O(1)\\)

\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u597d\u7684\u6808\u7c7b\u3002 \u67d0\u4e9b\u8bed\u8a00\u5e76\u672a\u4e13\u95e8\u63d0\u4f9b\u6808\u7c7b\uff0c\u4f46\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u628a\u8be5\u8bed\u8a00\u7684\u300c\u6570\u7ec4\u300d\u6216\u300c\u94fe\u8868\u300d\u770b\u4f5c\u6808\u6765\u4f7f\u7528\uff0c\u5e76\u901a\u8fc7\u201c\u8111\u8865\u201d\u6765\u5c4f\u853d\u65e0\u5173\u64cd\u4f5c\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig stack.java
/* \u521d\u59cb\u5316\u6808 */\nStack<Integer> stack = new Stack<>();\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint peek = stack.peek();\n/* \u5143\u7d20\u51fa\u6808 */\nint pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.size();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nboolean isEmpty = stack.isEmpty();\n
stack.cpp
/* \u521d\u59cb\u5316\u6808 */\nstack<int> stack;\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top = stack.top();\n/* \u5143\u7d20\u51fa\u6808 */\nstack.pop(); // \u65e0\u8fd4\u56de\u503c\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.size();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nbool empty = stack.empty();\n
stack.py
\"\"\" \u521d\u59cb\u5316\u6808 \"\"\"\n# Python \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a List \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nstack: List[int] = []\n\"\"\" \u5143\u7d20\u5165\u6808 \"\"\"\nstack.append(1)\nstack.append(3)\nstack.append(2)\nstack.append(5)\nstack.append(4)\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\npeek: int = stack[-1]\n\"\"\" \u5143\u7d20\u51fa\u6808 \"\"\"\npop: int = stack.pop()\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nsize: int = len(stack)\n\"\"\" \u5224\u65ad\u662f\u5426\u4e3a\u7a7a \"\"\"\nis_empty: bool = len(stack) == 0\n
stack_test.go
/* \u521d\u59cb\u5316\u6808 */\n// \u5728 Go \u4e2d\uff0c\u63a8\u8350\u5c06 Slice \u5f53\u4f5c\u6808\u6765\u4f7f\u7528\nvar stack []int\n/* \u5143\u7d20\u5165\u6808 */\nstack = append(stack, 1)\nstack = append(stack, 3)\nstack = append(stack, 2)\nstack = append(stack, 5)\nstack = append(stack, 4)\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek := stack[len(stack)-1]\n/* \u5143\u7d20\u51fa\u6808 */\npop := stack[len(stack)-1]\nstack = stack[:len(stack)-1]\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nsize := len(stack)\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nisEmpty := len(stack) == 0\n
stack.js
/* \u521d\u59cb\u5316\u6808 */\n// Javascript \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nconst stack = [];\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nconst peek = stack[stack.length-1];\n/* \u5143\u7d20\u51fa\u6808 */\nconst pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nconst size = stack.length;\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nconst is_empty = stack.length === 0;\n
stack.ts
/* \u521d\u59cb\u5316\u6808 */\n// Typescript \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528 \nconst stack: number[] = [];\n/* \u5143\u7d20\u5165\u6808 */\nstack.push(1);\nstack.push(3);\nstack.push(2);\nstack.push(5);\nstack.push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nconst peek = stack[stack.length - 1];\n/* \u5143\u7d20\u51fa\u6808 */\nconst pop = stack.pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nconst size = stack.length;\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nconst is_empty = stack.length === 0;\n
stack.c
\n
stack.cs
/* \u521d\u59cb\u5316\u6808 */\nStack<int> stack = new ();\n/* \u5143\u7d20\u5165\u6808 */\nstack.Push(1);\nstack.Push(3);\nstack.Push(2);\nstack.Push(5);\nstack.Push(4);\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint peek = stack.Peek();\n/* \u5143\u7d20\u51fa\u6808 */\nint pop = stack.Pop();\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size = stack.Count();\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nbool isEmpty = stack.Count()==0;\n
stack.swift
/* \u521d\u59cb\u5316\u6808 */\n// Swift \u6ca1\u6709\u5185\u7f6e\u7684\u6808\u7c7b\uff0c\u53ef\u4ee5\u628a Array \u5f53\u4f5c\u6808\u6765\u4f7f\u7528\nvar stack: [Int] = []\n/* \u5143\u7d20\u5165\u6808 */\nstack.append(1)\nstack.append(3)\nstack.append(2)\nstack.append(5)\nstack.append(4)\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nlet peek = stack.last!\n/* \u5143\u7d20\u51fa\u6808 */\nlet pop = stack.removeLast()\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nlet size = stack.count\n/* \u5224\u65ad\u662f\u5426\u4e3a\u7a7a */\nlet isEmpty = stack.isEmpty\n
stack.zig
\n
"},{"location":"chapter_stack_and_queue/stack/#512","title":"5.1.2. \u00a0 \u6808\u7684\u5b9e\u73b0","text":"

\u4e3a\u4e86\u66f4\u52a0\u6e05\u6670\u5730\u4e86\u89e3\u6808\u7684\u8fd0\u884c\u673a\u5236\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u81ea\u5df1\u52a8\u624b\u5b9e\u73b0\u4e00\u4e2a\u6808\u7c7b\u3002

\u6808\u89c4\u5b9a\u5143\u7d20\u662f\u5148\u5165\u540e\u51fa\u7684\uff0c\u56e0\u6b64\u6211\u4eec\u53ea\u80fd\u5728\u6808\u9876\u6dfb\u52a0\u6216\u5220\u9664\u5143\u7d20\u3002\u7136\u800c\uff0c\u6570\u7ec4\u6216\u94fe\u8868\u90fd\u53ef\u4ee5\u5728\u4efb\u610f\u4f4d\u7f6e\u6dfb\u52a0\u5220\u9664\u5143\u7d20\uff0c\u56e0\u6b64 \u6808\u53ef\u88ab\u770b\u4f5c\u662f\u4e00\u79cd\u53d7\u7ea6\u675f\u7684\u6570\u7ec4\u6216\u94fe\u8868\u3002\u6362\u8a00\u4e4b\uff0c\u6211\u4eec\u53ef\u4ee5\u201c\u5c4f\u853d\u201d\u6570\u7ec4\u6216\u94fe\u8868\u7684\u90e8\u5206\u65e0\u5173\u64cd\u4f5c\uff0c\u4f7f\u4e4b\u5bf9\u5916\u7684\u8868\u73b0\u903b\u8f91\u7b26\u5408\u6808\u7684\u89c4\u5b9a\u5373\u53ef\u3002

"},{"location":"chapter_stack_and_queue/stack/#_1","title":"\u57fa\u4e8e\u94fe\u8868\u7684\u5b9e\u73b0","text":"

\u4f7f\u7528\u300c\u94fe\u8868\u300d\u5b9e\u73b0\u6808\u65f6\uff0c\u5c06\u94fe\u8868\u7684\u5934\u7ed3\u70b9\u770b\u4f5c\u6808\u9876\uff0c\u5c06\u5c3e\u7ed3\u70b9\u770b\u4f5c\u6808\u5e95\u3002

\u5bf9\u4e8e\u5165\u6808\u64cd\u4f5c\uff0c\u5c06\u5143\u7d20\u63d2\u5165\u5230\u94fe\u8868\u5934\u90e8\u5373\u53ef\uff0c\u8fd9\u79cd\u7ed3\u70b9\u6dfb\u52a0\u65b9\u5f0f\u88ab\u79f0\u4e3a\u201c\u5934\u63d2\u6cd5\u201d\u3002\u800c\u5bf9\u4e8e\u51fa\u6808\u64cd\u4f5c\uff0c\u5219\u5c06\u5934\u7ed3\u70b9\u4ece\u94fe\u8868\u4e2d\u5220\u9664\u5373\u53ef\u3002

LinkedListStackpush()pop()

\u4ee5\u4e0b\u662f\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u6808\u7684\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig linkedlist_stack.java
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate ListNode stackPeek;  // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate int stkSize = 0;   // \u6808\u7684\u957f\u5ea6\npublic LinkedListStack() {\nstackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size() {\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num) {\nListNode node = new ListNode(num);\nnode.next = stackPeek;\nstackPeek = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\npublic int pop() {\nint num = peek();\nstackPeek = stackPeek.next;\nstkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek() {\nif (size() == 0)\nthrow new EmptyStackException();\nreturn stackPeek.val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray() {\nListNode node = stackPeek;\nint[] res = new int[size()];\nfor (int i = res.length - 1; i >= 0; i--) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.cpp
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate:\nListNode* stackTop; // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nint stkSize;        // \u6808\u7684\u957f\u5ea6\npublic:\nLinkedListStack() {\nstackTop = nullptr;\nstkSize = 0;\n}\n~LinkedListStack() {\nfreeMemoryLinkedList(stackTop);\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size() {\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\nvoid push(int num) {\nListNode* node = new ListNode(num);\nnode->next = stackTop;\nstackTop = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\nvoid pop() {\nint num = top();\nListNode *tmp = stackTop;\nstackTop = stackTop->next;\n// \u91ca\u653e\u5185\u5b58\ndelete tmp;\nstkSize--;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top() {\nif (size() == 0)\nthrow out_of_range(\"\u6808\u4e3a\u7a7a\");\nreturn stackTop->val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nvector<int> toVector() {\nListNode* node = stackTop;\nvector<int> res(size());\nfor (int i = res.size() - 1; i >= 0; i--) {\nres[i] = node->val;\nnode = node->next;\n}\nreturn res;\n}\n};\n
linkedlist_stack.py
class LinkedListStack:\n\"\"\" \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 \"\"\"\ndef __init__(self):\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__peek: Optional[ListNode] = None\nself.__size: int = 0\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nreturn self.__size\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn not self.__peek\ndef push(self, val: int) -> None:\n\"\"\" \u5165\u6808 \"\"\"\nnode = ListNode(val)\nnode.next = self.__peek\nself.__peek = node\nself.__size += 1\ndef pop(self) -> int:\n\"\"\" \u51fa\u6808 \"\"\"\nnum: int = self.peek()\nself.__peek = self.__peek.next\nself.__size -= 1\nreturn num\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\n# \u5224\u7a7a\u5904\u7406\nif not self.__peek: return None\nreturn self.__peek.val\ndef to_list(self) -> List[int]:\n\"\"\" \u8f6c\u5316\u4e3a\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\narr: List[int] = []\nnode = self.__peek\nwhile node:\narr.append(node.val)\nnode = node.next\narr.reverse()\nreturn arr\n
linkedlist_stack.go
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\ntype linkedListStack struct {\n// \u4f7f\u7528\u5185\u7f6e\u5305 list \u6765\u5b9e\u73b0\u6808\ndata *list.List\n}\n/* \u521d\u59cb\u5316\u6808 */\nfunc newLinkedListStack() *linkedListStack {\nreturn &linkedListStack{\ndata: list.New(),\n}\n}\n/* \u5165\u6808 */\nfunc (s *linkedListStack) push(value int) {\ns.data.PushBack(value)\n}\n/* \u51fa\u6808 */\nfunc (s *linkedListStack) pop() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\ns.data.Remove(e)\nreturn e.Value\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc (s *linkedListStack) peek() any {\nif s.isEmpty() {\nreturn nil\n}\ne := s.data.Back()\nreturn e.Value\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc (s *linkedListStack) size() int {\nreturn s.data.Len()\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc (s *linkedListStack) isEmpty() bool {\nreturn s.data.Len() == 0\n}\n/* \u83b7\u53d6 List \u7528\u4e8e\u6253\u5370 */\nfunc (s *linkedListStack) toList() *list.List {\nreturn s.data\n}\n
linkedlist_stack.js
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\n#stackPeek;     // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\n#stkSize = 0;   // \u6808\u7684\u957f\u5ea6\nconstructor() {\nthis.#stackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nisEmpty() {\nreturn this.size == 0;\n}\n/* \u5165\u6808 */\npush(num) {\nconst node = new ListNode(num);\nnode.next = this.#stackPeek;\nthis.#stackPeek = node;\nthis.#stkSize++;\n}\n/* \u51fa\u6808 */\npop() {\nconst num = this.peek();\nthis.#stackPeek = this.#stackPeek.next;\nthis.#stkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek() {\nif (!this.#stackPeek)\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stackPeek.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray() {\nlet node = this.#stackPeek;\nconst res = new Array(this.size);\nfor (let i = res.length - 1; i >= 0; i--) {\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.ts
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate stackPeek: ListNode | null; // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate stkSize: number = 0; // \u6808\u7684\u957f\u5ea6\nconstructor() {\nthis.stackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nisEmpty(): boolean {\nreturn this.size == 0;\n}\n/* \u5165\u6808 */\npush(num: number): void {\nconst node = new ListNode(num);\nnode.next = this.stackPeek;\nthis.stackPeek = node;\nthis.stkSize++;\n}\n/* \u51fa\u6808 */\npop(): number {\nconst num = this.peek();\nif (!this.stackPeek) throw new Error('\u6808\u4e3a\u7a7a');\nthis.stackPeek = this.stackPeek.next;\nthis.stkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npeek(): number {\nif (!this.stackPeek) throw new Error('\u6808\u4e3a\u7a7a');\nreturn this.stackPeek.val;\n}\n/* \u5c06\u94fe\u8868\u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\ntoArray(): number[] {\nlet node = this.stackPeek;\nconst res = new Array<number>(this.size);\nfor (let i = res.length - 1; i >= 0; i--) {\nres[i] = node!.val;\nnode = node!.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.c
[class]{linkedListStack}-[func]{}\n
linkedlist_stack.cs
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack\n{\nprivate ListNode? stackPeek;  // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate int stkSize = 0;   // \u6808\u7684\u957f\u5ea6\npublic LinkedListStack()\n{\nstackPeek = null;\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn stkSize;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num)\n{\nListNode node = new ListNode(num);\nnode.next = stackPeek;\nstackPeek = node;\nstkSize++;\n}\n/* \u51fa\u6808 */\npublic int pop()\n{\nif (stackPeek == null)\nthrow new Exception();\nint num = peek();\nstackPeek = stackPeek.next;\nstkSize--;\nreturn num;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek()\n{\nif (size() == 0 || stackPeek == null)\nthrow new Exception();\nreturn stackPeek.val;\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nif (stackPeek == null)\nreturn Array.Empty<int>();\nListNode node = stackPeek;\nint[] res = new int[size()];\nfor (int i = res.Length - 1; i >= 0; i--)\n{\nres[i] = node.val;\nnode = node.next;\n}\nreturn res;\n}\n}\n
linkedlist_stack.swift
/* \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808 */\nclass LinkedListStack {\nprivate var _peek: ListNode? // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nprivate var _size = 0 // \u6808\u7684\u957f\u5ea6\ninit() {}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc size() -> Int {\n_size\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nsize() == 0\n}\n/* \u5165\u6808 */\nfunc push(num: Int) {\nlet node = ListNode(x: num)\nnode.next = _peek\n_peek = node\n_size += 1\n}\n/* \u51fa\u6808 */\n@discardableResult\nfunc pop() -> Int {\nlet num = peek()\n_peek = _peek?.next\n_size -= 1\nreturn num\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn _peek!.val\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nvar node = _peek\nvar res = Array(repeating: 0, count: _size)\nfor i in sequence(first: res.count - 1, next: { $0 >= 0 + 1 ? $0 - 1 : nil }) {\nres[i] = node!.val\nnode = node?.next\n}\nreturn res\n}\n}\n
linkedlist_stack.zig
// \u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0\u7684\u6808\nfn LinkedListStack(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nstack_top: ?*inc.ListNode(T) = null,             // \u5c06\u5934\u7ed3\u70b9\u4f5c\u4e3a\u6808\u9876\nstk_size: usize = 0,                             // \u6808\u7684\u957f\u5ea6\nmem_arena: ?std.heap.ArenaAllocator = null,\nmem_allocator: std.mem.Allocator = undefined,   // \u5185\u5b58\u5206\u914d\u5668\n// \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6808\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) !void {\nif (self.mem_arena == null) {\nself.mem_arena = std.heap.ArenaAllocator.init(allocator);\nself.mem_allocator = self.mem_arena.?.allocator();\n}\nself.stack_top = null;\nself.stk_size = 0;\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.mem_arena == null) return;\nself.mem_arena.?.deinit();\n}\n// \u83b7\u53d6\u6808\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.stk_size;\n}\n// \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u6808\u9876\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.size() == 0) @panic(\"\u6808\u4e3a\u7a7a\");\nreturn self.stack_top.?.val;\n}  // \u5165\u6808\npub fn push(self: *Self, num: T) !void {\nvar node = try self.mem_allocator.create(inc.ListNode(T));\nnode.init(num);\nnode.next = self.stack_top;\nself.stack_top = node;\nself.stk_size += 1;\n} // \u51fa\u6808\npub fn pop(self: *Self) T {\nvar num = self.peek();\nself.stack_top = self.stack_top.?.next;\nself.stk_size -= 1;\nreturn num;\n} // \u5c06\u6808\u8f6c\u6362\u4e3a\u6570\u7ec4\npub fn toArray(self: *Self) ![]T {\nvar node = self.stack_top;\nvar res = try self.mem_allocator.alloc(T, self.size());\nstd.mem.set(T, res, @as(T, 0));\nvar i: usize = 0;\nwhile (i < res.len) : (i += 1) {\nres[res.len - i - 1] = node.?.val;\nnode = node.?.next;\n}\nreturn res;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/stack/#_2","title":"\u57fa\u4e8e\u6570\u7ec4\u7684\u5b9e\u73b0","text":"

\u4f7f\u7528\u300c\u6570\u7ec4\u300d\u5b9e\u73b0\u6808\u65f6\uff0c\u8003\u8651\u5c06\u6570\u7ec4\u7684\u5c3e\u90e8\u5f53\u4f5c\u6808\u9876\u3002\u8fd9\u6837\u8bbe\u8ba1\u4e0b\uff0c\u300c\u5165\u6808\u300d\u4e0e\u300c\u51fa\u6808\u300d\u64cd\u4f5c\u5c31\u5bf9\u5e94\u5728\u6570\u7ec4\u5c3e\u90e8\u300c\u6dfb\u52a0\u5143\u7d20\u300d\u4e0e\u300c\u5220\u9664\u5143\u7d20\u300d\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4e3a \\(O(1)\\) \u3002

ArrayStackpush()pop()

\u7531\u4e8e\u5165\u6808\u7684\u5143\u7d20\u53ef\u80fd\u662f\u6e90\u6e90\u4e0d\u65ad\u7684\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528\u652f\u6301\u52a8\u6001\u6269\u5bb9\u7684\u300c\u5217\u8868\u300d\uff0c\u8fd9\u6837\u5c31\u65e0\u9700\u81ea\u884c\u5b9e\u73b0\u6570\u7ec4\u6269\u5bb9\u4e86\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig array_stack.java
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate ArrayList<Integer> stack;\npublic ArrayStack() {\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = new ArrayList<>();\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size() {\nreturn stack.size();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic boolean isEmpty() {\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num) {\nstack.add(num);\n}\n/* \u51fa\u6808 */\npublic int pop() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn stack.remove(size() - 1);\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek() {\nif (isEmpty())\nthrow new EmptyStackException();\nreturn stack.get(size() - 1);\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic Object[] toArray() {\nreturn stack.toArray();\n}\n}\n
array_stack.cpp
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate:\nvector<int> stack;\npublic:\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nint size() {\nreturn stack.size();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nbool empty() {\nreturn stack.empty();\n}\n/* \u5165\u6808 */\nvoid push(int num) {\nstack.push_back(num);\n}\n/* \u51fa\u6808 */\nvoid pop() {\nint oldTop = top();\nstack.pop_back();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nint top() {\nif(empty())\nthrow out_of_range(\"\u6808\u4e3a\u7a7a\");\nreturn stack.back();\n}\n/* \u8fd4\u56de Vector */\nvector<int> toVector() {\nreturn stack;\n}\n};\n
array_stack.py
class ArrayStack:\n\"\"\" \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 \"\"\"\ndef __init__(self) -> None:\n\"\"\" \u6784\u9020\u65b9\u6cd5 \"\"\"\nself.__stack: List[int] = []\ndef size(self) -> int:\n\"\"\" \u83b7\u53d6\u6808\u7684\u957f\u5ea6 \"\"\"\nreturn len(self.__stack)\ndef is_empty(self) -> bool:\n\"\"\" \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a \"\"\"\nreturn self.__stack == []\ndef push(self, item: int) -> None:\n\"\"\" \u5165\u6808 \"\"\"\nself.__stack.append(item)\ndef pop(self) -> int:\n\"\"\" \u51fa\u6808 \"\"\"\nassert not self.is_empty(), \"\u6808\u4e3a\u7a7a\"\nreturn self.__stack.pop()\ndef peek(self) -> int:\n\"\"\" \u8bbf\u95ee\u6808\u9876\u5143\u7d20 \"\"\"\nassert not self.is_empty(), \"\u6808\u4e3a\u7a7a\"\nreturn self.__stack[-1]\ndef to_list(self) -> List[int]:\n\"\"\" \u8fd4\u56de\u5217\u8868\u7528\u4e8e\u6253\u5370 \"\"\"\nreturn self.__stack\n
array_stack.go
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\ntype arrayStack struct {\ndata []int // \u6570\u636e\n}\n/* \u521d\u59cb\u5316\u6808 */\nfunc newArrayStack() *arrayStack {\nreturn &arrayStack{\n// \u8bbe\u7f6e\u6808\u7684\u957f\u5ea6\u4e3a 0\uff0c\u5bb9\u91cf\u4e3a 16\ndata: make([]int, 0, 16),\n}\n}\n/* \u6808\u7684\u957f\u5ea6 */\nfunc (s *arrayStack) size() int {\nreturn len(s.data)\n}\n/* \u6808\u662f\u5426\u4e3a\u7a7a */\nfunc (s *arrayStack) isEmpty() bool {\nreturn s.size() == 0\n}\n/* \u5165\u6808 */\nfunc (s *arrayStack) push(v int) {\n// \u5207\u7247\u4f1a\u81ea\u52a8\u6269\u5bb9\ns.data = append(s.data, v)\n}\n/* \u51fa\u6808 */\nfunc (s *arrayStack) pop() any {\nval := s.peek()\ns.data = s.data[:len(s.data)-1]\nreturn val\n}\n/* \u83b7\u53d6\u6808\u9876\u5143\u7d20 */\nfunc (s *arrayStack) peek() any {\nif s.isEmpty() {\nreturn nil\n}\nval := s.data[len(s.data)-1]\nreturn val\n}\n/* \u83b7\u53d6 Slice \u7528\u4e8e\u6253\u5370 */\nfunc (s *arrayStack) toSlice() []int {\nreturn s.data\n}\n
array_stack.js
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\n#stack;\nconstructor() {\nthis.#stack = [];\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size() {\nreturn this.#stack.length;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nempty() {\nreturn this.#stack.length === 0;\n}\n/* \u5165\u6808 */\npush(num) {\nthis.#stack.push(num);\n}\n/* \u51fa\u6808 */\npop() {\nif (this.empty())\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stack.pop();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\ntop() {\nif (this.empty())\nthrow new Error(\"\u6808\u4e3a\u7a7a\");\nreturn this.#stack[this.#stack.length - 1];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\nreturn this.#stack;\n}\n};\n
array_stack.ts
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate stack: number[];\nconstructor() {\nthis.stack = [];\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nget size(): number {\nreturn this.stack.length;\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nempty(): boolean {\nreturn this.stack.length === 0;\n}\n/* \u5165\u6808 */\npush(num: number): void {\nthis.stack.push(num);\n}\n/* \u51fa\u6808 */\npop(): number | undefined {\nif (this.empty())\nthrow new Error('\u6808\u4e3a\u7a7a');\nreturn this.stack.pop();\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\ntop(): number | undefined {\nif (this.empty())\nthrow new Error('\u6808\u4e3a\u7a7a');\nreturn this.stack[this.stack.length - 1];\n}\n/* \u8fd4\u56de Array */\ntoArray() {\nreturn this.stack;\n}\n};\n
array_stack.c
[class]{arrayStack}-[func]{}\n
array_stack.cs
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack\n{\nprivate List<int> stack;\npublic ArrayStack()\n{\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = new();\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\npublic int size()\n{\nreturn stack.Count();\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\npublic bool isEmpty()\n{\nreturn size() == 0;\n}\n/* \u5165\u6808 */\npublic void push(int num)\n{\nstack.Add(num);\n}\n/* \u51fa\u6808 */\npublic int pop()\n{\nif (isEmpty())\nthrow new Exception();\nvar val = peek();\nstack.RemoveAt(size() - 1);\nreturn val;\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\npublic int peek()\n{\nif (isEmpty())\nthrow new Exception();\nreturn stack[size() - 1];\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\npublic int[] toArray()\n{\nreturn stack.ToArray();\n}\n}\n
array_stack.swift
/* \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808 */\nclass ArrayStack {\nprivate var stack: [Int]\ninit() {\n// \u521d\u59cb\u5316\u5217\u8868\uff08\u52a8\u6001\u6570\u7ec4\uff09\nstack = []\n}\n/* \u83b7\u53d6\u6808\u7684\u957f\u5ea6 */\nfunc size() -> Int {\nstack.count\n}\n/* \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a */\nfunc isEmpty() -> Bool {\nstack.isEmpty\n}\n/* \u5165\u6808 */\nfunc push(num: Int) {\nstack.append(num)\n}\n/* \u51fa\u6808 */\n@discardableResult\nfunc pop() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn stack.removeLast()\n}\n/* \u8bbf\u95ee\u6808\u9876\u5143\u7d20 */\nfunc peek() -> Int {\nif isEmpty() {\nfatalError(\"\u6808\u4e3a\u7a7a\")\n}\nreturn stack.last!\n}\n/* \u5c06 List \u8f6c\u5316\u4e3a Array \u5e76\u8fd4\u56de */\nfunc toArray() -> [Int] {\nstack\n}\n}\n
array_stack.zig
// \u57fa\u4e8e\u6570\u7ec4\u5b9e\u73b0\u7684\u6808\nfn ArrayStack(comptime T: type) type {\nreturn struct {\nconst Self = @This();\nstack: ?std.ArrayList(T) = null,     // \u6784\u9020\u65b9\u6cd5\uff08\u5206\u914d\u5185\u5b58+\u521d\u59cb\u5316\u6808\uff09\npub fn init(self: *Self, allocator: std.mem.Allocator) void {\nif (self.stack == null) {\nself.stack = std.ArrayList(T).init(allocator);\n}\n}\n// \u6790\u6784\u65b9\u6cd5\uff08\u91ca\u653e\u5185\u5b58\uff09\npub fn deinit(self: *Self) void {\nif (self.stack == null) return;\nself.stack.?.deinit();\n}\n// \u83b7\u53d6\u6808\u7684\u957f\u5ea6\npub fn size(self: *Self) usize {\nreturn self.stack.?.items.len;\n}\n// \u5224\u65ad\u6808\u662f\u5426\u4e3a\u7a7a\npub fn isEmpty(self: *Self) bool {\nreturn self.size() == 0;\n}\n// \u8bbf\u95ee\u6808\u9876\u5143\u7d20\npub fn peek(self: *Self) T {\nif (self.isEmpty()) @panic(\"\u6808\u4e3a\u7a7a\");\nreturn self.stack.?.items[self.size() - 1];\n}  // \u5165\u6808\npub fn push(self: *Self, num: T) !void {\ntry self.stack.?.append(num);\n} // \u51fa\u6808\npub fn pop(self: *Self) T {\nvar num = self.stack.?.pop();\nreturn num;\n} // \u8fd4\u56de ArrayList\npub fn toList(self: *Self) std.ArrayList(T) {\nreturn self.stack.?;\n}\n};\n}\n
"},{"location":"chapter_stack_and_queue/stack/#513","title":"5.1.3. \u00a0 \u4e24\u79cd\u5b9e\u73b0\u5bf9\u6bd4","text":""},{"location":"chapter_stack_and_queue/stack/#_3","title":"\u652f\u6301\u64cd\u4f5c","text":"

\u4e24\u79cd\u5b9e\u73b0\u90fd\u652f\u6301\u6808\u5b9a\u4e49\u4e2d\u7684\u5404\u9879\u64cd\u4f5c\uff0c\u6570\u7ec4\u5b9e\u73b0\u989d\u5916\u652f\u6301\u968f\u673a\u8bbf\u95ee\uff0c\u4f46\u8fd9\u5df2\u7ecf\u8d85\u51fa\u6808\u7684\u5b9a\u4e49\u8303\u7574\uff0c\u4e00\u822c\u4e0d\u4f1a\u7528\u5230\u3002

"},{"location":"chapter_stack_and_queue/stack/#_4","title":"\u65f6\u95f4\u6548\u7387","text":"

\u5728\u6570\u7ec4\uff08\u5217\u8868\uff09\u5b9e\u73b0\u4e2d\uff0c\u5165\u6808\u4e0e\u51fa\u6808\u64cd\u4f5c\u90fd\u662f\u5728\u9884\u5148\u5206\u914d\u597d\u7684\u8fde\u7eed\u5185\u5b58\u4e2d\u64cd\u4f5c\uff0c\u5177\u6709\u5f88\u597d\u7684\u7f13\u5b58\u672c\u5730\u6027\uff0c\u6548\u7387\u5f88\u597d\u3002\u7136\u800c\uff0c\u5982\u679c\u5165\u6808\u65f6\u8d85\u51fa\u6570\u7ec4\u5bb9\u91cf\uff0c\u5219\u4f1a\u89e6\u53d1\u6269\u5bb9\u673a\u5236\uff0c\u90a3\u4e48\u8be5\u6b21\u5165\u6808\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a \\(O(n)\\) \u3002

\u5728\u94fe\u8868\u5b9e\u73b0\u4e2d\uff0c\u94fe\u8868\u7684\u6269\u5bb9\u975e\u5e38\u7075\u6d3b\uff0c\u4e0d\u5b58\u5728\u4e0a\u8ff0\u6570\u7ec4\u6269\u5bb9\u65f6\u53d8\u6162\u7684\u95ee\u9898\u3002\u7136\u800c\uff0c\u5165\u6808\u64cd\u4f5c\u9700\u8981\u521d\u59cb\u5316\u7ed3\u70b9\u5bf9\u8c61\u5e76\u4fee\u6539\u6307\u9488\uff0c\u56e0\u800c\u6548\u7387\u4e0d\u5982\u6570\u7ec4\u3002\u8fdb\u4e00\u6b65\u5730\u601d\u8003\uff0c\u5982\u679c\u5165\u6808\u5143\u7d20\u4e0d\u662f int \u800c\u662f\u7ed3\u70b9\u5bf9\u8c61\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u7701\u53bb\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u4ece\u800c\u63d0\u5347\u6548\u7387\u3002

\u7efc\u4e0a\u6240\u8ff0\uff0c\u5f53\u5165\u6808\u4e0e\u51fa\u6808\u64cd\u4f5c\u7684\u5143\u7d20\u662f\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff08\u4f8b\u5982 int , double \uff09\u65f6\uff0c\u5219\u7ed3\u8bba\u5982\u4e0b\uff1a

  • \u6570\u7ec4\u5b9e\u73b0\u7684\u6808\u5728\u89e6\u53d1\u6269\u5bb9\u65f6\u4f1a\u53d8\u6162\uff0c\u4f46\u7531\u4e8e\u6269\u5bb9\u662f\u4f4e\u9891\u64cd\u4f5c\uff0c\u56e0\u6b64 \u603b\u4f53\u6548\u7387\u66f4\u9ad8\uff1b
  • \u94fe\u8868\u5b9e\u73b0\u7684\u6808\u53ef\u4ee5\u63d0\u4f9b \u66f4\u52a0\u7a33\u5b9a\u7684\u6548\u7387\u8868\u73b0\uff1b
"},{"location":"chapter_stack_and_queue/stack/#_5","title":"\u7a7a\u95f4\u6548\u7387","text":"

\u5728\u521d\u59cb\u5316\u5217\u8868\u65f6\uff0c\u7cfb\u7edf\u4f1a\u7ed9\u5217\u8868\u5206\u914d\u201c\u521d\u59cb\u5bb9\u91cf\u201d\uff0c\u8be5\u5bb9\u91cf\u53ef\u80fd\u8d85\u8fc7\u6211\u4eec\u7684\u9700\u6c42\u3002\u5e76\u4e14\u6269\u5bb9\u673a\u5236\u4e00\u822c\u662f\u6309\u7167\u7279\u5b9a\u500d\u7387\uff08\u6bd4\u5982 2 \u500d\uff09\u8fdb\u884c\u6269\u5bb9\uff0c\u6269\u5bb9\u540e\u7684\u5bb9\u91cf\u4e5f\u53ef\u80fd\u8d85\u51fa\u6211\u4eec\u7684\u9700\u6c42\u3002\u56e0\u6b64\uff0c\u6570\u7ec4\u5b9e\u73b0\u6808\u4f1a\u9020\u6210\u4e00\u5b9a\u7684\u7a7a\u95f4\u6d6a\u8d39\u3002

\u5f53\u7136\uff0c\u7531\u4e8e\u7ed3\u70b9\u9700\u8981\u989d\u5916\u5b58\u50a8\u6307\u9488\uff0c\u56e0\u6b64 \u94fe\u8868\u7ed3\u70b9\u6bd4\u6570\u7ec4\u5143\u7d20\u5360\u7528\u66f4\u5927\u3002

\u7efc\u4e0a\uff0c\u6211\u4eec\u4e0d\u80fd\u7b80\u5355\u5730\u786e\u5b9a\u54ea\u79cd\u5b9e\u73b0\u66f4\u52a0\u7701\u5185\u5b58\uff0c\u9700\u8981 case-by-case \u5730\u5206\u6790\u3002

"},{"location":"chapter_stack_and_queue/stack/#514","title":"5.1.4. \u00a0 \u6808\u5178\u578b\u5e94\u7528","text":"
  • \u6d4f\u89c8\u5668\u4e2d\u7684\u540e\u9000\u4e0e\u524d\u8fdb\u3001\u8f6f\u4ef6\u4e2d\u7684\u64a4\u9500\u4e0e\u53cd\u64a4\u9500\u3002\u6bcf\u5f53\u6211\u4eec\u6253\u5f00\u65b0\u7684\u7f51\u9875\uff0c\u6d4f\u89c8\u5668\u5c31\u5c06\u4e0a\u4e00\u4e2a\u7f51\u9875\u6267\u884c\u5165\u6808\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7\u300c\u540e\u9000\u300d\u64cd\u4f5c\u6765\u56de\u5230\u4e0a\u4e00\u9875\u9762\uff0c\u540e\u9000\u64cd\u4f5c\u5b9e\u9645\u4e0a\u662f\u5728\u6267\u884c\u51fa\u6808\u3002\u5982\u679c\u8981\u540c\u65f6\u652f\u6301\u540e\u9000\u548c\u524d\u8fdb\uff0c\u90a3\u4e48\u5219\u9700\u8981\u4e24\u4e2a\u6808\u6765\u914d\u5408\u5b9e\u73b0\u3002
  • \u7a0b\u5e8f\u5185\u5b58\u7ba1\u7406\u3002\u6bcf\u5f53\u8c03\u7528\u51fd\u6570\u65f6\uff0c\u7cfb\u7edf\u5c31\u4f1a\u5728\u6808\u9876\u6dfb\u52a0\u4e00\u4e2a\u6808\u5e27\uff0c\u7528\u6765\u8bb0\u5f55\u51fd\u6570\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002\u5728\u9012\u5f52\u51fd\u6570\u4e2d\uff0c\u5411\u4e0b\u9012\u63a8\u4f1a\u4e0d\u65ad\u6267\u884c\u5165\u6808\uff0c\u5411\u4e0a\u56de\u6eaf\u9636\u6bb5\u65f6\u51fa\u6808\u3002
"},{"location":"chapter_stack_and_queue/summary/","title":"5.4. \u00a0 \u5c0f\u7ed3","text":"
  • \u6808\u662f\u4e00\u79cd\u9075\u5faa\u5148\u5165\u540e\u51fa\u7684\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6216\u94fe\u8868\u5b9e\u73b0\u3002
  • \u5728\u65f6\u95f4\u6548\u7387\u65b9\u9762\uff0c\u6808\u7684\u6570\u7ec4\u5b9e\u73b0\u5177\u6709\u66f4\u597d\u7684\u5e73\u5747\u6548\u7387\uff0c\u4f46\u6269\u5bb9\u65f6\u4f1a\u5bfc\u81f4\u5355\u6b21\u5165\u6808\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \u3002\u76f8\u5bf9\u5730\uff0c\u6808\u7684\u94fe\u8868\u5b9e\u73b0\u5177\u6709\u66f4\u52a0\u7a33\u5b9a\u7684\u6548\u7387\u8868\u73b0\u3002
  • \u5728\u7a7a\u95f4\u6548\u7387\u65b9\u9762\uff0c\u6808\u7684\u6570\u7ec4\u5b9e\u73b0\u4f1a\u9020\u6210\u4e00\u5b9a\u7a7a\u95f4\u6d6a\u8d39\uff0c\u7136\u800c\u94fe\u8868\u7ed3\u70b9\u6bd4\u6570\u7ec4\u5143\u7d20\u5360\u7528\u5185\u5b58\u66f4\u5927\u3002
  • \u961f\u5217\u662f\u4e00\u79cd\u9075\u5faa\u5148\u5165\u5148\u51fa\u7684\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6216\u94fe\u8868\u5b9e\u73b0\u3002\u5bf9\u4e8e\u4e24\u79cd\u5b9e\u73b0\u7684\u65f6\u95f4\u6548\u7387\u4e0e\u7a7a\u95f4\u6548\u7387\u5bf9\u6bd4\uff0c\u4e0e\u4e0a\u8ff0\u6808\u7684\u7ed3\u8bba\u76f8\u540c\u3002
  • \u53cc\u5411\u961f\u5217\u7684\u4e24\u7aef\u90fd\u53ef\u4ee5\u6dfb\u52a0\u4e0e\u5220\u9664\u5143\u7d20\u3002
"},{"location":"chapter_tree/avl_tree/","title":"7.4. \u00a0 AVL \u6811 *","text":"

\u5728\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u7ae0\u8282\u4e2d\u63d0\u5230\uff0c\u5728\u8fdb\u884c\u591a\u6b21\u63d2\u5165\u4e0e\u5220\u9664\u64cd\u4f5c\u540e\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u53ef\u80fd\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\u3002\u6b64\u65f6\u6240\u6709\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u4f1a\u7531 \\(O(\\log n)\\) \u52a3\u5316\u81f3 \\(O(n)\\) \u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u6267\u884c\u4e24\u6b65\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u8be5\u4e8c\u53c9\u641c\u7d22\u6811\u5c31\u4f1a\u9000\u5316\u4e3a\u94fe\u8868\u3002

Fig. AVL \u6811\u5728\u5220\u9664\u7ed3\u70b9\u540e\u53d1\u751f\u9000\u5316

\u518d\u6bd4\u5982\uff0c\u5728\u4ee5\u4e0b\u5b8c\u7f8e\u4e8c\u53c9\u6811\u4e2d\u63d2\u5165\u4e24\u4e2a\u7ed3\u70b9\u540e\uff0c\u6811\u4e25\u91cd\u5411\u5de6\u504f\u659c\uff0c\u67e5\u627e\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u968f\u4e4b\u53d1\u751f\u52a3\u5316\u3002

Fig. AVL \u6811\u5728\u63d2\u5165\u7ed3\u70b9\u540e\u53d1\u751f\u9000\u5316

G. M. Adelson-Velsky \u548c E. M. Landis \u5728\u5176 1962 \u5e74\u53d1\u8868\u7684\u8bba\u6587 \"An algorithm for the organization of information\" \u4e2d\u63d0\u51fa\u4e86\u300cAVL \u6811\u300d\u3002\u8bba\u6587\u4e2d\u63cf\u8ff0\u4e86\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u4f7f\u5f97\u5728\u4e0d\u65ad\u6dfb\u52a0\u4e0e\u5220\u9664\u7ed3\u70b9\u540e\uff0cAVL \u6811\u4ecd\u7136\u4e0d\u4f1a\u53d1\u751f\u9000\u5316\uff0c\u8fdb\u800c\u4f7f\u5f97\u5404\u79cd\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5747\u80fd\u4fdd\u6301\u5728 \\(O(\\log n)\\) \u7ea7\u522b\u3002

\u6362\u8a00\u4e4b\uff0c\u5728\u9891\u7e41\u589e\u5220\u67e5\u6539\u7684\u4f7f\u7528\u573a\u666f\u4e2d\uff0cAVL \u6811\u53ef\u59cb\u7ec8\u4fdd\u6301\u5f88\u9ad8\u7684\u6570\u636e\u589e\u5220\u67e5\u6539\u6548\u7387\uff0c\u5177\u6709\u5f88\u597d\u7684\u5e94\u7528\u4ef7\u503c\u3002

"},{"location":"chapter_tree/avl_tree/#741-avl","title":"7.4.1. \u00a0 AVL \u6811\u5e38\u89c1\u672f\u8bed","text":"

\u300cAVL \u6811\u300d\u65e2\u662f\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u53c8\u662f\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\uff0c\u540c\u65f6\u6ee1\u8db3\u8fd9\u4e24\u79cd\u4e8c\u53c9\u6811\u7684\u6240\u6709\u6027\u8d28\uff0c\u56e0\u6b64\u53c8\u88ab\u79f0\u4e3a\u300c\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u3002

"},{"location":"chapter_tree/avl_tree/#_1","title":"\u7ed3\u70b9\u9ad8\u5ea6","text":"

\u5728 AVL \u6811\u7684\u64cd\u4f5c\u4e2d\uff0c\u9700\u8981\u83b7\u53d6\u7ed3\u70b9\u300c\u9ad8\u5ea6 Height\u300d\uff0c\u6240\u4ee5\u7ed9 AVL \u6811\u7684\u7ed3\u70b9\u7c7b\u6dfb\u52a0 height \u53d8\u91cf\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\npublic int val;        // \u7ed3\u70b9\u503c\npublic int height;     // \u7ed3\u70b9\u9ad8\u5ea6\npublic TreeNode left;  // \u5de6\u5b50\u7ed3\u70b9\npublic TreeNode right; // \u53f3\u5b50\u7ed3\u70b9\npublic TreeNode(int x) { val = x; }\n}\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nstruct TreeNode {\nint val{};          // \u7ed3\u70b9\u503c\nint height = 0;     // \u7ed3\u70b9\u9ad8\u5ea6\nTreeNode *left{};   // \u5de6\u5b50\u7ed3\u70b9\nTreeNode *right{};  // \u53f3\u5b50\u7ed3\u70b9\nTreeNode() = default;\nexplicit TreeNode(int x) : val(x){}\n};\n
\"\"\" AVL \u6811\u7ed3\u70b9\u7c7b \"\"\"\nclass TreeNode:\ndef __init__(self, val: int):\nself.val: int = val                    # \u7ed3\u70b9\u503c\nself.height: int = 0                   # \u7ed3\u70b9\u9ad8\u5ea6\nself.left: Optional[TreeNode] = None   # \u5de6\u5b50\u7ed3\u70b9\u5f15\u7528\nself.right: Optional[TreeNode] = None  # \u53f3\u5b50\u7ed3\u70b9\u5f15\u7528\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\ntype TreeNode struct {\nVal    int       // \u7ed3\u70b9\u503c\nHeight int       // \u7ed3\u70b9\u9ad8\u5ea6\nLeft   *TreeNode // \u5de6\u5b50\u7ed3\u70b9\u5f15\u7528\nRight  *TreeNode // \u53f3\u5b50\u7ed3\u70b9\u5f15\u7528\n}\n
class TreeNode {\nval; // \u7ed3\u70b9\u503c\nheight; //\u7ed3\u70b9\u9ad8\u5ea6\nleft; // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nright; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nconstructor(val, left, right, height) {\nthis.val = val === undefined ? 0 : val;\nthis.height = height === undefined ? 0 : height;\nthis.left = left === undefined ? null : left;\nthis.right = right === undefined ? null : right;\n}\n}\n
class TreeNode {\nval: number;            // \u7ed3\u70b9\u503c\nheight: number;         // \u7ed3\u70b9\u9ad8\u5ea6\nleft: TreeNode | null;  // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nright: TreeNode | null; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nconstructor(val?: number, height?: number, left?: TreeNode | null, right?: TreeNode | null) {\nthis.val = val === undefined ? 0 : val;\nthis.height = height === undefined ? 0 : height; this.left = left === undefined ? null : left; this.right = right === undefined ? null : right; }\n}\n
\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\npublic int val;          // \u7ed3\u70b9\u503c\npublic int height;       // \u7ed3\u70b9\u9ad8\u5ea6\npublic TreeNode? left;   // \u5de6\u5b50\u7ed3\u70b9\npublic TreeNode? right;  // \u53f3\u5b50\u7ed3\u70b9\npublic TreeNode(int x) { val = x; }\n}\n
/* AVL \u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar height: Int // \u7ed3\u70b9\u9ad8\u5ea6\nvar left: TreeNode? // \u5de6\u5b50\u7ed3\u70b9\nvar right: TreeNode? // \u53f3\u5b50\u7ed3\u70b9\ninit(x: Int) {\nval = x\nheight = 0\n}\n}\n
\n

\u300c\u7ed3\u70b9\u9ad8\u5ea6\u300d\u662f\u6700\u8fdc\u53f6\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u7684\u8ddd\u79bb\uff0c\u5373\u8d70\u8fc7\u7684\u300c\u8fb9\u300d\u7684\u6570\u91cf\u3002\u9700\u8981\u7279\u522b\u6ce8\u610f\uff0c\u53f6\u7ed3\u70b9\u7684\u9ad8\u5ea6\u4e3a 0 \uff0c\u7a7a\u7ed3\u70b9\u7684\u9ad8\u5ea6\u4e3a -1\u3002\u6211\u4eec\u5c01\u88c5\u4e24\u4e2a\u5de5\u5177\u51fd\u6570\uff0c\u5206\u522b\u7528\u4e8e\u83b7\u53d6\u4e0e\u66f4\u65b0\u7ed3\u70b9\u7684\u9ad8\u5ea6\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(height(node.left), height(node.right)) + 1;\n}\n
avl_tree.cpp
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode* node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == nullptr ? -1 : node->height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode* node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode->height = max(height(node->left), height(node->right)) + 1;\n}\n
avl_tree.py
def height(self, node: Optional[TreeNode]) -> int:\n\"\"\" \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 \"\"\"\n# \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nif node is not None:\nreturn node.height\nreturn -1\ndef __update_height(self, node: Optional[TreeNode]):\n\"\"\" \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 \"\"\"\n# \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = max([self.height(node.left), self.height(node.right)]) + 1\n
avl_tree.go
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc (t *aVLTree) height(node *TreeNode) int {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nif node != nil {\nreturn node.Height\n}\nreturn -1\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc (t *aVLTree) updateHeight(node *TreeNode) {\nlh := t.height(node.Left)\nrh := t.height(node.Right)\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nif lh > rh {\nnode.Height = lh + 1\n} else {\nnode.Height = rh + 1\n}\n}\n
avl_tree.js
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nheight(node) {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node === null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\n#updateHeight(node) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(this.height(node.left), this.height(node.right)) + 1;\n}\n
avl_tree.ts
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nheight(node: TreeNode): number {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node === null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nupdateHeight(node: TreeNode): void {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.max(this.height(node.left), this.height(node.right)) + 1;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{height}\n[class]{aVLTree}-[func]{updateHeight}\n
avl_tree.cs
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nint height(TreeNode? node)\n{\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn node == null ? -1 : node.height;\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nvoid updateHeight(TreeNode node)\n{\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.height = Math.Max(height(node.left), height(node.right)) + 1;\n}\n
avl_tree.swift
/* \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc height(node: TreeNode?) -> Int {\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nnode == nil ? -1 : node!.height\n}\n/* \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6 */\nfunc updateHeight(node: TreeNode?) {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode?.height = max(height(node: node?.left), height(node: node?.right)) + 1\n}\n
avl_tree.zig
// \u83b7\u53d6\u7ed3\u70b9\u9ad8\u5ea6\nfn height(self: *Self, node: ?*inc.TreeNode(T)) i32 {\n_ = self;\n// \u7a7a\u7ed3\u70b9\u9ad8\u5ea6\u4e3a -1 \uff0c\u53f6\u7ed3\u70b9\u9ad8\u5ea6\u4e3a 0\nreturn if (node == null) -1 else node.?.height;\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nfn updateHeight(self: *Self, node: ?*inc.TreeNode(T)) void {\n// \u7ed3\u70b9\u9ad8\u5ea6\u7b49\u4e8e\u6700\u9ad8\u5b50\u6811\u9ad8\u5ea6 + 1\nnode.?.height = std.math.max(self.height(node.?.left), self.height(node.?.right)) + 1;\n}\n
"},{"location":"chapter_tree/avl_tree/#_2","title":"\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50","text":"

\u7ed3\u70b9\u7684\u300c\u5e73\u8861\u56e0\u5b50 Balance Factor\u300d\u662f \u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u51cf\u53bb\u53f3\u5b50\u6811\u9ad8\u5ea6\uff0c\u5e76\u5b9a\u4e49\u7a7a\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u4e3a 0 \u3002\u540c\u6837\u5730\uff0c\u6211\u4eec\u5c06\u83b7\u53d6\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u5c01\u88c5\u6210\u51fd\u6570\uff0c\u4ee5\u4fbf\u540e\u7eed\u4f7f\u7528\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node.left) - height(node.right);\n}\n
avl_tree.cpp
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode* node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == nullptr) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node->left) - height(node->right);\n}\n
avl_tree.py
def balance_factor(self, node: Optional[TreeNode]) -> int:\n\"\"\" \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 \"\"\"\n# \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif node is None:\nreturn 0\n# \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn self.height(node.left) - self.height(node.right)\n
avl_tree.go
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nfunc (t *aVLTree) balanceFactor(node *TreeNode) int {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif node == nil {\nreturn 0\n}\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn t.height(node.Left) - t.height(node.Right)\n}\n
avl_tree.js
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nbalanceFactor(node) {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node === null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn this.height(node.left) - this.height(node.right);\n}\n
avl_tree.ts
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nbalanceFactor(node: TreeNode): number {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node === null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn this.height(node.left) - this.height(node.right);\n}\n
avl_tree.c
[class]{aVLTree}-[func]{balanceFactor}\n
avl_tree.cs
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nint balanceFactor(TreeNode? node)\n{\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node.left) - height(node.right);\n}\n
avl_tree.swift
/* \u83b7\u53d6\u5e73\u8861\u56e0\u5b50 */\nfunc balanceFactor(node: TreeNode?) -> Int {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nguard let node = node else { return 0 }\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn height(node: node.left) - height(node: node.right)\n}\n
avl_tree.zig
// \u83b7\u53d6\u5e73\u8861\u56e0\u5b50\nfn balanceFactor(self: *Self, node: ?*inc.TreeNode(T)) i32 {\n// \u7a7a\u7ed3\u70b9\u5e73\u8861\u56e0\u5b50\u4e3a 0\nif (node == null) return 0;\n// \u7ed3\u70b9\u5e73\u8861\u56e0\u5b50 = \u5de6\u5b50\u6811\u9ad8\u5ea6 - \u53f3\u5b50\u6811\u9ad8\u5ea6\nreturn self.height(node.?.left) - self.height(node.?.right);\n}\n

Note

\u8bbe\u5e73\u8861\u56e0\u5b50\u4e3a \\(f\\) \uff0c\u5219\u4e00\u68f5 AVL \u6811\u7684\u4efb\u610f\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u7686\u6ee1\u8db3 \\(-1 \\le f \\le 1\\) \u3002

"},{"location":"chapter_tree/avl_tree/#742-avl","title":"7.4.2. \u00a0 AVL \u6811\u65cb\u8f6c","text":"

AVL \u6811\u7684\u72ec\u7279\u4e4b\u5904\u5728\u4e8e\u300c\u65cb\u8f6c Rotation\u300d\u7684\u64cd\u4f5c\uff0c\u5176\u53ef \u5728\u4e0d\u5f71\u54cd\u4e8c\u53c9\u6811\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u524d\u63d0\u4e0b\uff0c\u4f7f\u5931\u8861\u7ed3\u70b9\u91cd\u65b0\u6062\u590d\u5e73\u8861\u3002\u6362\u8a00\u4e4b\uff0c\u65cb\u8f6c\u64cd\u4f5c\u65e2\u53ef\u4ee5\u4f7f\u6811\u4fdd\u6301\u4e3a\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u6811\u91cd\u65b0\u6062\u590d\u4e3a\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\u3002

\u6211\u4eec\u5c06\u5e73\u8861\u56e0\u5b50\u7684\u7edd\u5bf9\u503c \\(> 1\\) \u7684\u7ed3\u70b9\u79f0\u4e3a\u300c\u5931\u8861\u7ed3\u70b9\u300d\u3002\u6839\u636e\u7ed3\u70b9\u7684\u5931\u8861\u60c5\u51b5\uff0c\u65cb\u8f6c\u64cd\u4f5c\u5206\u4e3a \u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u3001\u5148\u5de6\u65cb\u540e\u53f3\u65cb\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u4e00\u8d77\u6765\u770b\u770b\u5b83\u4eec\u662f\u5982\u4f55\u64cd\u4f5c\u7684\u3002

"},{"location":"chapter_tree/avl_tree/#case-1-","title":"Case 1 - \u53f3\u65cb","text":"

\u5982\u4e0b\u56fe\u6240\u793a\uff08\u7ed3\u70b9\u4e0b\u65b9\u4e3a\u300c\u5e73\u8861\u56e0\u5b50\u300d\uff09\uff0c\u4ece\u5e95\u81f3\u9876\u770b\uff0c\u4e8c\u53c9\u6811\u4e2d\u9996\u4e2a\u5931\u8861\u7ed3\u70b9\u662f \u7ed3\u70b9 3\u3002\u6211\u4eec\u805a\u7126\u5728\u4ee5\u8be5\u5931\u8861\u7ed3\u70b9\u4e3a\u6839\u7ed3\u70b9\u7684\u5b50\u6811\u4e0a\uff0c\u5c06\u8be5\u7ed3\u70b9\u8bb0\u4e3a node \uff0c\u5c06\u5176\u5de6\u5b50\u7ed3\u70b9\u8bb0\u4e3a child \uff0c\u6267\u884c\u300c\u53f3\u65cb\u300d\u64cd\u4f5c\u3002\u5b8c\u6210\u53f3\u65cb\u540e\uff0c\u8be5\u5b50\u6811\u5df2\u7ecf\u6062\u590d\u5e73\u8861\uff0c\u5e76\u4e14\u4ecd\u7136\u4e3a\u4e8c\u53c9\u641c\u7d22\u6811\u3002

<1><2><3><4>

\u8fdb\u800c\uff0c\u5982\u679c\u7ed3\u70b9 child \u672c\u8eab\u6709\u53f3\u5b50\u7ed3\u70b9\uff08\u8bb0\u4e3a grandChild \uff09\uff0c\u5219\u9700\u8981\u5728\u300c\u53f3\u65cb\u300d\u4e2d\u6dfb\u52a0\u4e00\u6b65\uff1a\u5c06 grandChild \u4f5c\u4e3a node \u7684\u5de6\u5b50\u7ed3\u70b9\u3002

Fig. \u6709 grandChild \u7684\u53f3\u65cb\u64cd\u4f5c

\u201c\u5411\u53f3\u65cb\u8f6c\u201d\u662f\u4e00\u79cd\u5f62\u8c61\u5316\u7684\u8bf4\u6cd5\uff0c\u5b9e\u9645\u9700\u8981\u901a\u8fc7\u4fee\u6539\u7ed3\u70b9\u6307\u9488\u5b9e\u73b0\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode rightRotate(TreeNode node) {\nTreeNode child = node.left;\nTreeNode grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.cpp
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode* rightRotate(TreeNode* node) {\nTreeNode* child = node->left;\nTreeNode* grandChild = child->right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild->right = node;\nnode->left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.py
def __right_rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u53f3\u65cb\u64cd\u4f5c \"\"\"\nchild = node.left\ngrand_child = child.right\n# \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node\nnode.left = grand_child\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\nself.__update_height(child)\n# \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n
avl_tree.go
/* \u53f3\u65cb\u64cd\u4f5c */\nfunc (t *aVLTree) rightRotate(node *TreeNode) *TreeNode {\nchild := node.Left\ngrandChild := child.Right\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.Right = node\nnode.Left = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\nt.updateHeight(child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.js
/* \u53f3\u65cb\u64cd\u4f5c */\n#rightRotate(node) {\nconst child = node.left;\nconst grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.#updateHeight(node);\nthis.#updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.ts
/* \u53f3\u65cb\u64cd\u4f5c */\nrightRotate(node: TreeNode): TreeNode {\nconst child = node.left;\nconst grandChild = child.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.updateHeight(node);\nthis.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{rightRotate}\n
avl_tree.cs
/* \u53f3\u65cb\u64cd\u4f5c */\nTreeNode? rightRotate(TreeNode? node)\n{\nTreeNode? child = node.left;\nTreeNode? grandChild = child?.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.right = node;\nnode.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.swift
/* \u53f3\u65cb\u64cd\u4f5c */\nfunc rightRotate(node: TreeNode?) -> TreeNode? {\nlet child = node?.left\nlet grandChild = child?.right\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild?.right = node\nnode?.left = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node: node)\nupdateHeight(node: child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.zig
// \u53f3\u65cb\u64cd\u4f5c\nfn rightRotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\nvar child = node.?.left;\nvar grandChild = child.?.right;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u53f3\u65cb\u8f6c\nchild.?.right = node;\nnode.?.left = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.updateHeight(node);\nself.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
"},{"location":"chapter_tree/avl_tree/#case-2-","title":"Case 2 - \u5de6\u65cb","text":"

\u7c7b\u4f3c\u5730\uff0c\u5982\u679c\u5c06\u53d6\u4e0a\u8ff0\u5931\u8861\u4e8c\u53c9\u6811\u7684\u201c\u955c\u50cf\u201d\uff0c\u90a3\u4e48\u5219\u9700\u8981\u300c\u5de6\u65cb\u300d\u64cd\u4f5c\u3002

Fig. \u5de6\u65cb\u64cd\u4f5c

\u540c\u7406\uff0c\u82e5\u7ed3\u70b9 child \u672c\u8eab\u6709\u5de6\u5b50\u7ed3\u70b9\uff08\u8bb0\u4e3a grandChild \uff09\uff0c\u5219\u9700\u8981\u5728\u300c\u5de6\u65cb\u300d\u4e2d\u6dfb\u52a0\u4e00\u6b65\uff1a\u5c06 grandChild \u4f5c\u4e3a node \u7684\u53f3\u5b50\u7ed3\u70b9\u3002

Fig. \u6709 grandChild \u7684\u5de6\u65cb\u64cd\u4f5c

\u89c2\u5bdf\u53d1\u73b0\uff0c\u300c\u5de6\u65cb\u300d\u548c\u300c\u53f3\u65cb\u300d\u64cd\u4f5c\u662f\u955c\u50cf\u5bf9\u79f0\u7684\uff0c\u4e24\u8005\u5bf9\u5e94\u89e3\u51b3\u7684\u4e24\u79cd\u5931\u8861\u60c5\u51b5\u4e5f\u662f\u5bf9\u79f0\u7684\u3002\u6839\u636e\u5bf9\u79f0\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4ece\u300c\u53f3\u65cb\u300d\u63a8\u5bfc\u51fa\u300c\u5de6\u65cb\u300d\u3002\u5177\u4f53\u5730\uff0c\u53ea\u9700\u5c06\u300c\u53f3\u65cb\u300d\u4ee3\u7801\u4e2d\u7684\u628a\u6240\u6709\u7684 left \u66ff\u6362\u4e3a right \u3001\u6240\u6709\u7684 right \u66ff\u6362\u4e3a left \uff0c\u5373\u53ef\u5f97\u5230\u300c\u5de6\u65cb\u300d\u4ee3\u7801\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode leftRotate(TreeNode node) {\nTreeNode child = node.right;\nTreeNode grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.cpp
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode* leftRotate(TreeNode* node) {\nTreeNode* child = node->right;\nTreeNode* grandChild = child->left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild->left = node;\nnode->right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.py
def __left_rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u5de6\u65cb\u64cd\u4f5c \"\"\"\nchild = node.right\ngrand_child = child.left\n# \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node\nnode.right = grand_child\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\nself.__update_height(child)\n# \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n
avl_tree.go
/* \u5de6\u65cb\u64cd\u4f5c */\nfunc (t *aVLTree) leftRotate(node *TreeNode) *TreeNode {\nchild := node.Right\ngrandChild := child.Left\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.Left = node\nnode.Right = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\nt.updateHeight(child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.js
/* \u5de6\u65cb\u64cd\u4f5c */\n#leftRotate(node) {\nconst child = node.right;\nconst grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.#updateHeight(node);\nthis.#updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.ts
/* \u5de6\u65cb\u64cd\u4f5c */\nleftRotate(node: TreeNode): TreeNode {\nconst child = node.right;\nconst grandChild = child.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nthis.updateHeight(node);\nthis.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{leftRotate}\n
avl_tree.cs
/* \u5de6\u65cb\u64cd\u4f5c */\nTreeNode? leftRotate(TreeNode? node)\n{\nTreeNode? child = node.right;\nTreeNode? grandChild = child?.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.left = node;\nnode.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node);\nupdateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
avl_tree.swift
/* \u5de6\u65cb\u64cd\u4f5c */\nfunc leftRotate(node: TreeNode?) -> TreeNode? {\nlet child = node?.right\nlet grandChild = child?.left\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild?.left = node\nnode?.right = grandChild\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nupdateHeight(node: node)\nupdateHeight(node: child)\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child\n}\n
avl_tree.zig
// \u5de6\u65cb\u64cd\u4f5c\nfn leftRotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\nvar child = node.?.right;\nvar grandChild = child.?.left;\n// \u4ee5 child \u4e3a\u539f\u70b9\uff0c\u5c06 node \u5411\u5de6\u65cb\u8f6c\nchild.?.left = node;\nnode.?.right = grandChild;\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.updateHeight(node);\nself.updateHeight(child);\n// \u8fd4\u56de\u65cb\u8f6c\u540e\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn child;\n}\n
"},{"location":"chapter_tree/avl_tree/#case-3-","title":"Case 3 - \u5148\u5de6\u540e\u53f3","text":"

\u5bf9\u4e8e\u4e0b\u56fe\u7684\u5931\u8861\u7ed3\u70b9 3 \uff0c\u5355\u4e00\u4f7f\u7528\u5de6\u65cb\u6216\u53f3\u65cb\u90fd\u65e0\u6cd5\u4f7f\u5b50\u6811\u6062\u590d\u5e73\u8861\uff0c\u6b64\u65f6\u9700\u8981\u300c\u5148\u5de6\u65cb\u540e\u53f3\u65cb\u300d\uff0c\u5373\u5148\u5bf9 child \u6267\u884c\u300c\u5de6\u65cb\u300d\uff0c\u518d\u5bf9 node \u6267\u884c\u300c\u53f3\u65cb\u300d\u3002

Fig. \u5148\u5de6\u65cb\u540e\u53f3\u65cb

"},{"location":"chapter_tree/avl_tree/#case-4-","title":"Case 4 - \u5148\u53f3\u540e\u5de6","text":"

\u540c\u7406\uff0c\u53d6\u4ee5\u4e0a\u5931\u8861\u4e8c\u53c9\u6811\u7684\u955c\u50cf\uff0c\u5219\u9700\u8981\u300c\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u300d\uff0c\u5373\u5148\u5bf9 child \u6267\u884c\u300c\u53f3\u65cb\u300d\uff0c\u7136\u540e\u5bf9 node \u6267\u884c\u300c\u5de6\u65cb\u300d\u3002

Fig. \u5148\u53f3\u65cb\u540e\u5de6\u65cb

"},{"location":"chapter_tree/avl_tree/#_3","title":"\u65cb\u8f6c\u7684\u9009\u62e9","text":"

\u4e0b\u56fe\u63cf\u8ff0\u7684\u56db\u79cd\u5931\u8861\u60c5\u51b5\u4e0e\u4e0a\u8ff0 Cases \u9010\u4e2a\u5bf9\u5e94\uff0c\u5206\u522b\u9700\u91c7\u7528 \u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u540e\u5de6\u3001\u5148\u5de6\u540e\u53f3 \u7684\u65cb\u8f6c\u64cd\u4f5c\u3002

Fig. AVL \u6811\u7684\u56db\u79cd\u65cb\u8f6c\u60c5\u51b5

\u5177\u4f53\u5730\uff0c\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528 \u5931\u8861\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u3001\u8f83\u9ad8\u4e00\u4fa7\u5b50\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u6765\u786e\u5b9a\u5931\u8861\u7ed3\u70b9\u5c5e\u4e8e\u4e0a\u56fe\u4e2d\u7684\u54ea\u79cd\u60c5\u51b5\u3002

\u5931\u8861\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u5b50\u7ed3\u70b9\u7684\u5e73\u8861\u56e0\u5b50 \u5e94\u91c7\u7528\u7684\u65cb\u8f6c\u65b9\u6cd5 \\(>0\\) \uff08\u5373\u5de6\u504f\u6811\uff09 \\(\\geq 0\\) \u53f3\u65cb \\(>0\\) \uff08\u5373\u5de6\u504f\u6811\uff09 \\(<0\\) \u5148\u5de6\u65cb\u540e\u53f3\u65cb \\(<0\\) \uff08\u5373\u53f3\u504f\u6811\uff09 \\(\\leq 0\\) \u5de6\u65cb \\(<0\\) \uff08\u5373\u53f3\u504f\u6811\uff09 \\(>0\\) \u5148\u53f3\u65cb\u540e\u5de6\u65cb

\u4e3a\u65b9\u4fbf\u4f7f\u7528\uff0c\u6211\u4eec\u5c06\u65cb\u8f6c\u64cd\u4f5c\u5c01\u88c5\u6210\u4e00\u4e2a\u51fd\u6570\u3002\u81f3\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6b64\u51fd\u6570\u6765\u65cb\u8f6c\u5404\u79cd\u5931\u8861\u60c5\u51b5\uff0c\u4f7f\u5931\u8861\u7ed3\u70b9\u91cd\u65b0\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode rotate(TreeNode node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint balanceFactor = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = leftRotate(node.left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = rightRotate(node.right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.cpp
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode* rotate(TreeNode* node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint _balanceFactor = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (_balanceFactor > 1) {\nif (balanceFactor(node->left) >= 0) {\n// \u53f3\u65cb\nreturn rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode->left = leftRotate(node->left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (_balanceFactor < -1) {\nif (balanceFactor(node->right) <= 0) {\n// \u5de6\u65cb\nreturn leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode->right = rightRotate(node->right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.py
def __rotate(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 \"\"\"\n# \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nbalance_factor = self.balance_factor(node)\n# \u5de6\u504f\u6811\nif balance_factor > 1:\nif self.balance_factor(node.left) >= 0:\n# \u53f3\u65cb\nreturn self.__right_rotate(node)\nelse:\n# \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = self.__left_rotate(node.left)\nreturn self.__right_rotate(node)\n# \u53f3\u504f\u6811\nelif balance_factor < -1:\nif self.balance_factor(node.right) <= 0:\n# \u5de6\u65cb\nreturn self.__left_rotate(node)\nelse:\n# \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = self.__right_rotate(node.right)\nreturn self.__left_rotate(node)\n# \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n
avl_tree.go
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nfunc (t *aVLTree) rotate(node *TreeNode) *TreeNode {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\n// Go \u63a8\u8350\u77ed\u53d8\u91cf\uff0c\u8fd9\u91cc bf \u6307\u4ee3 t.balanceFactor\nbf := t.balanceFactor(node)\n// \u5de6\u504f\u6811\nif bf > 1 {\nif t.balanceFactor(node.Left) >= 0 {\n// \u53f3\u65cb\nreturn t.rightRotate(node)\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.Left = t.leftRotate(node.Left)\nreturn t.rightRotate(node)\n}\n}\n// \u53f3\u504f\u6811\nif bf < -1 {\nif t.balanceFactor(node.Right) <= 0 {\n// \u5de6\u65cb\nreturn t.leftRotate(node)\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.Right = t.rightRotate(node.Right)\nreturn t.leftRotate(node)\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n
avl_tree.js
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\n#rotate(node) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nconst balanceFactor = this.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (this.balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn this.#rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = this.#leftRotate(node.left);\nreturn this.#rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (this.balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn this.#leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = this.#rightRotate(node.right);\nreturn this.#leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.ts
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nrotate(node: TreeNode): TreeNode {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nconst balanceFactor = this.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactor > 1) {\nif (this.balanceFactor(node.left) >= 0) {\n// \u53f3\u65cb\nreturn this.rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = this.leftRotate(node.left);\nreturn this.rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactor < -1) {\nif (this.balanceFactor(node.right) <= 0) {\n// \u5de6\u65cb\nreturn this.leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = this.rightRotate(node.right);\nreturn this.leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{rotate}\n
avl_tree.cs
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nTreeNode? rotate(TreeNode? node)\n{\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nint balanceFactorInt = balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balanceFactorInt > 1)\n{\nif (balanceFactor(node.left) >= 0)\n{\n// \u53f3\u65cb\nreturn rightRotate(node);\n}\nelse\n{\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.left = leftRotate(node?.left);\nreturn rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balanceFactorInt < -1)\n{\nif (balanceFactor(node.right) <= 0)\n{\n// \u5de6\u65cb\nreturn leftRotate(node);\n}\nelse\n{\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.right = rightRotate(node?.right);\nreturn leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
avl_tree.swift
/* \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nfunc rotate(node: TreeNode?) -> TreeNode? {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nlet balanceFactor = balanceFactor(node: node)\n// \u5de6\u504f\u6811\nif balanceFactor > 1 {\nif self.balanceFactor(node: node?.left) >= 0 {\n// \u53f3\u65cb\nreturn rightRotate(node: node)\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode?.left = leftRotate(node: node?.left)\nreturn rightRotate(node: node)\n}\n}\n// \u53f3\u504f\u6811\nif balanceFactor < -1 {\nif self.balanceFactor(node: node?.right) <= 0 {\n// \u5de6\u65cb\nreturn leftRotate(node: node)\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode?.right = rightRotate(node: node?.right)\nreturn leftRotate(node: node)\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n
avl_tree.zig
// \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nfn rotate(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n// \u83b7\u53d6\u7ed3\u70b9 node \u7684\u5e73\u8861\u56e0\u5b50\nvar balance_factor = self.balanceFactor(node);\n// \u5de6\u504f\u6811\nif (balance_factor > 1) {\nif (self.balanceFactor(node.?.left) >= 0) {\n// \u53f3\u65cb\nreturn self.rightRotate(node);\n} else {\n// \u5148\u5de6\u65cb\u540e\u53f3\u65cb\nnode.?.left = self.leftRotate(node.?.left);\nreturn self.rightRotate(node);\n}\n}\n// \u53f3\u504f\u6811\nif (balance_factor < -1) {\nif (self.balanceFactor(node.?.right) <= 0) {\n// \u5de6\u65cb\nreturn self.leftRotate(node);\n} else {\n// \u5148\u53f3\u65cb\u540e\u5de6\u65cb\nnode.?.right = self.rightRotate(node.?.right);\nreturn self.leftRotate(node);\n}\n}\n// \u5e73\u8861\u6811\uff0c\u65e0\u9700\u65cb\u8f6c\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#743-avl","title":"7.4.3. \u00a0 AVL \u6811\u5e38\u7528\u64cd\u4f5c","text":""},{"location":"chapter_tree/avl_tree/#_4","title":"\u63d2\u5165\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u7684\u7ed3\u70b9\u63d2\u5165\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u4e3b\u4f53\u7c7b\u4f3c\u3002\u4e0d\u540c\u7684\u662f\uff0c\u5728\u63d2\u5165\u7ed3\u70b9\u540e\uff0c\u4ece\u8be5\u7ed3\u70b9\u5230\u6839\u7ed3\u70b9\u7684\u8def\u5f84\u4e0a\u4f1a\u51fa\u73b0\u4e00\u7cfb\u5217\u300c\u5931\u8861\u7ed3\u70b9\u300d\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u9700\u8981\u4ece\u8be5\u7ed3\u70b9\u5f00\u59cb\uff0c\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6240\u6709\u5931\u8861\u7ed3\u70b9\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode insert(int val) {\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode insertHelper(TreeNode node, int val) {\nif (node == null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val)\nnode.left = insertHelper(node.left, val);\nelse if (val > node.val)\nnode.right = insertHelper(node.right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.cpp
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode* insert(int val) {\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode* insertHelper(TreeNode* node, int val) {\nif (node == nullptr) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node->val)\nnode->left = insertHelper(node->left, val);\nelse if (val > node->val)\nnode->right = insertHelper(node->right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.py
def insert(self, val) -> TreeNode:\n\"\"\" \u63d2\u5165\u7ed3\u70b9 \"\"\"\nself.__root = self.__insert_helper(self.__root, val)\nreturn self.__root\ndef __insert_helper(self, node: Optional[TreeNode], val: int) -> TreeNode:\n\"\"\" \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\"\"\"\nif node is None:\nreturn TreeNode(val)\n# 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9\nif val < node.val:\nnode.left = self.__insert_helper(node.left, val)\nelif val > node.val:\nnode.right = self.__insert_helper(node.right, val)\nelse:\n# \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\n# 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nreturn self.__rotate(node)\n
avl_tree.go
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc (t *aVLTree) insert(val int) *TreeNode {\nt.root = t.insertHelper(t.root, val)\nreturn t.root\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc (t *aVLTree) insertHelper(node *TreeNode, val int) *TreeNode {\nif node == nil {\nreturn NewTreeNode(val)\n}\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif val < node.Val {\nnode.Left = t.insertHelper(node.Left, val)\n} else if val > node.Val {\nnode.Right = t.insertHelper(node.Right, val)\n} else {\n// \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nreturn node\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = t.rotate(node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n
avl_tree.js
/* \u63d2\u5165\u7ed3\u70b9 */\ninsert(val) {\nthis.root = this.#insertHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\n#insertHelper(node, val) {\nif (node === null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val) node.left = this.#insertHelper(node.left, val);\nelse if (val > node.val) node.right = this.#insertHelper(node.right, val);\nelse return node; // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nthis.#updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.#rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.ts
/* \u63d2\u5165\u7ed3\u70b9 */\ninsert(val: number): TreeNode {\nthis.root = this.insertHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\ninsertHelper(node: TreeNode, val: number): TreeNode {\nif (node === null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val) {\nnode.left = this.insertHelper(node.left, val);\n} else if (val > node.val) {\nnode.right = this.insertHelper(node.right, val);\n} else {\nreturn node; // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nthis.updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{insert}\n[class]{aVLTree}-[func]{insertHelper}\n
avl_tree.cs
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode? insert(int val)\n{\nroot = insertHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode? insertHelper(TreeNode? node, int val)\n{\nif (node == null) return new TreeNode(val);\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif (val < node.val)\nnode.left = insertHelper(node.left, val);\nelse if (val > node.val)\nnode.right = insertHelper(node.right, val);\nelse\nreturn node;     // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
avl_tree.swift
/* \u63d2\u5165\u7ed3\u70b9 */\n@discardableResult\nfunc insert(val: Int) -> TreeNode? {\nroot = insertHelper(node: root, val: val)\nreturn root\n}\n/* \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc insertHelper(node: TreeNode?, val: Int) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn TreeNode(x: val)\n}\n/* 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9 */\nif val < node!.val {\nnode?.left = insertHelper(node: node?.left, val: val)\n} else if val > node!.val {\nnode?.right = insertHelper(node: node?.right, val: val)\n} else {\nreturn node // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nupdateHeight(node: node) // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node: node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n
avl_tree.zig
// \u63d2\u5165\u7ed3\u70b9\nfn insert(self: *Self, val: T) !?*inc.TreeNode(T) {\nself.root = try self.insertHelper(self.root, val);\nreturn self.root;\n}\n// \u9012\u5f52\u63d2\u5165\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\nfn insertHelper(self: *Self, node_: ?*inc.TreeNode(T), val: T) !?*inc.TreeNode(T) {\nvar node = node_;\nif (node == null) {\nvar tmp_node = try self.mem_allocator.create(inc.TreeNode(T));\ntmp_node.init(val);\nreturn tmp_node;\n}\n// 1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u5e76\u63d2\u5165\u7ed3\u70b9\nif (val < node.?.val) {\nnode.?.left = try self.insertHelper(node.?.left, val);\n} else if (val > node.?.val) {\nnode.?.right = try self.insertHelper(node.?.right, val);\n} else {\nreturn node;            // \u91cd\u590d\u7ed3\u70b9\u4e0d\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\n}\nself.updateHeight(node);    // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n// 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nnode = self.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#_5","title":"\u5220\u9664\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u603b\u4f53\u76f8\u540c\u3002\u7c7b\u4f3c\u5730\uff0c\u5728\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u4e5f\u9700\u8981\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6240\u6709\u5931\u8861\u7ed3\u70b9\u6062\u590d\u5e73\u8861\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig avl_tree.java
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode remove(int val) {\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode removeHelper(TreeNode node, int val) {\nif (node == null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val)\nnode.left = removeHelper(node.left, val);\nelse if (val > node.val)\nnode.right = removeHelper(node.right, val);\nelse {\nif (node.left == null || node.right == null) {\nTreeNode child = node.left != null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null)\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse\nnode = child;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode temp = getInOrderNext(node.right);\nnode.right = removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode getInOrderNext(TreeNode node) {\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left != null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.cpp
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode* remove(int val) {\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode* removeHelper(TreeNode* node, int val) {\nif (node == nullptr) return nullptr;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node->val)\nnode->left = removeHelper(node->left, val);\nelse if (val > node->val)\nnode->right = removeHelper(node->right, val);\nelse {\nif (node->left == nullptr || node->right == nullptr) {\nTreeNode* child = node->left != nullptr ? node->left : node->right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == nullptr) {\ndelete node;\nreturn nullptr;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse {\ndelete node;\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode* temp = getInOrderNext(node->right);\nnode->right = removeHelper(node->right, temp->val);\nnode->val = temp->val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode* getInOrderNext(TreeNode* node) {\nif (node == nullptr) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node->left != nullptr) {\nnode = node->left;\n}\nreturn node;\n}\n
avl_tree.py
def remove(self, val: int) -> Optional[TreeNode]:\n\"\"\" \u5220\u9664\u7ed3\u70b9 \"\"\"\nself.__root = self.__remove_helper(self.__root, val)\nreturn self.__root \ndef __remove_helper(self, node: Optional[TreeNode], val: int) -> Optional[TreeNode]:\n\"\"\" \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 \"\"\"\nif node is None:\nreturn None\n# 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b\nif val < node.val:\nnode.left = self.__remove_helper(node.left, val)\nelif val > node.val:\nnode.right = self.__remove_helper(node.right, val)\nelse:\nif node.left is None or node.right is None:\nchild = node.left or node.right\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child is None:\nreturn None\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse:\nnode = child\nelse:  # \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\ntemp = self.__get_inorder_next(node.right)\nnode.right = self.__remove_helper(node.right, temp.val)\nnode.val = temp.val\n# \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nself.__update_height(node)\n# 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nreturn self.__rotate(node)\ndef __get_inorder_next(self, node: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 \"\"\"\nif node is None:\nreturn None\n# \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile node.left is not None:\nnode = node.left\nreturn node\n
avl_tree.go
/* \u5220\u9664\u7ed3\u70b9 */\nfunc (t *aVLTree) remove(val int) *TreeNode {\nroot := t.removeHelper(t.root, val)\nreturn root\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc (t *aVLTree) removeHelper(node *TreeNode, val int) *TreeNode {\nif node == nil {\nreturn nil\n}\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif val < node.Val {\nnode.Left = t.removeHelper(node.Left, val)\n} else if val > node.Val {\nnode.Right = t.removeHelper(node.Right, val)\n} else {\nif node.Left == nil || node.Right == nil {\nchild := node.Left\nif node.Right != nil {\nchild = node.Right\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child == nil {\nreturn nil\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nnode = child\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\ntemp := t.getInOrderNext(node.Right)\nnode.Right = t.removeHelper(node.Right, temp.Val)\nnode.Val = temp.Val\n}\n}\n// \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\nt.updateHeight(node)\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = t.rotate(node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc (t *aVLTree) getInOrderNext(node *TreeNode) *TreeNode {\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nfor node.Left != nil {\nnode = node.Left\n}\nreturn node\n}\n
avl_tree.js
/* \u5220\u9664\u7ed3\u70b9 */\nremove(val) {\nthis.root = this.#removeHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\n#removeHelper(node, val) {\nif (node === null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val) node.left = this.#removeHelper(node.left, val);\nelse if (val > node.val) node.right = this.#removeHelper(node.right, val);\nelse {\nif (node.left === null || node.right === null) {\nconst child = node.left !== null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child === null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse node = child;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nconst temp = this.#getInOrderNext(node.right);\nnode.right = this.#removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nthis.#updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.#rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\n#getInOrderNext(node) {\nif (node === null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left !== null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.ts
/* \u5220\u9664\u7ed3\u70b9 */\nremove(val: number): TreeNode {\nthis.root = this.removeHelper(this.root, val);\nreturn this.root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nremoveHelper(node: TreeNode, val: number): TreeNode {\nif (node === null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val) {\nnode.left = this.removeHelper(node.left, val);\n} else if (val > node.val) {\nnode.right = this.removeHelper(node.right, val);\n} else {\nif (node.left === null || node.right === null) {\nconst child = node.left !== null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child === null) {\nreturn null;\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nconst temp = this.getInOrderNext(node.right);\nnode.right = this.removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nthis.updateHeight(node); // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = this.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\ngetInOrderNext(node: TreeNode): TreeNode {\nif (node === null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left !== null) {\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.c
[class]{aVLTree}-[func]{remove}\n[class]{aVLTree}-[func]{removeHelper}\n[class]{aVLTree}-[func]{getInOrderNext}\n
avl_tree.cs
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode? remove(int val)\n{\nroot = removeHelper(root, val);\nreturn root;\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nTreeNode? removeHelper(TreeNode? node, int val)\n{\nif (node == null) return null;\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif (val < node.val)\nnode.left = removeHelper(node.left, val);\nelse if (val > node.val)\nnode.right = removeHelper(node.right, val);\nelse\n{\nif (node.left == null || node.right == null)\n{\nTreeNode? child = node.left != null ? node.left : node.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null)\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse\nnode = child;\n}\nelse\n{\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nTreeNode? temp = getInOrderNext(node.right);\nnode.right = removeHelper(node.right, temp.val);\nnode.val = temp.val;\n}\n}\nupdateHeight(node);  // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode? getInOrderNext(TreeNode? node)\n{\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.left != null)\n{\nnode = node.left;\n}\nreturn node;\n}\n
avl_tree.swift
/* \u5220\u9664\u7ed3\u70b9 */\n@discardableResult\nfunc remove(val: Int) -> TreeNode? {\nroot = removeHelper(node: root, val: val)\nreturn root\n}\n/* \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09 */\nfunc removeHelper(node: TreeNode?, val: Int) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn nil\n}\n/* 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b */\nif val < node!.val {\nnode?.left = removeHelper(node: node?.left, val: val)\n} else if val > node!.val {\nnode?.right = removeHelper(node: node?.right, val: val)\n} else {\nif node?.left == nil || node?.right == nil {\nlet child = node?.left != nil ? node?.left : node?.right\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif child == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\nelse {\nnode = child\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nlet temp = getInOrderNext(node: node?.right)\nnode?.right = removeHelper(node: node?.right, val: temp!.val)\nnode?.val = temp!.val\n}\n}\nupdateHeight(node: node) // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n/* 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861 */\nnode = rotate(node: node)\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc getInOrderNext(node: TreeNode?) -> TreeNode? {\nvar node = node\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile node?.left != nil {\nnode = node?.left\n}\nreturn node\n}\n
avl_tree.zig
// \u5220\u9664\u7ed3\u70b9\nfn remove(self: *Self, val: T) ?*inc.TreeNode(T) {\nself.root = self.removeHelper(self.root, val);\nreturn self.root;\n}\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9\uff08\u8f85\u52a9\u65b9\u6cd5\uff09\nfn removeHelper(self: *Self, node_: ?*inc.TreeNode(T), val: T) ?*inc.TreeNode(T) {\nvar node = node_;\nif (node == null) return null;\n// 1. \u67e5\u627e\u7ed3\u70b9\uff0c\u5e76\u5220\u9664\u4e4b\nif (val < node.?.val) {\nnode.?.left = self.removeHelper(node.?.left, val);\n} else if (val > node.?.val) {\nnode.?.right = self.removeHelper(node.?.right, val);\n} else {\nif (node.?.left == null or node.?.right == null) {\nvar child = if (node.?.left != null) node.?.left else node.?.right;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 \uff0c\u76f4\u63a5\u5220\u9664 node \u5e76\u8fd4\u56de\nif (child == null) {\nreturn null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 1 \uff0c\u76f4\u63a5\u5220\u9664 node\n} else {\nnode = child;\n}\n} else {\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2 \uff0c\u5219\u5c06\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e2a\u7ed3\u70b9\u5220\u9664\uff0c\u5e76\u7528\u8be5\u7ed3\u70b9\u66ff\u6362\u5f53\u524d\u7ed3\u70b9\nvar temp = self.getInOrderNext(node.?.right);\nnode.?.right = self.removeHelper(node.?.right, temp.?.val);\nnode.?.val = temp.?.val;\n}\n}\nself.updateHeight(node);    // \u66f4\u65b0\u7ed3\u70b9\u9ad8\u5ea6\n// 2. \u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u8be5\u5b50\u6811\u91cd\u65b0\u6062\u590d\u5e73\u8861\nnode = self.rotate(node);\n// \u8fd4\u56de\u5b50\u6811\u7684\u6839\u7ed3\u70b9\nreturn node;\n}\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09\nfn getInOrderNext(self: *Self, node_: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n_ = self;\nvar node = node_;\nif (node == null) return node;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node.?.left != null) {\nnode = node.?.left;\n}\nreturn node;\n}\n
"},{"location":"chapter_tree/avl_tree/#_6","title":"\u67e5\u627e\u7ed3\u70b9","text":"

\u300cAVL \u6811\u300d\u7684\u7ed3\u70b9\u67e5\u627e\u64cd\u4f5c\u4e0e\u300c\u4e8c\u53c9\u641c\u7d22\u6811\u300d\u4e00\u81f4\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002

"},{"location":"chapter_tree/avl_tree/#744-avl","title":"7.4.4. \u00a0 AVL \u6811\u5178\u578b\u5e94\u7528","text":"
  • \u7ec4\u7ec7\u5b58\u50a8\u5927\u578b\u6570\u636e\uff0c\u9002\u7528\u4e8e\u9ad8\u9891\u67e5\u627e\u3001\u4f4e\u9891\u589e\u5220\u573a\u666f\uff1b
  • \u7528\u4e8e\u5efa\u7acb\u6570\u636e\u5e93\u4e2d\u7684\u7d22\u5f15\u7cfb\u7edf\uff1b

\u4e3a\u4ec0\u4e48\u7ea2\u9ed1\u6811\u6bd4 AVL \u6811\u66f4\u53d7\u6b22\u8fce\uff1f

\u7ea2\u9ed1\u6811\u7684\u5e73\u8861\u6761\u4ef6\u76f8\u5bf9\u5bbd\u677e\uff0c\u56e0\u6b64\u5728\u7ea2\u9ed1\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u6240\u9700\u7684\u65cb\u8f6c\u64cd\u4f5c\u76f8\u5bf9\u66f4\u5c11\uff0c\u7ed3\u70b9\u589e\u5220\u64cd\u4f5c\u76f8\u6bd4 AVL \u6811\u7684\u6548\u7387\u66f4\u9ad8\u3002

"},{"location":"chapter_tree/binary_search_tree/","title":"7.3. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811","text":"

\u300c\u4e8c\u53c9\u641c\u7d22\u6811 Binary Search Tree\u300d\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff1a

  1. \u5bf9\u4e8e\u6839\u7ed3\u70b9\uff0c\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u7684\u503c \\(<\\) \u6839\u7ed3\u70b9\u7684\u503c \\(<\\) \u53f3\u5b50\u6811\u4e2d\u6240\u6709\u7ed3\u70b9\u7684\u503c\uff1b
  2. \u4efb\u610f\u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u4e5f\u662f\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u5373\u4e5f\u6ee1\u8db3\u6761\u4ef6 1. \uff1b

Fig. \u4e8c\u53c9\u641c\u7d22\u6811

"},{"location":"chapter_tree/binary_search_tree/#731","title":"7.3.1. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u64cd\u4f5c","text":""},{"location":"chapter_tree/binary_search_tree/#_1","title":"\u67e5\u627e\u7ed3\u70b9","text":"

\u7ed9\u5b9a\u76ee\u6807\u7ed3\u70b9\u503c num \uff0c\u53ef\u4ee5\u6839\u636e\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6027\u8d28\u6765\u67e5\u627e\u3002\u6211\u4eec\u58f0\u660e\u4e00\u4e2a\u7ed3\u70b9 cur \uff0c\u4ece\u4e8c\u53c9\u6811\u7684\u6839\u7ed3\u70b9 root \u51fa\u53d1\uff0c\u5faa\u73af\u6bd4\u8f83\u7ed3\u70b9\u503c cur.val \u548c num \u4e4b\u95f4\u7684\u5927\u5c0f\u5173\u7cfb

  • \u82e5 cur.val < num \uff0c\u8bf4\u660e\u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\uff0c\u56e0\u6b64\u6267\u884c cur = cur.right \uff1b
  • \u82e5 cur.val > num \uff0c\u8bf4\u660e\u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\uff0c\u56e0\u6b64\u6267\u884c cur = cur.left \uff1b
  • \u82e5 cur.val = num \uff0c\u8bf4\u660e\u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\u5e76\u8fd4\u56de\u8be5\u7ed3\u70b9\u5373\u53ef\uff1b
<1><2><3><4>

\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u67e5\u627e\u64cd\u4f5c\u548c\u4e8c\u5206\u67e5\u627e\u7b97\u6cd5\u5982\u51fa\u4e00\u8f99\uff0c\u4e5f\u662f\u5728\u6bcf\u8f6e\u6392\u9664\u4e00\u534a\u60c5\u51b5\u3002\u5faa\u73af\u6b21\u6570\u6700\u591a\u4e3a\u4e8c\u53c9\u6811\u7684\u9ad8\u5ea6\uff0c\u5f53\u4e8c\u53c9\u6811\u5e73\u8861\u65f6\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode search(int num) {\nTreeNode cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.cpp
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode* search(int num) {\nTreeNode* cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur->val > num) cur = cur->left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.py
def search(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u67e5\u627e\u7ed3\u70b9 \"\"\"\ncur: Optional[TreeNode] = self.__root\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur is not None:\n# \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur.val < num:\ncur = cur.right\n# \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelif cur.val > num:\ncur = cur.left\n# \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse:\nbreak\nreturn cur\n
binary_search_tree.go
/* \u67e5\u627e\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) search(num int) *TreeNode {\nnode := bst.root\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor node != nil {\nif node.Val < num {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nnode = node.Right\n} else if node.Val > num {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nnode = node.Left\n} else {\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nbreak\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn node\n}\n
binary_search_tree.js
/* \u67e5\u627e\u7ed3\u70b9 */\nfunction search(num) {\nlet cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.ts
/* \u67e5\u627e\u7ed3\u70b9 */\nfunction search(num: number): TreeNode | null {\nlet cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\nif (cur.val < num) {\ncur = cur.right; // \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else if (cur.val > num) {\ncur = cur.left; // \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\nbreak; // \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{search}\n
binary_search_tree.cs
/* \u67e5\u627e\u7ed3\u70b9 */\nTreeNode? search(int num)\n{\nTreeNode? cur = root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if (cur.val > num) cur = cur.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse break;\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
binary_search_tree.swift
/* \u67e5\u627e\u7ed3\u70b9 */\nfunc search(num: Int) -> TreeNode? {\nvar cur = root\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse if cur!.val > num {\ncur = cur?.left\n}\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nelse {\nbreak\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur\n}\n
binary_search_tree.zig
// \u67e5\u627e\u7ed3\u70b9\nfn search(self: *Self, num: T) ?*inc.TreeNode(T) {\nvar cur = self.root;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u76ee\u6807\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else if (cur.?.val > num) {\ncur = cur.?.left;\n// \u627e\u5230\u76ee\u6807\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\n} else {\nbreak;\n}\n}\n// \u8fd4\u56de\u76ee\u6807\u7ed3\u70b9\nreturn cur;\n}\n
"},{"location":"chapter_tree/binary_search_tree/#_2","title":"\u63d2\u5165\u7ed3\u70b9","text":"

\u7ed9\u5b9a\u4e00\u4e2a\u5f85\u63d2\u5165\u5143\u7d20 num \uff0c\u4e3a\u4e86\u4fdd\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u201c\u5de6\u5b50\u6811 < \u6839\u7ed3\u70b9 < \u53f3\u5b50\u6811\u201d\u7684\u6027\u8d28\uff0c\u63d2\u5165\u64cd\u4f5c\u5206\u4e3a\u4e24\u6b65\uff1a

  1. \u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff1a\u4e0e\u67e5\u627e\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u6211\u4eec\u4ece\u6839\u7ed3\u70b9\u51fa\u53d1\uff0c\u6839\u636e\u5f53\u524d\u7ed3\u70b9\u503c\u548c num \u7684\u5927\u5c0f\u5173\u7cfb\u5faa\u73af\u5411\u4e0b\u641c\u7d22\uff0c\u76f4\u5230\u8d8a\u8fc7\u53f6\u7ed3\u70b9\uff08\u904d\u5386\u5230 \\(\\text{null}\\) \uff09\u65f6\u8df3\u51fa\u5faa\u73af\uff1b
  2. \u5728\u8be5\u4f4d\u7f6e\u63d2\u5165\u7ed3\u70b9\uff1a\u521d\u59cb\u5316\u7ed3\u70b9 num \uff0c\u5c06\u8be5\u7ed3\u70b9\u653e\u5230 \\(\\text{null}\\) \u7684\u4f4d\u7f6e \uff1b

\u4e8c\u53c9\u641c\u7d22\u6811\u4e0d\u5141\u8bb8\u5b58\u5728\u91cd\u590d\u7ed3\u70b9\uff0c\u5426\u5219\u5c06\u4f1a\u8fdd\u80cc\u5176\u5b9a\u4e49\u3002\u56e0\u6b64\u82e5\u5f85\u63d2\u5165\u7ed3\u70b9\u5728\u6811\u4e2d\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4e0d\u6267\u884c\u63d2\u5165\uff0c\u76f4\u63a5\u8fd4\u56de\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u63d2\u5165\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode insert(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode node = new TreeNode(num);\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\nreturn node;\n}\n
binary_search_tree.cpp
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode* insert(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == nullptr) return nullptr;\nTreeNode *cur = root, *pre = nullptr;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur->val == num) return nullptr;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur->left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode* node = new TreeNode(num);\nif (pre->val < num) pre->right = node;\nelse pre->left = node;\nreturn node;\n}\n
binary_search_tree.py
def insert(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u63d2\u5165\u7ed3\u70b9 \"\"\"\n# \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif self.__root is None:\nreturn None\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\ncur, pre = self.__root, None\nwhile cur is not None:\n# \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif cur.val == num:\nreturn None\npre = cur\n# \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur.val < num:\ncur = cur.right\n# \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse:\ncur = cur.left\n# \u63d2\u5165\u7ed3\u70b9 val\nnode = TreeNode(num)\nif pre.val < num:\npre.right = node\nelse:\npre.left = node\nreturn node\n
binary_search_tree.go
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) insert(num int) *TreeNode {\ncur := bst.root\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5f85\u63d2\u5165\u7ed3\u70b9\u4e4b\u524d\u7684\u7ed3\u70b9\u4f4d\u7f6e\nvar pre *TreeNode = nil\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor cur != nil {\nif cur.Val == num {\nreturn nil\n}\npre = cur\nif cur.Val < num {\ncur = cur.Right\n} else {\ncur = cur.Left\n}\n}\n// \u63d2\u5165\u7ed3\u70b9\nnode := NewTreeNode(num)\nif pre.Val < num {\npre.Right = node\n} else {\npre.Left = node\n}\nreturn cur\n}\n
binary_search_tree.js
/* \u63d2\u5165\u7ed3\u70b9 */\nfunction insert(num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) return null;\nlet cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val === num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = new TreeNode(num);\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\nreturn node;\n}\n
binary_search_tree.ts
/* \u63d2\u5165\u7ed3\u70b9 */\nfunction insert(num: number): TreeNode | null {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) {\nreturn null;\n}\nlet cur = root,\npre: TreeNode | null = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\nif (cur.val === num) {\nreturn null; // \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\n}\npre = cur;\nif (cur.val < num) {\ncur = cur.right as TreeNode; // \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else {\ncur = cur.left as TreeNode; // \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = new TreeNode(num);\nif (pre!.val < num) {\npre!.right = node;\n} else {\npre!.left = node;\n}\nreturn node;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{insert}\n
binary_search_tree.cs
/* \u63d2\u5165\u7ed3\u70b9 */\nTreeNode? insert(int num)\n{\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode? cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nTreeNode node = new TreeNode(num);\nif (pre != null)\n{\nif (pre.val < num) pre.right = node;\nelse pre.left = node;\n}\nreturn node;\n}\n
binary_search_tree.swift
/* \u63d2\u5165\u7ed3\u70b9 */\nfunc insert(num: Int) -> TreeNode? {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif root == nil {\nreturn nil\n}\nvar cur = root\nvar pre: TreeNode?\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif cur!.val == num {\nreturn nil\n}\npre = cur\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse {\ncur = cur?.left\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nlet node = TreeNode(x: num)\nif pre!.val < num {\npre?.right = node\n} else {\npre?.left = node\n}\nreturn node\n}\n
binary_search_tree.zig
// \u63d2\u5165\u7ed3\u70b9\nfn insert(self: *Self, num: T) !?*inc.TreeNode(T) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (self.root == null) return null;\nvar cur = self.root;\nvar pre: ?*inc.TreeNode(T) = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u91cd\u590d\u7ed3\u70b9\uff0c\u76f4\u63a5\u8fd4\u56de\nif (cur.?.val == num) return null;\npre = cur;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u63d2\u5165\u4f4d\u7f6e\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\ncur = cur.?.left;\n}\n}\n// \u63d2\u5165\u7ed3\u70b9 val\nvar node = try self.mem_allocator.create(inc.TreeNode(T));\nnode.init(num);\nif (pre.?.val < num) {\npre.?.right = node;\n} else {\npre.?.left = node;\n}\nreturn node;\n}\n

\u4e3a\u4e86\u63d2\u5165\u7ed3\u70b9\uff0c\u9700\u8981\u501f\u52a9 \u8f85\u52a9\u7ed3\u70b9 pre \u4fdd\u5b58\u4e0a\u4e00\u8f6e\u5faa\u73af\u7684\u7ed3\u70b9\uff0c\u8fd9\u6837\u5728\u904d\u5386\u5230 \\(\\text{null}\\) \u65f6\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u83b7\u53d6\u5230\u5176\u7236\u7ed3\u70b9\uff0c\u4ece\u800c\u5b8c\u6210\u7ed3\u70b9\u63d2\u5165\u64cd\u4f5c\u3002

\u4e0e\u67e5\u627e\u7ed3\u70b9\u76f8\u540c\uff0c\u63d2\u5165\u7ed3\u70b9\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\u3002

"},{"location":"chapter_tree/binary_search_tree/#_3","title":"\u5220\u9664\u7ed3\u70b9","text":"

\u4e0e\u63d2\u5165\u7ed3\u70b9\u4e00\u6837\uff0c\u6211\u4eec\u9700\u8981\u5728\u5220\u9664\u64cd\u4f5c\u540e\u7ef4\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u201c\u5de6\u5b50\u6811 < \u6839\u7ed3\u70b9 < \u53f3\u5b50\u6811\u201d\u7684\u6027\u8d28\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728\u4e8c\u53c9\u6811\u4e2d\u6267\u884c\u67e5\u627e\u64cd\u4f5c\uff0c\u83b7\u53d6\u5f85\u5220\u9664\u7ed3\u70b9\u3002\u63a5\u4e0b\u6765\uff0c\u6839\u636e\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf\uff0c\u5220\u9664\u64cd\u4f5c\u9700\u8981\u5206\u4e3a\u4e09\u79cd\u60c5\u51b5\uff1a

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 0\\) \u65f6\uff0c\u8868\u660e\u5f85\u5220\u9664\u7ed3\u70b9\u662f\u53f6\u7ed3\u70b9\uff0c\u76f4\u63a5\u5220\u9664\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u5220\u9664\u7ed3\u70b9\uff08\u5ea6\u4e3a 0\uff09

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 1\\) \u65f6\uff0c\u5c06\u5f85\u5220\u9664\u7ed3\u70b9\u66ff\u6362\u4e3a\u5176\u5b50\u7ed3\u70b9\u5373\u53ef\u3002

Fig. \u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u5220\u9664\u7ed3\u70b9\uff08\u5ea6\u4e3a 1\uff09

\u5f53\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf \\(= 2\\) \u65f6\uff0c\u5220\u9664\u64cd\u4f5c\u5206\u4e3a\u4e09\u6b65\uff1a

  1. \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\u5728 \u4e2d\u5e8f\u904d\u5386\u5e8f\u5217 \u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff0c\u8bb0\u4e3a nex \uff1b
  2. \u5728\u6811\u4e2d\u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex \uff1b
  3. \u4f7f\u7528 nex \u66ff\u6362\u5f85\u5220\u9664\u7ed3\u70b9\uff1b
<1><2><3><4>

\u5220\u9664\u7ed3\u70b9\u64cd\u4f5c\u4e5f\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d\u67e5\u627e\u5f85\u5220\u9664\u7ed3\u70b9 \\(O(\\log n)\\) \uff0c\u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u540e\u7ee7\u7ed3\u70b9 \\(O(\\log n)\\) \u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_search_tree.java
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode remove(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left == null || cur.right == null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nTreeNode child = cur.left != null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left == cur) pre.left = child;\nelse pre.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode nex = getInOrderNext(cur.right);\nint tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode getInOrderNext(TreeNode root) {\nif (root == null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left != null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.cpp
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode* remove(int num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == nullptr) return nullptr;\nTreeNode *cur = root, *pre = nullptr;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != nullptr) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur->val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur->val < num) cur = cur->right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur->left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == nullptr) return nullptr;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur->left == nullptr || cur->right == nullptr) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = nullptr / \u8be5\u5b50\u7ed3\u70b9\nTreeNode* child = cur->left != nullptr ? cur->left : cur->right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre->left == cur) pre->left = child;\nelse pre->right = child;\n// \u91ca\u653e\u5185\u5b58\ndelete cur;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode* nex = getInOrderNext(cur->right);\nint tmp = nex->val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex->val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur->val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode* getInOrderNext(TreeNode* root) {\nif (root == nullptr) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root->left != nullptr) {\nroot = root->left;\n}\nreturn root;\n}\n
binary_search_tree.py
def remove(self, num: int) -> Optional[TreeNode]:\n\"\"\" \u5220\u9664\u7ed3\u70b9 \"\"\"\n# \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif self.__root is None:\nreturn None\n# \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\ncur, pre = self.__root, None\nwhile cur is not None:\n# \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif cur.val == num:\nbreak\npre = cur\nif cur.val < num:  # \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\ncur = cur.right\nelse:  # \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\ncur = cur.left\n# \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur is None:\nreturn None\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif cur.left is None or cur.right is None:\n# \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nchild = cur.left or cur.right\n# \u5220\u9664\u7ed3\u70b9 cur\nif pre.left == cur:\npre.left = child\nelse:\npre.right = child\n# \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse:\n# \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nnex: TreeNode = self.get_inorder_next(cur.right)\ntmp: int = nex.val\n# \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nself.remove(nex.val)\n# \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp\nreturn cur\ndef get_inorder_next(self, root: Optional[TreeNode]) -> Optional[TreeNode]:\n\"\"\" \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 \"\"\"\nif root is None:\nreturn root\n# \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile root.left is not None:\nroot = root.left\nreturn root\n
binary_search_tree.go
/* \u5220\u9664\u7ed3\u70b9 */\nfunc (bst *binarySearchTree) remove(num int) *TreeNode {\ncur := bst.root\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5f85\u5220\u9664\u7ed3\u70b9\u4e4b\u524d\u7684\u7ed3\u70b9\u4f4d\u7f6e\nvar pre *TreeNode = nil\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nfor cur != nil {\nif cur.Val == num {\nbreak\n}\npre = cur\nif cur.Val < num {\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728\u53f3\u5b50\u6811\u4e2d\ncur = cur.Right\n} else {\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728\u5de6\u5b50\u6811\u4e2d\ncur = cur.Left\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u4e3a 0 \u6216 1\nif cur.Left == nil || cur.Right == nil {\nvar child *TreeNode = nil\n// \u53d6\u51fa\u5f85\u5220\u9664\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\nif cur.Left != nil {\nchild = cur.Left\n} else {\nchild = cur.Right\n}\n// \u5c06\u5b50\u7ed3\u70b9\u66ff\u6362\u4e3a\u5f85\u5220\u9664\u7ed3\u70b9\nif pre.Left == cur {\npre.Left = child\n} else {\npre.Right = child\n}\n// \u5b50\u7ed3\u70b9\u6570\u4e3a 2\n} else {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u5f85\u5220\u9664\u7ed3\u70b9 cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nnext := bst.getInOrderNext(cur)\ntemp := next.Val\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 next\nbst.remove(next.Val)\n// \u5c06 next \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.Val = temp\n}\nreturn cur\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc (bst *binarySearchTree) getInOrderNext(node *TreeNode) *TreeNode {\nif node == nil {\nreturn node\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nfor node.Left != nil {\nnode = node.Left\n}\nreturn node\n}\n
binary_search_tree.js
/* \u5220\u9664\u7ed3\u70b9 */\nfunction remove(num) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) return null;\nlet cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val === num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur === null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left === null || cur.right === null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur.left !== null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left === cur) pre.left = child;\nelse pre.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet nex = getInOrderNext(cur.right);\nlet tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunction getInOrderNext(root) {\nif (root === null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left !== null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.ts
/* \u5220\u9664\u7ed3\u70b9 */\nfunction remove(num: number): TreeNode | null {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root === null) {\nreturn null;\n}\nlet cur = root,\npre: TreeNode | null = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur !== null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val === num) {\nbreak;\n}\npre = cur;\nif (cur.val < num) {\ncur = cur.right as TreeNode; // \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\n} else {\ncur = cur.left as TreeNode; // \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur === null) {\nreturn null;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left === null || cur.right === null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur.left !== null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre!.left === cur) {\npre!.left = child;\n} else {\npre!.right = child;\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet next = getInOrderNext(cur.right);\nlet tmp = next!.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(next!.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunction getInOrderNext(root: TreeNode | null): TreeNode | null {\nif (root === null) {\nreturn null;\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left !== null) {\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.c
[class]{binarySearchTree}-[func]{remove}\n[class]{binarySearchTree}-[func]{getInOrderNext}\n
binary_search_tree.cs
/* \u5220\u9664\u7ed3\u70b9 */\nTreeNode? remove(int num)\n{\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (root == null) return null;\nTreeNode? cur = root, pre = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null)\n{\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.val < num) cur = cur.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse cur = cur.left;\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null || pre == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.left == null || cur.right == null)\n{\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nTreeNode? child = cur.left != null ? cur.left : cur.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.left == cur)\n{\npre.left = child;\n}\nelse\n{\npre.right = child;\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse\n{\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nTreeNode? nex = getInOrderNext(cur.right);\nif (nex != null)\n{\nint tmp = nex.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(nex.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.val = tmp;\n}\n}\nreturn cur;\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nTreeNode? getInOrderNext(TreeNode? root)\n{\nif (root == null) return root;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (root.left != null)\n{\nroot = root.left;\n}\nreturn root;\n}\n
binary_search_tree.swift
/* \u5220\u9664\u7ed3\u70b9 */\n@discardableResult\nfunc remove(num: Int) -> TreeNode? {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif root == nil {\nreturn nil\n}\nvar cur = root\nvar pre: TreeNode?\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile cur != nil {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif cur!.val == num {\nbreak\n}\npre = cur\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif cur!.val < num {\ncur = cur?.right\n}\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\nelse {\ncur = cur?.left\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif cur == nil {\nreturn nil\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif cur?.left == nil || cur?.right == nil {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nlet child = cur?.left != nil ? cur?.left : cur?.right\n// \u5220\u9664\u7ed3\u70b9 cur\nif pre?.left === cur {\npre?.left = child\n} else {\npre?.right = child\n}\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\nelse {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nlet nex = getInOrderNext(root: cur?.right)\nlet tmp = nex!.val\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\nremove(num: nex!.val)\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur?.val = tmp\n}\nreturn cur\n}\n/* \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09 */\nfunc getInOrderNext(root: TreeNode?) -> TreeNode? {\nvar root = root\nif root == nil {\nreturn root\n}\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile root?.left != nil {\nroot = root?.left\n}\nreturn root\n}\n
binary_search_tree.zig
// \u5220\u9664\u7ed3\u70b9\nfn remove(self: *Self, num: T) ?*inc.TreeNode(T) {\n// \u82e5\u6811\u4e3a\u7a7a\uff0c\u76f4\u63a5\u63d0\u524d\u8fd4\u56de\nif (self.root == null) return null;\nvar cur = self.root;\nvar pre: ?*inc.TreeNode(T) = null;\n// \u5faa\u73af\u67e5\u627e\uff0c\u8d8a\u8fc7\u53f6\u7ed3\u70b9\u540e\u8df3\u51fa\nwhile (cur != null) {\n// \u627e\u5230\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u8df3\u51fa\u5faa\u73af\nif (cur.?.val == num) break;\npre = cur;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u53f3\u5b50\u6811\u4e2d\nif (cur.?.val < num) {\ncur = cur.?.right;\n// \u5f85\u5220\u9664\u7ed3\u70b9\u5728 cur \u7684\u5de6\u5b50\u6811\u4e2d\n} else {\ncur = cur.?.left;\n}\n}\n// \u82e5\u65e0\u5f85\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u76f4\u63a5\u8fd4\u56de\nif (cur == null) return null;\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 0 or 1\nif (cur.?.left == null or cur.?.right == null) {\n// \u5f53\u5b50\u7ed3\u70b9\u6570\u91cf = 0 / 1 \u65f6\uff0c child = null / \u8be5\u5b50\u7ed3\u70b9\nvar child = if (cur.?.left != null) cur.?.left else cur.?.right;\n// \u5220\u9664\u7ed3\u70b9 cur\nif (pre.?.left == cur) {\npre.?.left = child;\n} else {\npre.?.right = child;\n}\n// \u5b50\u7ed3\u70b9\u6570\u91cf = 2\n} else {\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d cur \u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\nvar nex = self.getInOrderNext(cur.?.right);\nvar tmp = nex.?.val;\n// \u9012\u5f52\u5220\u9664\u7ed3\u70b9 nex\n_ = self.remove(nex.?.val);\n// \u5c06 nex \u7684\u503c\u590d\u5236\u7ed9 cur\ncur.?.val = tmp;\n}\nreturn cur;\n}\n// \u83b7\u53d6\u4e2d\u5e8f\u904d\u5386\u4e2d\u7684\u4e0b\u4e00\u4e2a\u7ed3\u70b9\uff08\u4ec5\u9002\u7528\u4e8e root \u6709\u5de6\u5b50\u7ed3\u70b9\u7684\u60c5\u51b5\uff09\nfn getInOrderNext(self: *Self, node: ?*inc.TreeNode(T)) ?*inc.TreeNode(T) {\n_ = self;\nvar node_tmp = node;\nif (node_tmp == null) return null;\n// \u5faa\u73af\u8bbf\u95ee\u5de6\u5b50\u7ed3\u70b9\uff0c\u76f4\u5230\u53f6\u7ed3\u70b9\u65f6\u4e3a\u6700\u5c0f\u7ed3\u70b9\uff0c\u8df3\u51fa\nwhile (node_tmp.?.left != null) {\nnode_tmp = node_tmp.?.left;\n}\nreturn node_tmp;\n}\n
"},{"location":"chapter_tree/binary_search_tree/#_4","title":"\u6392\u5e8f","text":"

\u6211\u4eec\u77e5\u9053\uff0c\u300c\u4e2d\u5e8f\u904d\u5386\u300d\u9075\u5faa\u201c\u5de6 \\(\\rightarrow\\) \u6839 \\(\\rightarrow\\) \u53f3\u201d\u7684\u904d\u5386\u4f18\u5148\u7ea7\uff0c\u800c\u4e8c\u53c9\u641c\u7d22\u6811\u9075\u5faa\u201c\u5de6\u5b50\u7ed3\u70b9 \\(<\\) \u6839\u7ed3\u70b9 \\(<\\) \u53f3\u5b50\u7ed3\u70b9\u201d\u7684\u5927\u5c0f\u5173\u7cfb\u3002\u56e0\u6b64\uff0c\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u8fdb\u884c\u4e2d\u5e8f\u904d\u5386\u65f6\uff0c\u603b\u662f\u4f1a\u4f18\u5148\u904d\u5386\u4e0b\u4e00\u4e2a\u6700\u5c0f\u7ed3\u70b9\uff0c\u4ece\u800c\u5f97\u51fa\u4e00\u6761\u91cd\u8981\u6027\u8d28\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217\u662f\u5347\u5e8f\u7684\u3002

\u501f\u52a9\u4e2d\u5e8f\u904d\u5386\u5347\u5e8f\u7684\u6027\u8d28\uff0c\u6211\u4eec\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u83b7\u53d6\u6709\u5e8f\u6570\u636e\u4ec5\u9700 \\(O(n)\\) \u65f6\u95f4\uff0c\u800c\u65e0\u9700\u989d\u5916\u6392\u5e8f\uff0c\u975e\u5e38\u9ad8\u6548\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217

"},{"location":"chapter_tree/binary_search_tree/#732","title":"7.3.2. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6548\u7387","text":"

\u5047\u8bbe\u7ed9\u5b9a \\(n\\) \u4e2a\u6570\u5b57\uff0c\u6700\u5e38\u7528\u7684\u5b58\u50a8\u65b9\u5f0f\u662f\u300c\u6570\u7ec4\u300d\uff0c\u90a3\u4e48\u5bf9\u4e8e\u8fd9\u4e32\u4e71\u5e8f\u7684\u6570\u5b57\uff0c\u5e38\u89c1\u64cd\u4f5c\u7684\u6548\u7387\u4e3a\uff1a

  • \u67e5\u627e\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u662f\u65e0\u5e8f\u7684\uff0c\u56e0\u6b64\u9700\u8981\u904d\u5386\u6570\u7ec4\u6765\u786e\u5b9a\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u63d2\u5165\u5143\u7d20\uff1a\u53ea\u9700\u5c06\u5143\u7d20\u6dfb\u52a0\u81f3\u6570\u7ec4\u5c3e\u90e8\u5373\u53ef\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\uff1b
  • \u5220\u9664\u5143\u7d20\uff1a\u5148\u67e5\u627e\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u518d\u5728\u6570\u7ec4\u4e2d\u5220\u9664\u8be5\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20\uff1a\u9700\u8981\u904d\u5386\u6570\u7ec4\u6765\u786e\u5b9a\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b

\u4e3a\u4e86\u5f97\u5230\u5148\u9a8c\u4fe1\u606f\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u9884\u5148\u5c06\u6570\u7ec4\u5143\u7d20\u8fdb\u884c\u6392\u5e8f\uff0c\u5f97\u5230\u4e00\u4e2a\u300c\u6392\u5e8f\u6570\u7ec4\u300d\uff0c\u6b64\u65f6\u64cd\u4f5c\u6548\u7387\u4e3a\uff1a

  • \u67e5\u627e\u5143\u7d20\uff1a\u7531\u4e8e\u6570\u7ec4\u5df2\u6392\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\uff0c\u5e73\u5747\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff1b
  • \u63d2\u5165\u5143\u7d20\uff1a\u5148\u67e5\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u518d\u63d2\u5165\u5230\u6307\u5b9a\u4f4d\u7f6e\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u5220\u9664\u5143\u7d20\uff1a\u5148\u67e5\u627e\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(\\log n)\\) \u65f6\u95f4\uff0c\u518d\u5728\u6570\u7ec4\u4e2d\u5220\u9664\u8be5\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff1b
  • \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20\uff1a\u6570\u7ec4\u5934\u90e8\u548c\u5c3e\u90e8\u5143\u7d20\u5373\u662f\u6700\u5c0f\u548c\u6700\u5927\u5143\u7d20\uff0c\u4f7f\u7528 \\(O(1)\\) \u65f6\u95f4\uff1b

\u89c2\u5bdf\u53d1\u73b0\uff0c\u65e0\u5e8f\u6570\u7ec4\u548c\u6709\u5e8f\u6570\u7ec4\u4e2d\u7684\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f\u201c\u504f\u79d1\u201d\u7684\uff0c\u5373\u6709\u7684\u5feb\u6709\u7684\u6162\uff1b\u800c\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5404\u9879\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u90fd\u662f\u5bf9\u6570\u9636\uff0c\u5728\u6570\u636e\u91cf \\(n\\) \u5f88\u5927\u65f6\u6709\u5de8\u5927\u4f18\u52bf\u3002

\u65e0\u5e8f\u6570\u7ec4 \u6709\u5e8f\u6570\u7ec4 \u4e8c\u53c9\u641c\u7d22\u6811 \u67e5\u627e\u6307\u5b9a\u5143\u7d20 \\(O(n)\\) \\(O(\\log n)\\) \\(O(\\log n)\\) \u63d2\u5165\u5143\u7d20 \\(O(1)\\) \\(O(n)\\) \\(O(\\log n)\\) \u5220\u9664\u5143\u7d20 \\(O(n)\\) \\(O(n)\\) \\(O(\\log n)\\) \u83b7\u53d6\u6700\u5c0f / \u6700\u5927\u5143\u7d20 \\(O(n)\\) \\(O(1)\\) \\(O(\\log n)\\)"},{"location":"chapter_tree/binary_search_tree/#733","title":"7.3.3. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u9000\u5316","text":"

\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u662f\u201c\u5de6\u53f3\u5e73\u8861\u201d\u7684\uff08\u8be6\u89c1\u300c\u5e73\u8861\u4e8c\u53c9\u6811\u300d\u7ae0\u8282\uff09\uff0c\u6b64\u65f6\u53ef\u4ee5\u5728 \\(\\log n\\) \u8f6e\u5faa\u73af\u5185\u67e5\u627e\u4efb\u610f\u7ed3\u70b9\u3002

\u5982\u679c\u6211\u4eec\u52a8\u6001\u5730\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\uff0c\u5219\u53ef\u80fd\u5bfc\u81f4\u4e8c\u53c9\u6811\u9000\u5316\u4e3a\u94fe\u8868\uff0c\u6b64\u65f6\u5404\u79cd\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u9000\u5316\u4e4b \\(O(n)\\) \u3002

Note

\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5982\u4f55\u4fdd\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5e73\u8861\uff0c\u4e5f\u662f\u4e00\u4e2a\u9700\u8981\u91cd\u8981\u8003\u8651\u7684\u95ee\u9898\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u5e73\u8861\u4e0e\u9000\u5316

"},{"location":"chapter_tree/binary_search_tree/#734","title":"7.3.4. \u00a0 \u4e8c\u53c9\u641c\u7d22\u6811\u5e38\u89c1\u5e94\u7528","text":"
  • \u7cfb\u7edf\u4e2d\u7684\u591a\u7ea7\u7d22\u5f15\uff0c\u9ad8\u6548\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u3002
  • \u5404\u79cd\u641c\u7d22\u7b97\u6cd5\u7684\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u3002
  • \u5b58\u50a8\u6570\u636e\u6d41\uff0c\u4fdd\u6301\u5176\u5df2\u6392\u5e8f\u3002
"},{"location":"chapter_tree/binary_tree/","title":"7.1. \u00a0 \u4e8c\u53c9\u6811","text":"

\u300c\u4e8c\u53c9\u6811 Binary Tree\u300d\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u7740\u7956\u5148\u4e0e\u540e\u4ee3\u4e4b\u95f4\u7684\u6d3e\u751f\u5173\u7cfb\uff0c\u4f53\u73b0\u7740\u201c\u4e00\u5206\u4e3a\u4e8c\u201d\u7684\u5206\u6cbb\u903b\u8f91\u3002\u7c7b\u4f3c\u4e8e\u94fe\u8868\uff0c\u4e8c\u53c9\u6811\u4e5f\u662f\u4ee5\u7ed3\u70b9\u4e3a\u5355\u4f4d\u5b58\u50a8\u7684\uff0c\u7ed3\u70b9\u5305\u542b\u300c\u503c\u300d\u548c\u4e24\u4e2a\u300c\u6307\u9488\u300d\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nint val;         // \u7ed3\u70b9\u503c\nTreeNode left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) { val = x; }\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7ed3\u6784\u4f53 */\nstruct TreeNode {\nint val;          // \u7ed3\u70b9\u503c\nTreeNode *left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode *right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n};\n
\"\"\" \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b \"\"\"\nclass TreeNode:\ndef __init__(self, val: int):\nself.val: int = val                   # \u7ed3\u70b9\u503c\nself.left: Optional[TreeNode] = None  # \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nself.right: Optional[TreeNode] = None # \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7ed3\u6784\u4f53 */\ntype TreeNode struct {\nVal   int\nLeft  *TreeNode\nRight *TreeNode\n}\n/* \u7ed3\u70b9\u521d\u59cb\u5316\u65b9\u6cd5 */\nfunc NewTreeNode(v int) *TreeNode {\nreturn &TreeNode{\nLeft:  nil,\nRight: nil,\nVal:   v,\n}\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nfunction TreeNode(val, left, right) {\nthis.val = (val === undefined ? 0 : val); // \u7ed3\u70b9\u503c\nthis.left = (left === undefined ? null : left); // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nthis.right = (right === undefined ? null : right); // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nval: number;\nleft: TreeNode | null;\nright: TreeNode | null;\nconstructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {\nthis.val = val === undefined ? 0 : val; // \u7ed3\u70b9\u503c\nthis.left = left === undefined ? null : left; // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nthis.right = right === undefined ? null : right; // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\n}\n}\n
\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nint val;          // \u7ed3\u70b9\u503c\nTreeNode? left;   // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode? right;  // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\nTreeNode(int x) { val = x; }\n}\n
/* \u4e8c\u53c9\u6811\u7ed3\u70b9\u7c7b */\nclass TreeNode {\nvar val: Int // \u7ed3\u70b9\u503c\nvar left: TreeNode? // \u5de6\u5b50\u7ed3\u70b9\u6307\u9488\nvar right: TreeNode? // \u53f3\u5b50\u7ed3\u70b9\u6307\u9488\ninit(x: Int) {\nval = x\n}\n}\n
\n

\u7ed3\u70b9\u7684\u4e24\u4e2a\u6307\u9488\u5206\u522b\u6307\u5411\u300c\u5de6\u5b50\u7ed3\u70b9 Left Child Node\u300d\u548c\u300c\u53f3\u5b50\u7ed3\u70b9 Right Child Node\u300d\uff0c\u5e76\u4e14\u79f0\u8be5\u7ed3\u70b9\u4e3a\u4e24\u4e2a\u5b50\u7ed3\u70b9\u7684\u300c\u7236\u7ed3\u70b9 Parent Node\u300d\u3002\u7ed9\u5b9a\u4e8c\u53c9\u6811\u67d0\u7ed3\u70b9\uff0c\u5c06\u5de6\u5b50\u7ed3\u70b9\u4ee5\u4e0b\u7684\u6811\u79f0\u4e3a\u8be5\u7ed3\u70b9\u7684\u300c\u5de6\u5b50\u6811 Left Subtree\u300d\uff0c\u53f3\u5b50\u6811\u540c\u7406\u3002

\u9664\u4e86\u53f6\u7ed3\u70b9\u5916\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u90fd\u6709\u5b50\u7ed3\u70b9\u548c\u5b50\u6811\u3002\u4f8b\u5982\uff0c\u82e5\u5c06\u4e0b\u56fe\u7684\u300c\u7ed3\u70b9 2\u300d\u770b\u4f5c\u7236\u7ed3\u70b9\uff0c\u90a3\u4e48\u5176\u5de6\u5b50\u7ed3\u70b9\u548c\u53f3\u5b50\u7ed3\u70b9\u5206\u522b\u4e3a\u300c\u7ed3\u70b9 4\u300d\u548c\u300c\u7ed3\u70b9 5\u300d\uff0c\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u5206\u522b\u4e3a\u300c\u7ed3\u70b9 4 \u53ca\u5176\u4ee5\u4e0b\u7ed3\u70b9\u5f62\u6210\u7684\u6811\u300d\u548c\u300c\u7ed3\u70b9 5 \u53ca\u5176\u4ee5\u4e0b\u7ed3\u70b9\u5f62\u6210\u7684\u6811\u300d\u3002

Fig. \u7236\u7ed3\u70b9\u3001\u5b50\u7ed3\u70b9\u3001\u5b50\u6811

"},{"location":"chapter_tree/binary_tree/#711","title":"7.1.1. \u00a0 \u4e8c\u53c9\u6811\u5e38\u89c1\u672f\u8bed","text":"

\u4e8c\u53c9\u6811\u7684\u672f\u8bed\u8f83\u591a\uff0c\u5efa\u8bae\u5c3d\u91cf\u7406\u89e3\u5e76\u8bb0\u4f4f\u3002\u540e\u7eed\u53ef\u80fd\u9057\u5fd8\uff0c\u53ef\u4ee5\u5728\u9700\u8981\u4f7f\u7528\u65f6\u56de\u6765\u67e5\u770b\u786e\u8ba4\u3002

  • \u300c\u6839\u7ed3\u70b9 Root Node\u300d\uff1a\u4e8c\u53c9\u6811\u6700\u9876\u5c42\u7684\u7ed3\u70b9\uff0c\u5176\u6ca1\u6709\u7236\u7ed3\u70b9\uff1b
  • \u300c\u53f6\u7ed3\u70b9 Leaf Node\u300d\uff1a\u6ca1\u6709\u5b50\u7ed3\u70b9\u7684\u7ed3\u70b9\uff0c\u5176\u4e24\u4e2a\u6307\u9488\u90fd\u6307\u5411 \\(\\text{null}\\) \uff1b
  • \u7ed3\u70b9\u6240\u5904\u300c\u5c42 Level\u300d\uff1a\u4ece\u9876\u81f3\u5e95\u4f9d\u6b21\u589e\u52a0\uff0c\u6839\u7ed3\u70b9\u6240\u5904\u5c42\u4e3a 1 \uff1b
  • \u7ed3\u70b9\u300c\u5ea6 Degree\u300d\uff1a\u7ed3\u70b9\u7684\u5b50\u7ed3\u70b9\u6570\u91cf\u3002\u4e8c\u53c9\u6811\u4e2d\uff0c\u5ea6\u7684\u8303\u56f4\u662f 0, 1, 2 \uff1b
  • \u300c\u8fb9 Edge\u300d\uff1a\u8fde\u63a5\u4e24\u4e2a\u7ed3\u70b9\u7684\u8fb9\uff0c\u5373\u7ed3\u70b9\u6307\u9488\uff1b
  • \u4e8c\u53c9\u6811\u300c\u9ad8\u5ea6\u300d\uff1a\u4e8c\u53c9\u6811\u4e2d\u6839\u7ed3\u70b9\u5230\u6700\u8fdc\u53f6\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b
  • \u7ed3\u70b9\u300c\u6df1\u5ea6 Depth\u300d \uff1a\u6839\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b
  • \u7ed3\u70b9\u300c\u9ad8\u5ea6 Height\u300d\uff1a\u6700\u8fdc\u53f6\u7ed3\u70b9\u5230\u8be5\u7ed3\u70b9\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\uff1b

Fig. \u4e8c\u53c9\u6811\u7684\u5e38\u7528\u672f\u8bed

\u9ad8\u5ea6\u4e0e\u6df1\u5ea6\u7684\u5b9a\u4e49

\u503c\u5f97\u6ce8\u610f\uff0c\u6211\u4eec\u901a\u5e38\u5c06\u300c\u9ad8\u5ea6\u300d\u548c\u300c\u6df1\u5ea6\u300d\u5b9a\u4e49\u4e3a\u201c\u8d70\u8fc7\u8fb9\u7684\u6570\u91cf\u201d\uff0c\u800c\u6709\u4e9b\u9898\u76ee\u6216\u6559\u6750\u4f1a\u5c06\u5176\u5b9a\u4e49\u4e3a\u201c\u8d70\u8fc7\u7ed3\u70b9\u7684\u6570\u91cf\u201d\uff0c\u6b64\u65f6\u9ad8\u5ea6\u6216\u6df1\u5ea6\u90fd\u9700\u8981 + 1 \u3002

"},{"location":"chapter_tree/binary_tree/#712","title":"7.1.2. \u00a0 \u4e8c\u53c9\u6811\u57fa\u672c\u64cd\u4f5c","text":"

\u521d\u59cb\u5316\u4e8c\u53c9\u6811\u3002\u4e0e\u94fe\u8868\u7c7b\u4f3c\uff0c\u5148\u521d\u59cb\u5316\u7ed3\u70b9\uff0c\u518d\u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree.java
// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode n1 = new TreeNode(1);\nTreeNode n2 = new TreeNode(2);\nTreeNode n3 = new TreeNode(3);\nTreeNode n4 = new TreeNode(4);\nTreeNode n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.cpp
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode* n1 = new TreeNode(1);\nTreeNode* n2 = new TreeNode(2);\nTreeNode* n3 = new TreeNode(3);\nTreeNode* n4 = new TreeNode(4);\nTreeNode* n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1->left = n2;\nn1->right = n3;\nn2->left = n4;\nn2->right = n5;\n
binary_tree.py
\"\"\" \u521d\u59cb\u5316\u4e8c\u53c9\u6811 \"\"\"\n# \u521d\u59cb\u5316\u7ed3\u70b9\nn1 = TreeNode(val=1)\nn2 = TreeNode(val=2)\nn3 = TreeNode(val=3)\nn4 = TreeNode(val=4)\nn5 = TreeNode(val=5)\n# \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2\nn1.right = n3\nn2.left = n4\nn2.right = n5\n
binary_tree.go
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nn1 := NewTreeNode(1)\nn2 := NewTreeNode(2)\nn3 := NewTreeNode(3)\nn4 := NewTreeNode(4)\nn5 := NewTreeNode(5)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.Left = n2\nn1.Right = n3\nn2.Left = n4\nn2.Right = n5\n
binary_tree.js
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = new TreeNode(1),\nn2 = new TreeNode(2),\nn3 = new TreeNode(3),\nn4 = new TreeNode(4),\nn5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.ts
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = new TreeNode(1),\nn2 = new TreeNode(2),\nn3 = new TreeNode(3),\nn4 = new TreeNode(4),\nn5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.c
\n
binary_tree.cs
/* \u521d\u59cb\u5316\u4e8c\u53c9\u6811 */\n// \u521d\u59cb\u5316\u7ed3\u70b9\nTreeNode n1 = new TreeNode(1);\nTreeNode n2 = new TreeNode(2);\nTreeNode n3 = new TreeNode(3);\nTreeNode n4 = new TreeNode(4);\nTreeNode n5 = new TreeNode(5);\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2;\nn1.right = n3;\nn2.left = n4;\nn2.right = n5;\n
binary_tree.swift
// \u521d\u59cb\u5316\u7ed3\u70b9\nlet n1 = TreeNode(x: 1)\nlet n2 = TreeNode(x: 2)\nlet n3 = TreeNode(x: 3)\nlet n4 = TreeNode(x: 4)\nlet n5 = TreeNode(x: 5)\n// \u6784\u5efa\u5f15\u7528\u6307\u5411\uff08\u5373\u6307\u9488\uff09\nn1.left = n2\nn1.right = n3\nn2.left = n4\nn2.right = n5\n
binary_tree.zig
\n

\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u3002\u4e0e\u94fe\u8868\u7c7b\u4f3c\uff0c\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u90fd\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u6307\u9488\u5b9e\u73b0\u3002

Fig. \u5728\u4e8c\u53c9\u6811\u4e2d\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree.java
TreeNode P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.cpp
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nTreeNode* P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1->left = P;\nP->left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1->left = n2;\n
binary_tree.py
\"\"\" \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 \"\"\"\np = TreeNode(0)\n# \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = p\np.left = n2\n# \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2\n
binary_tree.go
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\np := NewTreeNode(0)\nn1.Left = p\np.Left = n2\n// \u5220\u9664\u7ed3\u70b9 P\nn1.Left = n2\n
binary_tree.js
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nlet P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.ts
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nconst P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.c
\n
binary_tree.cs
/* \u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9 */\nTreeNode P = new TreeNode(0);\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P;\nP.left = n2;\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2;\n
binary_tree.swift
let P = TreeNode(x: 0)\n// \u5728 n1 -> n2 \u4e2d\u95f4\u63d2\u5165\u7ed3\u70b9 P\nn1.left = P\nP.left = n2\n// \u5220\u9664\u7ed3\u70b9 P\nn1.left = n2\n
binary_tree.zig
\n

Note

\u63d2\u5165\u7ed3\u70b9\u4f1a\u6539\u53d8\u4e8c\u53c9\u6811\u7684\u539f\u6709\u903b\u8f91\u7ed3\u6784\uff0c\u5220\u9664\u7ed3\u70b9\u5f80\u5f80\u610f\u5473\u7740\u5220\u9664\u4e86\u8be5\u7ed3\u70b9\u7684\u6240\u6709\u5b50\u6811\u3002\u56e0\u6b64\uff0c\u4e8c\u53c9\u6811\u4e2d\u7684\u63d2\u5165\u4e0e\u5220\u9664\u4e00\u822c\u90fd\u662f\u7531\u4e00\u5957\u64cd\u4f5c\u914d\u5408\u5b8c\u6210\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5b9e\u73b0\u6709\u610f\u4e49\u7684\u64cd\u4f5c\u3002

"},{"location":"chapter_tree/binary_tree/#713","title":"7.1.3. \u00a0 \u5e38\u89c1\u4e8c\u53c9\u6811\u7c7b\u578b","text":""},{"location":"chapter_tree/binary_tree/#_1","title":"\u5b8c\u7f8e\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811 Perfect Binary Tree\u300d\u7684\u6240\u6709\u5c42\u7684\u7ed3\u70b9\u90fd\u88ab\u5b8c\u5168\u586b\u6ee1\u3002\u5728\u5b8c\u7f8e\u4e8c\u53c9\u6811\u4e2d\uff0c\u6240\u6709\u7ed3\u70b9\u7684\u5ea6 = 2 \uff1b\u82e5\u6811\u9ad8\u5ea6 \\(= h\\) \uff0c\u5219\u7ed3\u70b9\u603b\u6570 \\(= 2^{h+1} - 1\\) \uff0c\u5448\u6807\u51c6\u7684\u6307\u6570\u7ea7\u5173\u7cfb\uff0c\u53cd\u6620\u7740\u81ea\u7136\u754c\u4e2d\u5e38\u89c1\u7684\u7ec6\u80de\u5206\u88c2\u3002

Tip

\u5728\u4e2d\u6587\u793e\u533a\u4e2d\uff0c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u5e38\u88ab\u79f0\u4e3a\u300c\u6ee1\u4e8c\u53c9\u6811\u300d\uff0c\u8bf7\u6ce8\u610f\u4e0e\u5b8c\u6ee1\u4e8c\u53c9\u6811\u533a\u5206\u3002

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_2","title":"\u5b8c\u5168\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u5168\u4e8c\u53c9\u6811 Complete Binary Tree\u300d\u53ea\u6709\u6700\u5e95\u5c42\u7684\u7ed3\u70b9\u672a\u88ab\u586b\u6ee1\uff0c\u4e14\u6700\u5e95\u5c42\u7ed3\u70b9\u5c3d\u91cf\u9760\u5de6\u586b\u5145\u3002

\u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u7528\u6570\u7ec4\u6765\u8868\u793a\u3002\u5982\u679c\u6309\u7167\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u987a\u5e8f\u6765\u5b58\u50a8\uff0c\u90a3\u4e48\u7a7a\u7ed3\u70b9 null \u4e00\u5b9a\u5168\u90e8\u51fa\u73b0\u5728\u5e8f\u5217\u7684\u5c3e\u90e8\uff0c\u56e0\u6b64\u6211\u4eec\u5c31\u53ef\u4ee5\u4e0d\u7528\u5b58\u50a8\u8fd9\u4e9b null \u4e86\u3002

Fig. \u5b8c\u5168\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_3","title":"\u5b8c\u6ee1\u4e8c\u53c9\u6811","text":"

\u300c\u5b8c\u6ee1\u4e8c\u53c9\u6811 Full Binary Tree\u300d\u9664\u4e86\u53f6\u7ed3\u70b9\u4e4b\u5916\uff0c\u5176\u4f59\u6240\u6709\u7ed3\u70b9\u90fd\u6709\u4e24\u4e2a\u5b50\u7ed3\u70b9\u3002

Fig. \u5b8c\u6ee1\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#_4","title":"\u5e73\u8861\u4e8c\u53c9\u6811","text":"

\u300c\u5e73\u8861\u4e8c\u53c9\u6811 Balanced Binary Tree\u300d\u4e2d\u4efb\u610f\u7ed3\u70b9\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u4e4b\u5dee\u7684\u7edd\u5bf9\u503c \\(\\leq 1\\) \u3002

Fig. \u5e73\u8861\u4e8c\u53c9\u6811

"},{"location":"chapter_tree/binary_tree/#714","title":"7.1.4. \u00a0 \u4e8c\u53c9\u6811\u7684\u9000\u5316","text":"

\u5f53\u4e8c\u53c9\u6811\u7684\u6bcf\u5c42\u7684\u7ed3\u70b9\u90fd\u88ab\u586b\u6ee1\u65f6\uff0c\u8fbe\u5230\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff1b\u800c\u5f53\u6240\u6709\u7ed3\u70b9\u90fd\u504f\u5411\u4e00\u8fb9\u65f6\uff0c\u4e8c\u53c9\u6811\u9000\u5316\u4e3a\u300c\u94fe\u8868\u300d\u3002

  • \u5b8c\u7f8e\u4e8c\u53c9\u6811\u662f\u4e00\u4e2a\u4e8c\u53c9\u6811\u7684\u201c\u6700\u4f73\u72b6\u6001\u201d\uff0c\u53ef\u4ee5\u5b8c\u5168\u53d1\u6325\u51fa\u4e8c\u53c9\u6811\u201c\u5206\u6cbb\u201d\u7684\u4f18\u52bf\uff1b
  • \u94fe\u8868\u5219\u662f\u53e6\u4e00\u4e2a\u6781\u7aef\uff0c\u5404\u9879\u64cd\u4f5c\u90fd\u53d8\u4e3a\u7ebf\u6027\u64cd\u4f5c\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u9000\u5316\u81f3 \\(O(n)\\) \uff1b

Fig. \u4e8c\u53c9\u6811\u7684\u6700\u4f73\u4e0e\u6700\u4e8c\u53c9\u6811\u7684\u6700\u4f73\u548c\u6700\u5dee\u7ed3\u6784\u5dee\u60c5\u51b5

\u5982\u4e0b\u8868\u6240\u793a\uff0c\u5728\u6700\u4f73\u548c\u6700\u5dee\u7ed3\u6784\u4e0b\uff0c\u4e8c\u53c9\u6811\u7684\u53f6\u7ed3\u70b9\u6570\u91cf\u3001\u7ed3\u70b9\u603b\u6570\u3001\u9ad8\u5ea6\u7b49\u8fbe\u5230\u6781\u5927\u6216\u6781\u5c0f\u503c\u3002

\u5b8c\u7f8e\u4e8c\u53c9\u6811 \u94fe\u8868 \u7b2c \\(i\\) \u5c42\u7684\u7ed3\u70b9\u6570\u91cf \\(2^{i-1}\\) \\(1\\) \u6811\u7684\u9ad8\u5ea6\u4e3a \\(h\\) \u65f6\u7684\u53f6\u7ed3\u70b9\u6570\u91cf \\(2^h\\) \\(1\\) \u6811\u7684\u9ad8\u5ea6\u4e3a \\(h\\) \u65f6\u7684\u7ed3\u70b9\u603b\u6570 \\(2^{h+1} - 1\\) \\(h + 1\\) \u6811\u7684\u7ed3\u70b9\u603b\u6570\u4e3a \\(n\\) \u65f6\u7684\u9ad8\u5ea6 \\(\\log_2 (n+1) - 1\\) \\(n - 1\\)"},{"location":"chapter_tree/binary_tree/#715","title":"7.1.5. \u00a0 \u4e8c\u53c9\u6811\u8868\u793a\u65b9\u5f0f *","text":"

\u6211\u4eec\u4e00\u822c\u4f7f\u7528\u4e8c\u53c9\u6811\u7684\u300c\u94fe\u8868\u8868\u793a\u300d\uff0c\u5373\u5b58\u50a8\u5355\u4f4d\u4e3a\u7ed3\u70b9 TreeNode \uff0c\u7ed3\u70b9\u4e4b\u95f4\u901a\u8fc7\u6307\u9488\uff08\u5f15\u7528\uff09\u76f8\u8fde\u63a5\u3002\u672c\u6587\u524d\u8ff0\u793a\u4f8b\u4ee3\u7801\u5c55\u793a\u4e86\u4e8c\u53c9\u6811\u5728\u94fe\u8868\u8868\u793a\u4e0b\u7684\u5404\u9879\u57fa\u672c\u64cd\u4f5c\u3002

\u90a3\u80fd\u5426\u53ef\u4ee5\u7528\u300c\u6570\u7ec4\u8868\u793a\u300d\u4e8c\u53c9\u6811\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\u3002\u5148\u6765\u5206\u6790\u4e00\u4e2a\u7b80\u5355\u6848\u4f8b\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u300c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u300d\uff0c\u5c06\u7ed3\u70b9\u6309\u7167\u5c42\u5e8f\u904d\u5386\u7684\u987a\u5e8f\u7f16\u53f7\uff08\u4ece 0 \u5f00\u59cb\uff09\uff0c\u90a3\u4e48\u53ef\u4ee5\u63a8\u5bfc\u5f97\u51fa\u7236\u7ed3\u70b9\u7d22\u5f15\u4e0e\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e4b\u95f4\u7684\u300c\u6620\u5c04\u516c\u5f0f\u300d\uff1a\u8bbe\u7ed3\u70b9\u7684\u7d22\u5f15\u4e3a \\(i\\) \uff0c\u5219\u8be5\u7ed3\u70b9\u7684\u5de6\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 1\\) \u3001\u53f3\u5b50\u7ed3\u70b9\u7d22\u5f15\u4e3a \\(2i + 2\\) \u3002

\u672c\u8d28\u4e0a\uff0c\u6620\u5c04\u516c\u5f0f\u7684\u4f5c\u7528\u5c31\u662f\u94fe\u8868\u4e2d\u7684\u6307\u9488\u3002\u5bf9\u4e8e\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u4e2d\u7684\u4efb\u610f\u7ed3\u70b9\uff0c\u6211\u4eec\u90fd\u53ef\u4ee5\u4f7f\u7528\u6620\u5c04\u516c\u5f0f\u6765\u8bbf\u95ee\u5b50\u7ed3\u70b9\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\uff08\u5373\u6570\u7ec4\uff09\u6765\u8868\u793a\u5b8c\u7f8e\u4e8c\u53c9\u6811\u3002

Fig. \u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u7136\u800c\uff0c\u5b8c\u7f8e\u4e8c\u53c9\u6811\u53ea\u662f\u4e2a\u4f8b\uff0c\u4e8c\u53c9\u6811\u4e2d\u95f4\u5c42\u5f80\u5f80\u5b58\u5728\u8bb8\u591a\u7a7a\u7ed3\u70b9\uff08\u5373 null \uff09\uff0c\u800c\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u5e76\u4e0d\u5305\u542b\u8fd9\u4e9b\u7a7a\u7ed3\u70b9\uff0c\u5e76\u4e14\u6211\u4eec\u65e0\u6cd5\u5355\u51ed\u5e8f\u5217\u6765\u731c\u6d4b\u7a7a\u7ed3\u70b9\u7684\u6570\u91cf\u548c\u5206\u5e03\u4f4d\u7f6e\uff0c\u5373\u7406\u8bba\u4e0a\u5b58\u5728\u8bb8\u591a\u79cd\u4e8c\u53c9\u6811\u90fd\u7b26\u5408\u8be5\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u3002\u663e\u7136\uff0c\u8fd9\u79cd\u60c5\u51b5\u65e0\u6cd5\u4f7f\u7528\u6570\u7ec4\u6765\u5b58\u50a8\u4e8c\u53c9\u6811\u3002

Fig. \u7ed9\u5b9a\u6570\u7ec4\u5bf9\u5e94\u591a\u79cd\u4e8c\u53c9\u6811\u53ef\u80fd\u6027

\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8003\u8651\u6309\u7167\u5b8c\u7f8e\u4e8c\u53c9\u6811\u7684\u5f62\u5f0f\u6765\u8868\u793a\u6240\u6709\u4e8c\u53c9\u6811\uff0c\u5373\u5728\u5e8f\u5217\u4e2d\u4f7f\u7528\u7279\u6b8a\u7b26\u53f7\u6765\u663e\u5f0f\u5730\u8868\u793a\u201c\u7a7a\u4f4d\u201d\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8fd9\u6837\u5904\u7406\u540e\uff0c\u5e8f\u5217\uff08\u6570\u7ec4\uff09\u5c31\u53ef\u4ee5\u552f\u4e00\u8868\u793a\u4e8c\u53c9\u6811\u4e86\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 int \u7684\u5305\u88c5\u7c7b Integer \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 null \u6765\u6807\u8bb0\u7a7a\u4f4d\nInteger[] tree = { 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 };\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4e3a\u4e86\u7b26\u5408\u6570\u636e\u7c7b\u578b\u4e3a int \uff0c\u4f7f\u7528 int \u6700\u5927\u503c\u6807\u8bb0\u7a7a\u4f4d\n// \u8be5\u65b9\u6cd5\u7684\u4f7f\u7528\u524d\u63d0\u662f\u6ca1\u6709\u7ed3\u70b9\u7684\u503c = INT_MAX\nvector<int> tree = { 1, 2, 3, 4, INT_MAX, 6, 7, 8, 9, INT_MAX, INT_MAX, 12, INT_MAX, INT_MAX, 15 };\n
\"\"\" \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a \"\"\"\n# \u76f4\u63a5\u4f7f\u7528 None \u6765\u8868\u793a\u7a7a\u4f4d\ntree = [1, 2, 3, 4, None, 6, 7, 8, 9, None, None, 12, None, None, 15]\n
\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u76f4\u63a5\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u4f4d\nlet tree = [1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15];\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u76f4\u63a5\u4f7f\u7528 null \u6765\u8868\u793a\u7a7a\u4f4d\nlet tree: (number | null)[] = [1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15];\n
\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 int? \u53ef\u7a7a\u7c7b\u578b \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 null \u6765\u6807\u8bb0\u7a7a\u4f4d\nint?[] tree = { 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 };\n
/* \u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a */\n// \u4f7f\u7528 Int? \u53ef\u7a7a\u7c7b\u578b \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 nil \u6765\u6807\u8bb0\u7a7a\u4f4d\nlet tree: [Int?] = [1, 2, 3, 4, nil, 6, 7, 8, 9, nil, nil, 12, nil, nil, 15]\n
\n

Fig. \u4efb\u610f\u7c7b\u578b\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u56de\u987e\u300c\u5b8c\u5168\u4e8c\u53c9\u6811\u300d\u7684\u5b9a\u4e49\uff0c\u5176\u53ea\u6709\u6700\u5e95\u5c42\u6709\u7a7a\u7ed3\u70b9\uff0c\u5e76\u4e14\u6700\u5e95\u5c42\u7684\u7ed3\u70b9\u5c3d\u91cf\u9760\u5de6\uff0c\u56e0\u800c\u6240\u6709\u7a7a\u7ed3\u70b9\u90fd\u4e00\u5b9a\u51fa\u73b0\u5728\u5c42\u5e8f\u904d\u5386\u5e8f\u5217\u7684\u672b\u5c3e\u3002\u56e0\u4e3a\u6211\u4eec\u5148\u9a8c\u5730\u786e\u5b9a\u4e86\u7a7a\u4f4d\u7684\u4f4d\u7f6e\uff0c\u6240\u4ee5\u5728\u4f7f\u7528\u6570\u7ec4\u8868\u793a\u5b8c\u5168\u4e8c\u53c9\u6811\u65f6\uff0c\u53ef\u4ee5\u7701\u7565\u5b58\u50a8\u201c\u7a7a\u4f4d\u201d\u3002\u56e0\u6b64\uff0c\u5b8c\u5168\u4e8c\u53c9\u6811\u975e\u5e38\u9002\u5408\u4f7f\u7528\u6570\u7ec4\u6765\u8868\u793a\u3002

Fig. \u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u6570\u7ec4\u8868\u793a

\u6570\u7ec4\u8868\u793a\u6709\u4e24\u4e2a\u4f18\u70b9\uff1a \u4e00\u662f\u4e0d\u9700\u8981\u5b58\u50a8\u6307\u9488\uff0c\u8282\u7701\u7a7a\u95f4\uff1b\u4e8c\u662f\u53ef\u4ee5\u968f\u673a\u8bbf\u95ee\u7ed3\u70b9\u3002\u7136\u800c\uff0c\u5f53\u4e8c\u53c9\u6811\u4e2d\u7684\u201c\u7a7a\u4f4d\u201d\u5f88\u591a\u65f6\uff0c\u6570\u7ec4\u4e2d\u53ea\u5305\u542b\u5f88\u5c11\u7ed3\u70b9\u7684\u6570\u636e\uff0c\u7a7a\u95f4\u5229\u7528\u7387\u5f88\u4f4e\u3002

"},{"location":"chapter_tree/binary_tree_traversal/","title":"7.2. \u00a0 \u4e8c\u53c9\u6811\u904d\u5386","text":"

\u4ece\u7269\u7406\u7ed3\u6784\u89d2\u5ea6\u770b\uff0c\u6811\u662f\u4e00\u79cd\u57fa\u4e8e\u94fe\u8868\u7684\u6570\u636e\u7ed3\u6784\uff0c\u56e0\u6b64\u904d\u5386\u65b9\u5f0f\u4e5f\u662f\u901a\u8fc7\u6307\u9488\uff08\u5373\u5f15\u7528\uff09\u9010\u4e2a\u904d\u5386\u7ed3\u70b9\u3002\u540c\u65f6\uff0c\u6811\u8fd8\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u8fd9\u5bfc\u81f4\u904d\u5386\u6811\u6bd4\u904d\u5386\u94fe\u8868\u66f4\u52a0\u590d\u6742\uff0c\u9700\u8981\u4f7f\u7528\u641c\u7d22\u7b97\u6cd5\u6765\u5b9e\u73b0\u3002

\u5e38\u89c1\u7684\u4e8c\u53c9\u6811\u904d\u5386\u65b9\u5f0f\u6709\u5c42\u5e8f\u904d\u5386\u3001\u524d\u5e8f\u904d\u5386\u3001\u4e2d\u5e8f\u904d\u5386\u3001\u540e\u5e8f\u904d\u5386\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#721","title":"7.2.1. \u00a0 \u5c42\u5e8f\u904d\u5386","text":"

\u300c\u5c42\u5e8f\u904d\u5386 Level-Order Traversal\u300d\u4ece\u9876\u81f3\u5e95\u3001\u4e00\u5c42\u4e00\u5c42\u5730\u904d\u5386\u4e8c\u53c9\u6811\uff0c\u5e76\u5728\u6bcf\u5c42\u4e2d\u6309\u7167\u4ece\u5de6\u5230\u53f3\u7684\u987a\u5e8f\u8bbf\u95ee\u7ed3\u70b9\u3002

\u5c42\u5e8f\u904d\u5386\u672c\u8d28\u4e0a\u662f\u300c\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22 Breadth-First Traversal\u300d\uff0c\u5176\u4f53\u73b0\u7740\u4e00\u79cd\u201c\u4e00\u5708\u4e00\u5708\u5411\u5916\u201d\u7684\u5c42\u8fdb\u904d\u5386\u65b9\u5f0f\u3002

Fig. \u4e8c\u53c9\u6811\u7684\u5c42\u5e8f\u904d\u5386

"},{"location":"chapter_tree/binary_tree_traversal/#_1","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"

\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u4e00\u822c\u501f\u52a9\u300c\u961f\u5217\u300d\u6765\u5b9e\u73b0\u3002\u961f\u5217\u7684\u89c4\u5219\u662f\u201c\u5148\u8fdb\u5148\u51fa\u201d\uff0c\u5e7f\u5ea6\u4f18\u5148\u904d\u5386\u7684\u89c4\u5219\u662f \u201d\u4e00\u5c42\u5c42\u5e73\u63a8\u201c \uff0c\u4e24\u8005\u80cc\u540e\u7684\u601d\u60f3\u662f\u4e00\u81f4\u7684\u3002

JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree_bfs.java
/* \u5c42\u5e8f\u904d\u5386 */\nList<Integer> levelOrder(TreeNode root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nQueue<TreeNode> queue = new LinkedList<>() {{ add(root); }};\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nList<Integer> list = new ArrayList<>();\nwhile (!queue.isEmpty()) {\nTreeNode node = queue.poll();  // \u961f\u5217\u51fa\u961f\nlist.add(node.val);            // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null)\nqueue.offer(node.left);    // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right != null)\nqueue.offer(node.right);   // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.cpp
/* \u5c42\u5e8f\u904d\u5386 */\nvector<int> levelOrder(TreeNode* root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue<TreeNode*> queue;\nqueue.push(root);\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvector<int> vec;\nwhile (!queue.empty()) {\nTreeNode* node = queue.front();\nqueue.pop();                 // \u961f\u5217\u51fa\u961f\nvec.push_back(node->val);    // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node->left != nullptr)\nqueue.push(node->left);  // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node->right != nullptr)\nqueue.push(node->right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn vec;\n}\n
binary_tree_bfs.py
def level_order(root: Optional[TreeNode]) -> List[int]:\n\"\"\" \u5c42\u5e8f\u904d\u5386 \"\"\"\n# \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue: Deque[TreeNode] = collections.deque()\nqueue.append(root)\n# \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nres: List[int] = []\nwhile queue:\nnode: TreeNode = queue.popleft() # \u961f\u5217\u51fa\u961f\nres.append(node.val)             # \u4fdd\u5b58\u7ed3\u70b9\u503c\nif node.left is not None:\nqueue.append(node.left)      # \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif node.right is not None:\nqueue.append(node.right)     # \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\nreturn res\n
binary_tree_bfs.go
/* \u5c42\u5e8f\u904d\u5386 */\nfunc levelOrder(root *TreeNode) []int {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nqueue := list.New()\nqueue.PushBack(root)\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5207\u7247\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nnums := make([]int, 0)\nfor queue.Len() > 0 {\n// \u961f\u5217\u51fa\u961f\nnode := queue.Remove(queue.Front()).(*TreeNode)\n// \u4fdd\u5b58\u7ed3\u70b9\u503c\nnums = append(nums, node.Val)\nif node.Left != nil {\n// \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nqueue.PushBack(node.Left)\n}\nif node.Right != nil {\n// \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\nqueue.PushBack(node.Right)\n}\n}\nreturn nums\n}\n
binary_tree_bfs.js
/* \u5c42\u5e8f\u904d\u5386 */\nfunction levelOrder(root) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst queue = [root];\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nconst list = [];\nwhile (queue.length) {\nlet node = queue.shift();   // \u961f\u5217\u51fa\u961f\nlist.push(node.val);        // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left)\nqueue.push(node.left);  // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right)\nqueue.push(node.right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.ts
/* \u5c42\u5e8f\u904d\u5386 */\nfunction levelOrder(root: TreeNode | null): number[] {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst queue = [root];\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nconst list: number[] = [];\nwhile (queue.length) {\nlet node = queue.shift() as TreeNode; // \u961f\u5217\u51fa\u961f\nlist.push(node.val); // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left) {\nqueue.push(node.left); // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif (node.right) {\nqueue.push(node.right); // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\n}\nreturn list;\n}\n
binary_tree_bfs.c
[class]{}-[func]{levelOrder}\n
binary_tree_bfs.cs
/* \u5c42\u5e8f\u904d\u5386 */\nList<int> levelOrder(TreeNode root)\n{\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nQueue<TreeNode> queue = new();\nqueue.Enqueue(root);\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nList<int> list = new();\nwhile (queue.Count != 0)\n{\nTreeNode node = queue.Dequeue(); // \u961f\u5217\u51fa\u961f\nlist.Add(node.val);              // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null)\nqueue.Enqueue(node.left);    // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\nif (node.right != null)\nqueue.Enqueue(node.right);   // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\nreturn list;\n}\n
binary_tree_bfs.swift
/* \u5c42\u5e8f\u904d\u5386 */\nfunc levelOrder(root: TreeNode) -> [Int] {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nvar queue: [TreeNode] = [root]\n// \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvar list: [Int] = []\nwhile !queue.isEmpty {\nlet node = queue.removeFirst() // \u961f\u5217\u51fa\u961f\nlist.append(node.val) // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif let left = node.left {\nqueue.append(left) // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif let right = node.right {\nqueue.append(right) // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}\n}\nreturn list\n}\n
binary_tree_bfs.zig
// \u5c42\u5e8f\u904d\u5386\nfn levelOrder(comptime T: type, mem_allocator: std.mem.Allocator, root: *inc.TreeNode(T)) !std.ArrayList(T) {\n// \u521d\u59cb\u5316\u961f\u5217\uff0c\u52a0\u5165\u6839\u7ed3\u70b9\nconst L = std.TailQueue(*inc.TreeNode(T));\nvar queue = L{};\nvar root_node = try mem_allocator.create(L.Node);\nroot_node.data = root;\nqueue.append(root_node); // \u521d\u59cb\u5316\u4e00\u4e2a\u5217\u8868\uff0c\u7528\u4e8e\u4fdd\u5b58\u904d\u5386\u5e8f\u5217\nvar list = std.ArrayList(T).init(std.heap.page_allocator);\nwhile (queue.len > 0) {\nvar queue_node = queue.popFirst().?;    // \u961f\u5217\u51fa\u961f\nvar node = queue_node.data;\ntry list.append(node.val);              // \u4fdd\u5b58\u7ed3\u70b9\u503c\nif (node.left != null) {\nvar tmp_node = try mem_allocator.create(L.Node);\ntmp_node.data = node.left.?;\nqueue.append(tmp_node);             // \u5de6\u5b50\u7ed3\u70b9\u5165\u961f\n}\nif (node.right != null) {\nvar tmp_node = try mem_allocator.create(L.Node);\ntmp_node.data = node.right.?;\nqueue.append(tmp_node);             // \u53f3\u5b50\u7ed3\u70b9\u5165\u961f\n}        }\nreturn list;\n}\n
"},{"location":"chapter_tree/binary_tree_traversal/#_2","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u6240\u6709\u7ed3\u70b9\u88ab\u8bbf\u95ee\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d \\(n\\) \u4e3a\u7ed3\u70b9\u6570\u91cf\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a\u5f53\u4e3a\u6ee1\u4e8c\u53c9\u6811\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u904d\u5386\u5230\u6700\u5e95\u5c42\u524d\uff0c\u961f\u5217\u4e2d\u6700\u591a\u540c\u65f6\u5b58\u5728 \\(\\frac{n + 1}{2}\\) \u4e2a\u7ed3\u70b9\uff0c\u4f7f\u7528 \\(O(n)\\) \u7a7a\u95f4\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#722","title":"7.2.2. \u00a0 \u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386","text":"

\u76f8\u5bf9\u5730\uff0c\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386\u7686\u5c5e\u4e8e\u300c\u6df1\u5ea6\u4f18\u5148\u904d\u5386 Depth-First Traversal\u300d\uff0c\u5176\u4f53\u73b0\u7740\u4e00\u79cd\u201c\u5148\u8d70\u5230\u5c3d\u5934\uff0c\u518d\u56de\u5934\u7ee7\u7eed\u201d\u7684\u56de\u6eaf\u904d\u5386\u65b9\u5f0f\u3002

\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5de6\u4fa7\u662f\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u7684\u7684\u793a\u610f\u56fe\uff0c\u53f3\u4e0a\u65b9\u662f\u5bf9\u5e94\u7684\u9012\u5f52\u5b9e\u73b0\u4ee3\u7801\u3002\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u5c31\u50cf\u662f\u7ed5\u7740\u6574\u4e2a\u4e8c\u53c9\u6811\u7684\u5916\u56f4\u201c\u8d70\u201d\u4e00\u5708\uff0c\u8d70\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5728\u6bcf\u4e2a\u7ed3\u70b9\u90fd\u4f1a\u9047\u5230\u4e09\u4e2a\u4f4d\u7f6e\uff0c\u5206\u522b\u5bf9\u5e94\u524d\u5e8f\u904d\u5386\u3001\u4e2d\u5e8f\u904d\u5386\u3001\u540e\u5e8f\u904d\u5386\u3002

Fig. \u4e8c\u53c9\u641c\u7d22\u6811\u7684\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386

\u4f4d\u7f6e \u542b\u4e49 \u6b64\u5904\u8bbf\u95ee\u7ed3\u70b9\u65f6\u5bf9\u5e94 \u6a59\u8272\u5706\u5708\u5904 \u521a\u8fdb\u5165\u6b64\u7ed3\u70b9\uff0c\u5373\u5c06\u8bbf\u95ee\u8be5\u7ed3\u70b9\u7684\u5de6\u5b50\u6811 \u524d\u5e8f\u904d\u5386 Pre-Order Traversal \u84dd\u8272\u5706\u5708\u5904 \u5df2\u8bbf\u95ee\u5b8c\u5de6\u5b50\u6811\uff0c\u5373\u5c06\u8bbf\u95ee\u53f3\u5b50\u6811 \u4e2d\u5e8f\u904d\u5386 In-Order Traversal \u7d2b\u8272\u5706\u5708\u5904 \u5df2\u8bbf\u95ee\u5b8c\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\uff0c\u5373\u5c06\u8fd4\u56de \u540e\u5e8f\u904d\u5386 Post-Order Traversal"},{"location":"chapter_tree/binary_tree_traversal/#_3","title":"\u7b97\u6cd5\u5b9e\u73b0","text":"JavaC++PythonGoJavaScriptTypeScriptCC#SwiftZig binary_tree_dfs.java
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.add(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.add(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode root) {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.add(root.val);\n}\n
binary_tree_dfs.cpp
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nvec.push_back(root->val);\npreOrder(root->left);\npreOrder(root->right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root->left);\nvec.push_back(root->val);\ninOrder(root->right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode* root) {\nif (root == nullptr) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root->left);\npostOrder(root->right);\nvec.push_back(root->val);\n}\n
binary_tree_dfs.py
def pre_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u524d\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nres.append(root.val)\npre_order(root=root.left)\npre_order(root=root.right)\ndef in_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u4e2d\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\nin_order(root=root.left)\nres.append(root.val)\nin_order(root=root.right)\ndef post_order(root: Optional[TreeNode]) -> None:\n\"\"\" \u540e\u5e8f\u904d\u5386 \"\"\"\nif root is None:\nreturn\n# \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npost_order(root=root.left)\npost_order(root=root.right)\nres.append(root.val)\n
binary_tree_dfs.go
/* \u524d\u5e8f\u904d\u5386 */\nfunc preOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nnums = append(nums, node.Val)\npreOrder(node.Left)\npreOrder(node.Right)\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunc inOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(node.Left)\nnums = append(nums, node.Val)\ninOrder(node.Right)\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunc postOrder(node *TreeNode) {\nif node == nil {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(node.Left)\npostOrder(node.Right)\nnums = append(nums, node.Val)\n}\n
binary_tree_dfs.js
/* \u524d\u5e8f\u904d\u5386 */\nfunction preOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.push(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunction inOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.push(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunction postOrder(root) {\nif (root === null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.push(root.val);\n}\n
binary_tree_dfs.ts
/* \u524d\u5e8f\u904d\u5386 */\nfunction preOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.push(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunction inOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.push(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunction postOrder(root: TreeNode | null): void {\nif (root === null) {\nreturn;\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.push(root.val);\n}\n
binary_tree_dfs.c
[class]{}-[func]{preOrder}\n[class]{}-[func]{inOrder}\n[class]{}-[func]{postOrder}\n
binary_tree_dfs.cs
/* \u524d\u5e8f\u904d\u5386 */\nvoid preOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.Add(root.val);\npreOrder(root.left);\npreOrder(root.right);\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nvoid inOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root.left);\nlist.Add(root.val);\ninOrder(root.right);\n}\n/* \u540e\u5e8f\u904d\u5386 */\nvoid postOrder(TreeNode? root)\n{\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root.left);\npostOrder(root.right);\nlist.Add(root.val);\n}\n
binary_tree_dfs.swift
/* \u524d\u5e8f\u904d\u5386 */\nfunc preOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\nlist.append(root.val)\npreOrder(root: root.left)\npreOrder(root: root.right)\n}\n/* \u4e2d\u5e8f\u904d\u5386 */\nfunc inOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ninOrder(root: root.left)\nlist.append(root.val)\ninOrder(root: root.right)\n}\n/* \u540e\u5e8f\u904d\u5386 */\nfunc postOrder(root: TreeNode?) {\nguard let root = root else {\nreturn\n}\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\npostOrder(root: root.left)\npostOrder(root: root.right)\nlist.append(root.val)\n}\n
binary_tree_dfs.zig
// \u524d\u5e8f\u904d\u5386\nfn preOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u6839\u7ed3\u70b9 -> \u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811\ntry list.append(root.?.val);\ntry preOrder(T, root.?.left);\ntry preOrder(T, root.?.right);\n}\n// \u4e2d\u5e8f\u904d\u5386\nfn inOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u6839\u7ed3\u70b9 -> \u53f3\u5b50\u6811\ntry inOrder(T, root.?.left);\ntry list.append(root.?.val);\ntry inOrder(T, root.?.right);\n}\n// \u540e\u5e8f\u904d\u5386\nfn postOrder(comptime T: type, root: ?*inc.TreeNode(T)) !void {\nif (root == null) return;\n// \u8bbf\u95ee\u4f18\u5148\u7ea7\uff1a\u5de6\u5b50\u6811 -> \u53f3\u5b50\u6811 -> \u6839\u7ed3\u70b9\ntry postOrder(T, root.?.left);\ntry postOrder(T, root.?.right);\ntry list.append(root.?.val);\n}\n

Note

\u4f7f\u7528\u5faa\u73af\u4e00\u6837\u53ef\u4ee5\u5b9e\u73b0\u524d\u3001\u4e2d\u3001\u540e\u5e8f\u904d\u5386\uff0c\u4f46\u4ee3\u7801\u76f8\u5bf9\u7e41\u7410\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u81ea\u884c\u5b9e\u73b0\u3002

"},{"location":"chapter_tree/binary_tree_traversal/#_4","title":"\u590d\u6742\u5ea6\u5206\u6790","text":"

\u65f6\u95f4\u590d\u6742\u5ea6\uff1a\u6240\u6709\u7ed3\u70b9\u88ab\u8bbf\u95ee\u4e00\u6b21\uff0c\u4f7f\u7528 \\(O(n)\\) \u65f6\u95f4\uff0c\u5176\u4e2d \\(n\\) \u4e3a\u7ed3\u70b9\u6570\u91cf\u3002

\u7a7a\u95f4\u590d\u6742\u5ea6\uff1a\u5f53\u6811\u9000\u5316\u4e3a\u94fe\u8868\u65f6\u8fbe\u5230\u6700\u5dee\u60c5\u51b5\uff0c\u9012\u5f52\u6df1\u5ea6\u8fbe\u5230 \\(n\\) \uff0c\u7cfb\u7edf\u4f7f\u7528 \\(O(n)\\) \u6808\u5e27\u7a7a\u95f4\u3002

"},{"location":"chapter_tree/summary/","title":"7.5. \u00a0 \u5c0f\u7ed3","text":""},{"location":"chapter_tree/summary/#_1","title":"\u4e8c\u53c9\u6811","text":"
  • \u4e8c\u53c9\u6811\u662f\u4e00\u79cd\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784\uff0c\u4ee3\u8868\u7740\u201c\u4e00\u5206\u4e3a\u4e8c\u201d\u7684\u5206\u6cbb\u903b\u8f91\u3002\u4e8c\u53c9\u6811\u7684\u7ed3\u70b9\u5305\u542b\u300c\u503c\u300d\u548c\u4e24\u4e2a\u300c\u6307\u9488\u300d\uff0c\u5206\u522b\u6307\u5411\u5de6\u5b50\u7ed3\u70b9\u548c\u53f3\u5b50\u7ed3\u70b9\u3002
  • \u9009\u5b9a\u4e8c\u53c9\u6811\u4e2d\u67d0\u7ed3\u70b9\uff0c\u5c06\u5176\u5de6\uff08\u53f3\uff09\u5b50\u7ed3\u70b9\u4ee5\u4e0b\u5f62\u6210\u7684\u6811\u79f0\u4e3a\u5de6\uff08\u53f3\uff09\u5b50\u6811\u3002
  • \u4e8c\u53c9\u6811\u7684\u672f\u8bed\u8f83\u591a\uff0c\u5305\u62ec\u6839\u7ed3\u70b9\u3001\u53f6\u7ed3\u70b9\u3001\u5c42\u3001\u5ea6\u3001\u8fb9\u3001\u9ad8\u5ea6\u3001\u6df1\u5ea6\u7b49\u3002
  • \u4e8c\u53c9\u6811\u7684\u521d\u59cb\u5316\u3001\u7ed3\u70b9\u63d2\u5165\u3001\u7ed3\u70b9\u5220\u9664\u64cd\u4f5c\u4e0e\u94fe\u8868\u7684\u64cd\u4f5c\u65b9\u6cd5\u7c7b\u4f3c\u3002
  • \u5e38\u89c1\u7684\u4e8c\u53c9\u6811\u7c7b\u578b\u5305\u62ec\u5b8c\u7f8e\u4e8c\u53c9\u6811\u3001\u5b8c\u5168\u4e8c\u53c9\u6811\u3001\u5b8c\u6ee1\u4e8c\u53c9\u6811\u3001\u5e73\u8861\u4e8c\u53c9\u6811\u3002\u5b8c\u7f8e\u4e8c\u53c9\u6811\u662f\u7406\u60f3\u72b6\u6001\uff0c\u94fe\u8868\u5219\u662f\u9000\u5316\u540e\u7684\u6700\u5dee\u72b6\u6001\u3002
  • \u4e8c\u53c9\u6811\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u8868\u793a\uff0c\u5177\u4f53\u505a\u6cd5\u662f\u5c06\u7ed3\u70b9\u503c\u548c\u7a7a\u4f4d\u6309\u7167\u5c42\u5e8f\u904d\u5386\u7684\u987a\u5e8f\u6392\u5217\uff0c\u5e76\u57fa\u4e8e\u7236\u7ed3\u70b9\u548c\u5b50\u7ed3\u70b9\u4e4b\u95f4\u7684\u7d22\u5f15\u6620\u5c04\u516c\u5f0f\u5b9e\u73b0\u6307\u9488\u3002
"},{"location":"chapter_tree/summary/#_2","title":"\u4e8c\u53c9\u6811\u904d\u5386","text":"
  • \u4e8c\u53c9\u6811\u5c42\u5e8f\u904d\u5386\u662f\u4e00\u79cd\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22\uff0c\u4f53\u73b0\u7740\u201c\u4e00\u5708\u4e00\u5708\u5411\u5916\u201d\u7684\u5c42\u8fdb\u5f0f\u904d\u5386\u65b9\u5f0f\uff0c\u901a\u5e38\u501f\u52a9\u961f\u5217\u6765\u5b9e\u73b0\u3002
  • \u524d\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386\u662f\u6df1\u5ea6\u4f18\u5148\u641c\u7d22\uff0c\u4f53\u73b0\u7740\u201c\u8d70\u5230\u5934\u3001\u518d\u56de\u5934\u7ee7\u7eed\u201d\u7684\u56de\u6eaf\u904d\u5386\u65b9\u5f0f\uff0c\u901a\u5e38\u4f7f\u7528\u9012\u5f52\u5b9e\u73b0\u3002
"},{"location":"chapter_tree/summary/#_3","title":"\u4e8c\u53c9\u641c\u7d22\u6811","text":"
  • \u4e8c\u53c9\u641c\u7d22\u6811\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u5143\u7d20\u67e5\u627e\u6570\u636e\u7ed3\u6784\uff0c\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7686\u4e3a \\(O(\\log n)\\) \u3002\u4e8c\u53c9\u641c\u7d22\u6811\u9000\u5316\u4e3a\u94fe\u8868\u540e\uff0c\u5404\u9879\u65f6\u95f4\u590d\u6742\u5ea6\u52a3\u5316\u81f3 \\(O(n)\\) \uff0c\u56e0\u6b64\u5982\u4f55\u907f\u514d\u9000\u5316\u662f\u975e\u5e38\u91cd\u8981\u7684\u8bfe\u9898\u3002
  • AVL \u6811\u53c8\u79f0\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u5176\u901a\u8fc7\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u5f97\u5728\u4e0d\u65ad\u63d2\u5165\u4e0e\u5220\u9664\u7ed3\u70b9\u540e\uff0c\u4ecd\u7136\u53ef\u4ee5\u4fdd\u6301\u4e8c\u53c9\u6811\u7684\u5e73\u8861\uff08\u4e0d\u9000\u5316\uff09\u3002
  • AVL \u6811\u7684\u65cb\u8f6c\u64cd\u4f5c\u5206\u4e3a\u53f3\u65cb\u3001\u5de6\u65cb\u3001\u5148\u53f3\u65cb\u540e\u5de6\u65cb\u3001\u5148\u5de6\u65cb\u540e\u53f3\u65cb\u3002\u5728\u63d2\u5165\u6216\u5220\u9664\u7ed3\u70b9\u540e\uff0cAVL \u6811\u4f1a\u4ece\u5e95\u81f3\u9876\u5730\u6267\u884c\u65cb\u8f6c\u64cd\u4f5c\uff0c\u4f7f\u6811\u6062\u590d\u5e73\u8861\u3002
"}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 7502886b6f6d9fa93e02d9c3ae54c134f46fa8e4..febe598d6a6a5e0e708edae89e5dc55380569182 100644 GIT binary patch delta 15 Wcmeyx@{5H{zMF&Nzv)J{5+(pGWd$Ap delta 15 Wcmeyx@{5H{zMF$1Rcj+#2@?P*k_34G
方法方法名 描述 时间复杂度
add()push() 元素入堆 \(O(\log n)\)
poll()pop() 堆顶元素出堆 \(O(\log n)\)

8.1.2.   堆常用操作