mirror of
https://github.com/krahets/hello-algo.git
synced 2026-02-13 07:35:47 +08:00
Bug fixes and improvements (#1078)
* Fix the logo in the en version * Optimize header color and fix body background color * Update theme switch's name * Fix backfrop-filter on Safari * Update some animation's file name for adding egde when cropping * Re-count the comments number * A bug fix in n_queens_problem.md
This commit is contained in:
@@ -319,13 +319,13 @@
|
||||
如下图所示,对于入栈操作,我们只需将元素插入链表头部,这种节点插入方法被称为“头插法”。而对于出栈操作,只需将头节点从链表中删除即可。
|
||||
|
||||
=== "LinkedListStack"
|
||||

|
||||

|
||||
|
||||
=== "push()"
|
||||

|
||||

|
||||
|
||||
=== "pop()"
|
||||

|
||||

|
||||
|
||||
以下是基于链表实现栈的示例代码:
|
||||
|
||||
@@ -338,13 +338,13 @@
|
||||
使用数组实现栈时,我们可以将数组的尾部作为栈顶。如下图所示,入栈与出栈操作分别对应在数组尾部添加元素与删除元素,时间复杂度都为 $O(1)$ 。
|
||||
|
||||
=== "ArrayStack"
|
||||

|
||||

|
||||
|
||||
=== "push()"
|
||||

|
||||

|
||||
|
||||
=== "pop()"
|
||||

|
||||

|
||||
|
||||
由于入栈的元素可能会源源不断地增加,因此我们可以使用动态数组,这样就无须自行处理数组扩容问题。以下为示例代码:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user