<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Notion 博客</title>
        <link>https://blog.yinnierqi.eu.org</link>
        <description>一个NotionNext搭建的博客</description>
        <lastBuildDate>Mon, 30 Nov 2026 09:20:19 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2026, Qianchang</copyright>
        <item>
            <title><![CDATA[深度优先搜索]]></title>
            <link>https://blog.yinnierqi.eu.org/article/425e408c-de5f-80d8-bec8-eae7d8cee4b5</link>
            <guid>https://blog.yinnierqi.eu.org/article/425e408c-de5f-80d8-bec8-eae7d8cee4b5</guid>
            <pubDate>Fri, 27 Nov 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[深度优先搜索是一种用于遍历或搜索树或图的算法。它的基本思想是尽可能深地搜索树的分支，直到不能再深入为止，然后回溯到前一个节点，继续搜索其他分支]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-425e408cde5f80d8bec8eae7d8cee4b5"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f807793c4f01ef365e26b" data-id="425e408cde5f807793c4f01ef365e26b"><span><div id="425e408cde5f807793c4f01ef365e26b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f807793c4f01ef365e26b" title="什么是深度优先搜索（DFS）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">什么是深度优先搜索（DFS）</span></span></h3><div class="notion-text notion-block-425e408cde5f800a8ad5c73e79dc6049">深度优先搜索是一种用于遍历或搜索树或图的算法。它的基本思想是尽可能深地搜索树的分支，直到不能再深入为止，然后回溯到前一个节点，继续搜索其他分支。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f803cbb47fd63acc254fc" data-id="425e408cde5f803cbb47fd63acc254fc"><span><div id="425e408cde5f803cbb47fd63acc254fc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f803cbb47fd63acc254fc" title="DFS的基本原理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">DFS的基本原理</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-425e408cde5f8048861ccf944a86181d" style="list-style-type:decimal"><li>从起始节点开始：选择一个节点作为搜索的起点</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-425e408cde5f80349626e27126b8e1d5" style="list-style-type:decimal"><li>不断深入：选择一个未访问的相邻节点，然后从该节点继续进行深度优先搜索</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-425e408cde5f80e7ad96ef6adfc49f38" style="list-style-type:decimal"><li>回溯：当一个节点的所有相邻节点都已被访问，回溯到上一个节点</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-425e408cde5f800cb053c110cc790045" style="list-style-type:decimal"><li>重复过程：重复上述过程，直到所有节点都被访问</li></ol><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f80dda160e44c03debe18" data-id="425e408cde5f80dda160e44c03debe18"><span><div id="425e408cde5f80dda160e44c03debe18" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80dda160e44c03debe18" title="DFS的实现方式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">DFS的实现方式</span></span></h3><div class="notion-text notion-block-425e408cde5f8055b4c4cb7a9ed96dcc">深度优先搜索通常有两种实现方式：</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-425e408cde5f80c38580ffc0b46d3594" data-id="425e408cde5f80c38580ffc0b46d3594"><span><div id="425e408cde5f80c38580ffc0b46d3594" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80c38580ffc0b46d3594" title="1. 递归实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 递归实现</span></span></h4><div class="notion-text notion-block-425e408cde5f80cabff7d706cd0b684b">递归是实现DFS最直观的方式，它利用了系统的调用栈来实现回溯：</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-425e408cde5f8078af22d4bf54033832" data-id="425e408cde5f8078af22d4bf54033832"><span><div id="425e408cde5f8078af22d4bf54033832" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f8078af22d4bf54033832" title="2. 栈实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 栈实现</span></span></h4><div class="notion-text notion-block-425e408cde5f80cb84cee00a3239a970">也可以使用显式的栈来实现DFS，避免系统调用栈溢出的风险：</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f8015811ce47f24cbcb2e" data-id="425e408cde5f8015811ce47f24cbcb2e"><span><div id="425e408cde5f8015811ce47f24cbcb2e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f8015811ce47f24cbcb2e" title="DFS在阿帅击靶问题中的应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">DFS在阿帅击靶问题中的应用</span></span></h3><div class="notion-text notion-block-425e408cde5f803bb0cec9f9419569da">在我们的靶场问题中，DFS的应用方式如下：</div><ol start="1" class="notion-list notion-list-numbered notion-block-425e408cde5f8087a67cf56bd4c46e01" style="list-style-type:decimal"><li>状态表示：每个靶子的状态（已击倒或未击倒）构成了一个状态</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-425e408cde5f80558761e46cd877dd7e" style="list-style-type:decimal"><li>状态转移：每次击倒一个靶子，状态发生变化</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-425e408cde5f80d8a81fde0e85a8b1f7" style="list-style-type:decimal"><li>深度搜索：尝试所有可能的射击顺序，探索状态空间</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-425e408cde5f807b875fc12f8b7c9ac8" style="list-style-type:decimal"><li>回溯：如果一个射击序列无法击倒所有靶子，回溯并尝试其他序列</li></ol><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-425e408cde5f80e1b81aebfaabcfa38a" data-id="425e408cde5f80e1b81aebfaabcfa38a"><span><div id="425e408cde5f80e1b81aebfaabcfa38a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80e1b81aebfaabcfa38a" title="实例演示"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">实例演示</span></span></h4><div class="notion-text notion-block-425e408cde5f80e4bfbed0771255260f">以3个靶子为例，初始只有靶子1被击倒：</div><div class="notion-text notion-block-425e408cde5f80ba8080d7d760c09857">DFS搜索过程：</div><ol start="1" class="notion-list notion-list-numbered notion-block-425e408cde5f8053a0c8ebcb4caa5a25" style="list-style-type:decimal"><li>开始DFS(n=3, remaining=2)</li><ol class="notion-list notion-list-numbered notion-block-425e408cde5f8053a0c8ebcb4caa5a25" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-425e408cde5f80fdb226d16735a5a820"><li>检查靶子1：已击倒，跳过</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f800ea371f72f997fbf25"><li>检查靶子2：未击倒，有相邻的已击倒靶子（靶子1）</li><ul class="notion-list notion-list-disc notion-block-425e408cde5f800ea371f72f997fbf25"><li>击倒靶子2：[1, 1, 0]</li><li>调用DFS(n=3, remaining=1)</li><ul class="notion-list notion-list-disc notion-block-425e408cde5f805f9389e52d466d71bf"><li>检查靶子1：已击倒，跳过</li><li>检查靶子2：已击倒，跳过</li><li>检查靶子3：未击倒，有相邻的已击倒靶子（靶子2）</li><ul class="notion-list notion-list-disc notion-block-425e408cde5f80cca563e62bda17edc5"><li>击倒靶子3：[1, 1, 1]</li><li>调用DFS(n=3, remaining=0)</li><ul class="notion-list notion-list-disc notion-block-425e408cde5f809fadf5dccf4700ea1d"><li>所有靶子都被击倒，找到一种有效方案</li></ul><li>回溯，恢复靶子3：[1, 1, 0]</li></ul></ul><li>回溯，恢复靶子2：[1, 0, 0]</li></ul></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80f2b89cc1c1506e4481"><li>检查靶子3：未击倒，没有相邻的已击倒靶子，跳过</li></ul></ol></ol><div class="notion-text notion-block-425e408cde5f802d9bf4ee8030d03efa">搜索完成，只有一种有效方案。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f80a79399d5998d5df302" data-id="425e408cde5f80a79399d5998d5df302"><span><div id="425e408cde5f80a79399d5998d5df302" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80a79399d5998d5df302" title="DFS的优缺点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">DFS的优缺点</span></span></h3><div class="notion-text notion-block-425e408cde5f8055b3f4f3ddcb425ac1">优点：</div><ul class="notion-list notion-list-disc notion-block-425e408cde5f8052a0bdf720d2c65df4"><li>实现简单，容易理解</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f801f84e2f8bcd435912e"><li>内存占用通常小于广度优先搜索（BFS）</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f801e94aed46c640b5949"><li>适合搜索所有可能的解决方案</li></ul><div class="notion-text notion-block-425e408cde5f8050a445db704238335b">缺点：</div><ul class="notion-list notion-list-disc notion-block-425e408cde5f802895fae50c9c84b60f"><li>可能陷入很深的分支而无法及时回溯</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80fa99b2cccf7616ea78"><li>不一定能找到最短路径</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80adbf55ed5993cb4264"><li>在大型问题上可能导致栈溢出（递归实现时）</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f80a08924f14cb1398a43" data-id="425e408cde5f80a08924f14cb1398a43"><span><div id="425e408cde5f80a08924f14cb1398a43" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80a08924f14cb1398a43" title="适用场景"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">适用场景</span></span></h3><div class="notion-text notion-block-425e408cde5f80e79804fef7e4005568">DFS特别适合以下场景：</div><ul class="notion-list notion-list-disc notion-block-425e408cde5f80139832d97a76789edd"><li>寻找所有可能的解决方案（例如排列组合问题）</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f8015b10ce7094d6070a5"><li>拓扑排序</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f8052aeb1c71e7716e8ff"><li>寻找连通分量</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80b9a69bd0396e748ce4"><li>解决迷宫问题</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80b6b738f6353e2781be"><li>判断图中是否存在环</li></ul><div class="notion-text notion-block-425e408cde5f80109022d18b5a51f232">在我们的击靶问题中，DFS帮助我们探索所有可能的射击顺序，找出有效方案的总数。它通过系统地尝试每一种可能的选择，最终得到正确的结果。</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[时间复杂度计算]]></title>
            <link>https://blog.yinnierqi.eu.org/article/time-complexity</link>
            <guid>https://blog.yinnierqi.eu.org/article/time-complexity</guid>
            <pubDate>Fri, 27 Nov 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[介绍算法时间复杂度的基本概念，讲解 Big O 表示法，以及 O(1)、O(log n)、O(n)、O(n log n)、O(n²)、O(2ⁿ) 等常见时间复杂度的含义、区别与计算方法]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-425e408cde5f80c3b414cc0a255935d8"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-425e408cde5f804daf3ef0aa6a56f246">时间复杂度是衡量算法运行时间随输入规模增长的变化趋势，用大 O 表示法（Big O Notation）来描述。让我先给你一个直观的复杂度对比图，然后逐步讲解计算方法。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-425e408cde5f80fdabebf7faab3a8148"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:768px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A8cc9fe6e-7a75-4858-8010-d3f223c0c578%3Aimage-20260323091520-y1siy11.png?table=block&amp;id=425e408c-de5f-80fd-abeb-f7faab3a8148&amp;t=425e408c-de5f-80fd-abeb-f7faab3a8148" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-425e408cde5f80efb34de2025d90c100"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f80d586a1dc5aa3b7fefd" data-id="425e408cde5f80d586a1dc5aa3b7fefd"><span><div id="425e408cde5f80d586a1dc5aa3b7fefd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80d586a1dc5aa3b7fefd" title="核心概念"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">核心概念</span></span></h3><div class="notion-text notion-block-425e408cde5f8014abaceb1814631305">时间复杂度描述的是操作次数随输入规模 n 增长的趋势，忽略常数和低阶项，只关注增长最快的那一项。</div><hr class="notion-hr notion-block-425e408cde5f804d9b1bc8753a705296"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f80ab8ddee7322277b494" data-id="425e408cde5f80ab8ddee7322277b494"><span><div id="425e408cde5f80ab8ddee7322277b494" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f80ab8ddee7322277b494" title="计算步骤"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">计算步骤</span></span></h3><div class="notion-text notion-block-425e408cde5f80d58447c45685357376">第一步：找出基本操作，也就是执行次数最多的那个语句（通常是最内层的循环体）。</div><div class="notion-text notion-block-425e408cde5f806d98ddffc95199eb5d">第二步：数清楚执行了多少次。</div><div class="notion-text notion-block-425e408cde5f803eae31fbd401583b1c">第三步：只保留最高次项，去掉系数。</div><hr class="notion-hr notion-block-425e408cde5f8012b0cec94467fa6d38"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f802d9535f246dc022379" data-id="425e408cde5f802d9535f246dc022379"><span><div id="425e408cde5f802d9535f246dc022379" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f802d9535f246dc022379" title="常见例子"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">常见例子</span></span></h3><div class="notion-text notion-block-425e408cde5f80d5adfcfce7bd399110">O(1) 常数时间 — 不管 n 多大，操作次数固定：</div><div class="notion-text notion-block-425e408cde5f80f5aad2ebe04abfe0ff">O(n) 线性时间 — 遍历一遍：</div><div class="notion-text notion-block-425e408cde5f80f3b252dc12796543bd">O(n²) 平方时间 — 嵌套两层循环：</div><div class="notion-text notion-block-425e408cde5f80708b4ac02e857a8f38">O(log n) 对数时间 — 每次把问题规模砍一半（如二分查找）：</div><hr class="notion-hr notion-block-425e408cde5f80a5b8f3c997c6c88c1d"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f806fa9cbc8ae577b21b5" data-id="425e408cde5f806fa9cbc8ae577b21b5"><span><div id="425e408cde5f806fa9cbc8ae577b21b5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f806fa9cbc8ae577b21b5" title="化简规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">化简规则</span></span></h3><div class="notion-text notion-block-425e408cde5f802a8205c0a27b827009">计算出次数后，按以下规则化简：</div><ul class="notion-list notion-list-disc notion-block-425e408cde5f80d3b04dea53d9f69e9f"><li>去掉常数系数：3n → O(n)，100 → O(1)</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80088f0ccada26ecfa6b"><li>只保留最高次项：n² + n + 1 → O(n²)</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f80cfab24f1287280c241"><li>嵌套循环相乘：外层 n × 内层 n = O(n²)</li></ul><ul class="notion-list notion-list-disc notion-block-425e408cde5f8026b904c8d25dadd5a2"><li>并列代码取最大：O(n) + O(n²) → O(n²)</li></ul><hr class="notion-hr notion-block-425e408cde5f8053b440c11b8d8f0820"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-425e408cde5f8085914bc158f37402df" data-id="425e408cde5f8085914bc158f37402df"><span><div id="425e408cde5f8085914bc158f37402df" class="notion-header-anchor"></div><a class="notion-hash-link" href="#425e408cde5f8085914bc158f37402df" title="常见复杂度排序（从好到差）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">常见复杂度排序（从好到差）</span></span></h3><div class="notion-text notion-block-425e408cde5f809cb0bff3b03e167519">实际面试或刷题中，遇到一层循环就想 O(n)，双层嵌套就想 O(n²)，每次折半就想 O(log n)，基本覆盖 80% 的场景。有想深入了解的具体算法或场景吗？</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MySQL 学习笔记]]></title>
            <link>https://blog.yinnierqi.eu.org/article/mysql-notes</link>
            <guid>https://blog.yinnierqi.eu.org/article/mysql-notes</guid>
            <pubDate>Tue, 24 Nov 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[按基础、索引、事务、锁、日志、内存、架构等整理的 MySQL 学习目录]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-422e408cde5f81449708c39044432ddc"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>