mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-06 20:54:19 +00:00
build
This commit is contained in:
@@ -376,13 +376,13 @@ comments: true
|
||||
|
||||
如圖 5-2 所示,對於入堆疊操作,我們只需將元素插入鏈結串列頭部,這種節點插入方法被稱為“頭插法”。而對於出堆疊操作,只需將頭節點從鏈結串列中刪除即可。
|
||||
|
||||
=== "LinkedListStack"
|
||||
=== "<1>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "push()"
|
||||
=== "<2>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "pop()"
|
||||
=== "<3>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> 圖 5-2 基於鏈結串列實現堆疊的入堆疊出堆疊操作 </p>
|
||||
@@ -1169,13 +1169,13 @@ comments: true
|
||||
|
||||
使用陣列實現堆疊時,我們可以將陣列的尾部作為堆疊頂。如圖 5-3 所示,入堆疊與出堆疊操作分別對應在陣列尾部新增元素與刪除元素,時間複雜度都為 $O(1)$ 。
|
||||
|
||||
=== "ArrayStack"
|
||||
=== "<1>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "push()"
|
||||
=== "<2>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "pop()"
|
||||
=== "<3>"
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> 圖 5-3 基於陣列實現堆疊的入堆疊出堆疊操作 </p>
|
||||
|
||||
Reference in New Issue
Block a user