From 09d346e64dd19048bf768d8511126a9c9830a4d9 Mon Sep 17 00:00:00 2001 From: krahets Date: Tue, 9 Jan 2024 16:00:33 +0800 Subject: [PATCH] deploy --- chapter_array_and_linkedlist/array/index.html | 28 +- .../linked_list/index.html | 20 +- chapter_array_and_linkedlist/list/index.html | 28 +- .../backtracking_algorithm/index.html | 16 +- .../n_queens_problem/index.html | 4 +- .../permutations_problem/index.html | 8 +- .../subset_sum_problem/index.html | 12 +- .../iteration_and_recursion/index.html | 32 +- .../space_complexity/index.html | 24 +- .../time_complexity/index.html | 48 +- .../basic_data_types/index.html | 4 +- .../binary_search_recur/index.html | 4 +- .../build_binary_tree_problem/index.html | 4 +- .../hanota_problem/index.html | 4 +- .../dp_problem_features/index.html | 12 +- .../dp_solution_pipeline/index.html | 16 +- .../edit_distance_problem/index.html | 8 +- .../intro_to_dynamic_programming/index.html | 20 +- .../knapsack_problem/index.html | 16 +- .../unbounded_knapsack_problem/index.html | 24 +- chapter_graph/graph_operations/index.html | 8 +- chapter_graph/graph_traversal/index.html | 8 +- .../fractional_knapsack_problem/index.html | 4 +- chapter_greedy/greedy_algorithm/index.html | 4 +- .../max_capacity_problem/index.html | 4 +- .../max_product_cutting_problem/index.html | 4 +- chapter_hashing/hash_algorithm/index.html | 8 +- chapter_hashing/hash_collision/index.html | 4 +- chapter_hashing/hash_map/index.html | 12 +- chapter_heap/build_heap/index.html | 4 +- chapter_heap/heap/index.html | 16 +- chapter_heap/top_k/index.html | 4 +- chapter_searching/binary_search/index.html | 8 +- .../binary_search_edge/index.html | 8 +- .../binary_search_insertion/index.html | 8 +- .../replace_linear_by_hashing/index.html | 8 +- chapter_sorting/bubble_sort/index.html | 8 +- chapter_sorting/bucket_sort/index.html | 4 +- chapter_sorting/counting_sort/index.html | 8 +- chapter_sorting/heap_sort/index.html | 4 +- chapter_sorting/insertion_sort/index.html | 4 +- chapter_sorting/merge_sort/index.html | 4 +- chapter_sorting/quick_sort/index.html | 16 +- chapter_sorting/radix_sort/index.html | 4 +- chapter_sorting/selection_sort/index.html | 4 +- chapter_stack_and_queue/deque/index.html | 4 +- chapter_stack_and_queue/queue/index.html | 12 +- chapter_stack_and_queue/stack/index.html | 12 +- .../array_representation_of_tree/index.html | 4 +- chapter_tree/binary_search_tree/index.html | 12 +- chapter_tree/binary_tree/index.html | 8 +- chapter_tree/binary_tree_traversal/index.html | 8 +- en/404.html | 154 ++ .../array/index.html | 178 +- en/chapter_array_and_linkedlist/index.html | 154 ++ .../linked_list/index.html | 170 +- .../list/index.html | 158 +- .../ram_and_cache/index.html | 154 ++ .../summary/index.html | 193 ++ .../index.html | 154 ++ .../iteration_and_recursion/index.html | 186 +- .../performance_evaluation/index.html | 154 ++ .../space_complexity/index.html | 178 +- .../summary/index.html | 154 ++ .../time_complexity/index.html | 202 +- .../basic_data_types/index.html | 154 ++ .../character_encoding/index.html | 154 ++ .../index.html | 154 ++ en/chapter_data_structure/index.html | 154 ++ .../number_encoding/index.html | 154 ++ en/chapter_data_structure/summary/index.html | 154 ++ .../algorithms_are_everywhere/index.html | 154 ++ en/chapter_introduction/index.html | 154 ++ en/chapter_introduction/summary/index.html | 154 ++ .../what_is_dsa/index.html | 154 ++ en/chapter_preface/about_the_book/index.html | 154 ++ en/chapter_preface/index.html | 154 ++ en/chapter_preface/suggestions/index.html | 154 ++ en/chapter_preface/summary/index.html | 154 ++ en/chapter_stack_and_queue/deque/index.html | 2097 +++++++++++++++- en/chapter_stack_and_queue/index.html | 329 ++- en/chapter_stack_and_queue/queue/index.html | 2187 ++++++++++++++++- en/chapter_stack_and_queue/stack/index.html | 1798 +++++++++++++- en/chapter_stack_and_queue/summary/index.html | 334 ++- en/index.html | 154 ++ en/search/search_index.json | 2 +- en/sitemap.xml | 64 +- en/sitemap.xml.gz | Bin 476 -> 476 bytes sitemap.xml | 208 +- sitemap.xml.gz | Bin 998 -> 998 bytes 90 files changed, 11430 insertions(+), 648 deletions(-) diff --git a/chapter_array_and_linkedlist/array/index.html b/chapter_array_and_linkedlist/array/index.html index 2fcce81e7..cc07d48b5 100644 --- a/chapter_array_and_linkedlist/array/index.html +++ b/chapter_array_and_linkedlist/array/index.html @@ -3763,8 +3763,8 @@
可视化运行 -

-全屏观看 >

+

+
全屏观看 >

2.   访问元素

数组元素被存储在连续的内存空间中,这意味着计算数组元素的内存地址非常容易。给定数组内存地址(首元素内存地址)和某个元素的索引,我们可以使用图 4-2 所示的公式计算得到该元素的内存地址,从而直接访问该元素。

@@ -3911,8 +3911,8 @@
可视化运行 -

-全屏观看 >

+

+
全屏观看 >

3.   插入元素

数组元素在内存中是“紧挨着的”,它们之间没有空间再存放任何数据。如图 4-3 所示,如果想在数组中间插入一个元素,则需要将该元素之后的所有元素都向后移动一位,之后再把元素赋值给该索引。

@@ -4069,8 +4069,8 @@
可视化运行 -

-全屏观看 >

+

+
全屏观看 >

4.   删除元素

同理,如图 4-4 所示,若想删除索引 \(i\) 处的元素,则需要把索引 \(i\) 之后的元素都向前移动一位。

@@ -4204,8 +4204,8 @@
可视化运行 -

-全屏观看 >

+

+
全屏观看 >

总的来看,数组的插入与删除操作有以下缺点。

diff --git a/en/chapter_data_structure/index.html b/en/chapter_data_structure/index.html index f73c3a4ec..f2f369382 100644 --- a/en/chapter_data_structure/index.html +++ b/en/chapter_data_structure/index.html @@ -1089,6 +1089,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_data_structure/number_encoding/index.html b/en/chapter_data_structure/number_encoding/index.html index 34bad1756..6cd9b56fd 100644 --- a/en/chapter_data_structure/number_encoding/index.html +++ b/en/chapter_data_structure/number_encoding/index.html @@ -1147,6 +1147,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_data_structure/summary/index.html b/en/chapter_data_structure/summary/index.html index 33c3a5b7e..e9095836c 100644 --- a/en/chapter_data_structure/summary/index.html +++ b/en/chapter_data_structure/summary/index.html @@ -1147,6 +1147,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_introduction/algorithms_are_everywhere/index.html b/en/chapter_introduction/algorithms_are_everywhere/index.html index 024a87bc2..26c8c4866 100644 --- a/en/chapter_introduction/algorithms_are_everywhere/index.html +++ b/en/chapter_introduction/algorithms_are_everywhere/index.html @@ -1099,6 +1099,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_introduction/index.html b/en/chapter_introduction/index.html index adea7e225..d89e51716 100644 --- a/en/chapter_introduction/index.html +++ b/en/chapter_introduction/index.html @@ -1089,6 +1089,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_introduction/summary/index.html b/en/chapter_introduction/summary/index.html index b53274119..a5afb12b1 100644 --- a/en/chapter_introduction/summary/index.html +++ b/en/chapter_introduction/summary/index.html @@ -1099,6 +1099,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_introduction/what_is_dsa/index.html b/en/chapter_introduction/what_is_dsa/index.html index f89ae8a81..d26992f4a 100644 --- a/en/chapter_introduction/what_is_dsa/index.html +++ b/en/chapter_introduction/what_is_dsa/index.html @@ -1156,6 +1156,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_preface/about_the_book/index.html b/en/chapter_preface/about_the_book/index.html index b2987868b..5c441ff40 100644 --- a/en/chapter_preface/about_the_book/index.html +++ b/en/chapter_preface/about_the_book/index.html @@ -1156,6 +1156,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_preface/index.html b/en/chapter_preface/index.html index 65a433636..ebc786aca 100644 --- a/en/chapter_preface/index.html +++ b/en/chapter_preface/index.html @@ -1087,6 +1087,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_preface/suggestions/index.html b/en/chapter_preface/suggestions/index.html index 48b72a231..0412fde5c 100644 --- a/en/chapter_preface/suggestions/index.html +++ b/en/chapter_preface/suggestions/index.html @@ -1174,6 +1174,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_preface/summary/index.html b/en/chapter_preface/summary/index.html index b3d173cd7..f5cff3441 100644 --- a/en/chapter_preface/summary/index.html +++ b/en/chapter_preface/summary/index.html @@ -1099,6 +1099,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + + diff --git a/en/chapter_stack_and_queue/deque/index.html b/en/chapter_stack_and_queue/deque/index.html index 24dd384bc..551a46bd0 100644 --- a/en/chapter_stack_and_queue/deque/index.html +++ b/en/chapter_stack_and_queue/deque/index.html @@ -15,6 +15,10 @@ + + + + @@ -22,7 +26,7 @@ - Double-Ended Queue - Hello Algo + 5.3 Double-ended Queue - Hello Algo @@ -87,7 +91,7 @@
    - + Skip to content @@ -122,7 +126,7 @@
    - Double-Ended Queue + 5.3 Double-ended Queue
    @@ -1083,6 +1087,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + + + +
  • + + +
    @@ -1110,37 +1361,37 @@ @@ -1103,6 +1263,23 @@ + + + @@ -1137,15 +1314,22 @@ -

    Stack and Queue

    +

    Chapter 5.   Stack and Queue

    -

    Stack and Queue

    +

    Stack and Queue

    Abstract

    Stacks are like stacking cats, while queues are like cats lining up.

    They respectively represent the logical relationships of Last-In-First-Out (LIFO) and First-In-First-Out (FIFO).

    +

    Chapter Contents

    + @@ -1164,13 +1348,110 @@ aria-label="Footer" + + + + + + + + + + + +
    Feel free to drop your insights, questions or suggestions
    + + + + + + @@ -1192,6 +1473,44 @@ aria-label="Footer"