deploy
This commit is contained in:
parent
28ad17dfeb
commit
45f9dbbbf6
@ -1939,7 +1939,7 @@
|
||||
<tr>
|
||||
<td>布尔</td>
|
||||
<td><code>bool</code></td>
|
||||
<td>1 byte / 1 bit</td>
|
||||
<td>1 byte</td>
|
||||
<td><span class="arithmatex">\(\text{false}\)</span></td>
|
||||
<td><span class="arithmatex">\(\text{true}\)</span></td>
|
||||
<td><span class="arithmatex">\(\text{false}\)</span></td>
|
||||
@ -1947,6 +1947,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">Tip</p>
|
||||
<p>字符的占用空间大小取决于编程语言采用的字符编码方法,详见「字符编码」章节。</p>
|
||||
<p>现代计算机 CPU 通常将 1 字节作为最小寻址内存单元。因此,即使表示布尔量仅需 1 位(<span class="arithmatex">\(0\)</span> 或 <span class="arithmatex">\(1\)</span>),它在内存中通常被存储为 1 字节。</p>
|
||||
</div>
|
||||
<p>那么,基本数据类型与数据结构之间有什么联系与区别呢?我们知道,数据结构是在计算机中组织与存储数据的方式。它的主语是“结构”,而非“数据”。如果想要表示“一排数字”,我们自然会想到使用数组。这是因为数组的线性结构可以表示数字的相邻关系和顺序关系,但至于存储的内容是整数 <code>int</code> 、小数 <code>float</code> 、还是字符 <code>char</code> ,则与“数据结构”无关。</p>
|
||||
<p>换句话说,<strong>基本数据类型提供了数据的“内容类型”,而数据结构提供了数据的“组织方式”</strong>。如以下代码所示,我们可以使用不同基本数据类型来初始化数组。</p>
|
||||
<div class="tabbed-set tabbed-alternate" data-tabs="1:10"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><input id="__tabbed_1_4" name="__tabbed_1" type="radio" /><input id="__tabbed_1_5" name="__tabbed_1" type="radio" /><input id="__tabbed_1_6" name="__tabbed_1" type="radio" /><input id="__tabbed_1_7" name="__tabbed_1" type="radio" /><input id="__tabbed_1_8" name="__tabbed_1" type="radio" /><input id="__tabbed_1_9" name="__tabbed_1" type="radio" /><input id="__tabbed_1_10" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Java</label><label for="__tabbed_1_2">C++</label><label for="__tabbed_1_3">Python</label><label for="__tabbed_1_4">Go</label><label for="__tabbed_1_5">JavaScript</label><label for="__tabbed_1_6">TypeScript</label><label for="__tabbed_1_7">C</label><label for="__tabbed_1_8">C#</label><label for="__tabbed_1_9">Swift</label><label for="__tabbed_1_10">Zig</label></div>
|
||||
|
@ -2064,7 +2064,7 @@
|
||||
</div>
|
||||
<h2 id="1121">11.2.1. 算法特性<a class="headerlink" href="#1121" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
<li><strong>时间复杂度为 <span class="arithmatex">\(O(n^2)\)</span> 、非自适应排序</strong>:共有 <span class="arithmatex">\(n - 1\)</span> 轮外循环,分别包含 <span class="arithmatex">\(n\)</span> , <span class="arithmatex">\(n - 1\)</span> , <span class="arithmatex">\(\cdots\)</span> , <span class="arithmatex">\(2\)</span> , <span class="arithmatex">\(1\)</span> 轮内循环,求和为 <span class="arithmatex">\(\frac{(n - 1)(n + 2)}{2}\)</span> 。</li>
|
||||
<li><strong>时间复杂度为 <span class="arithmatex">\(O(n^2)\)</span> 、非自适应排序</strong>:外循环共 <span class="arithmatex">\(n - 1\)</span> 轮,第一轮的未排序区间长度为 <span class="arithmatex">\(n\)</span> ,最后一轮的未排序区间长度为 <span class="arithmatex">\(2\)</span> ,即各轮外循环分别包含 <span class="arithmatex">\(n\)</span> , <span class="arithmatex">\(n - 1\)</span> , <span class="arithmatex">\(\cdots\)</span> , <span class="arithmatex">\(2\)</span> 轮内循环,求和为 <span class="arithmatex">\(\frac{(n - 1)(n + 2)}{2}\)</span> 。</li>
|
||||
<li><strong>空间复杂度 <span class="arithmatex">\(O(1)\)</span> 、原地排序</strong>:指针 <span class="arithmatex">\(i\)</span> , <span class="arithmatex">\(j\)</span> 使用常数大小的额外空间。</li>
|
||||
<li><strong>非稳定排序</strong>:在交换元素时,有可能将 <code>nums[i]</code> 交换至其相等元素的右边,导致两者的相对顺序发生改变。</li>
|
||||
</ul>
|
||||
|
File diff suppressed because one or more lines are too long
124
sitemap.xml
124
sitemap.xml
@ -2,312 +2,312 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_appendix/contribution/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_appendix/installation/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_array_and_linkedlist/array/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_array_and_linkedlist/linked_list/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_array_and_linkedlist/list/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_array_and_linkedlist/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_backtracking/backtracking_algorithm/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_backtracking/n_queens_problem/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_backtracking/permutations_problem/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_computational_complexity/performance_evaluation/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_computational_complexity/space_complexity/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_computational_complexity/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_computational_complexity/time_complexity/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_data_structure/basic_data_types/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_data_structure/character_encoding/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_data_structure/classification_of_data_structure/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_data_structure/number_encoding/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_data_structure/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_graph/graph/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_graph/graph_operations/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_graph/graph_traversal/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_graph/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_hashing/hash_collision/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_hashing/hash_map/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_hashing/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_heap/build_heap/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_heap/heap/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_heap/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_introduction/algorithms_are_everywhere/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_introduction/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_introduction/what_is_dsa/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_preface/about_the_book/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_preface/suggestions/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_preface/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_reference/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_searching/binary_search/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_searching/binary_search_edge/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_searching/replace_linear_by_hashing/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_searching/searching_algorithm_revisited/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_searching/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/bubble_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/bucket_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/counting_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/heap_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/insertion_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/merge_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/quick_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/radix_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/selection_sort/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/sorting_algorithm/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_sorting/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_stack_and_queue/deque/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_stack_and_queue/queue/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_stack_and_queue/stack/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_stack_and_queue/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/array_representation_of_tree/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/avl_tree/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/binary_search_tree/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/binary_tree/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/binary_tree_traversal/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.hello-algo.com/chapter_tree/summary/</loc>
|
||||
<lastmod>2023-05-30</lastmod>
|
||||
<lastmod>2023-05-31</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
Loading…
Reference in New Issue
Block a user