<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>算法导论 on Dai Chao</title>
    <link>https://daichao1997.github.io/tags/%E7%AE%97%E6%B3%95%E5%AF%BC%E8%AE%BA/</link>
    <description>Recent content in 算法导论 on Dai Chao</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Tue, 01 Sep 2020 00:00:00 +0800</lastBuildDate>
    <atom:link href="https://daichao1997.github.io/tags/%E7%AE%97%E6%B3%95%E5%AF%BC%E8%AE%BA/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>《算法导论》的翻译真叫一个垃圾！</title>
      <link>https://daichao1997.github.io/posts/tech/2020-09-01-itoa-ch14-translation/</link>
      <pubDate>Tue, 01 Sep 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-09-01-itoa-ch14-translation/</guid>
      <description>&lt;p&gt;其实不只是这一本教材，国内对英文计算机文献的翻译质量普遍不高，以至于我直接读英文原著都要比读这种狗屁不通的汉语句子流畅许多。下面这个例子是第14章开头的第一段话，我来试试把原版翻译改良一下，你们品评一下有没有好读许多。&lt;/p&gt;</description>
    </item>
    <item>
      <title>《算法导论》第14章：数据结构的扩张 (Augmenting Data Structures)</title>
      <link>https://daichao1997.github.io/posts/tech/2020-09-01-itoa-ch14-augment/</link>
      <pubDate>Tue, 01 Sep 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-09-01-itoa-ch14-augment/</guid>
      <description>&lt;p&gt;本章提及了数据结构的“扩张”概念。当我们需要支持一种特殊操作的时候，应该优先考虑去扩展现有的数据结构，而不是自创一种。扩展的方法就是“加信息”，然后用原有的基本操作去维护它。作为例子，本章讲了“顺序统计树”和“区间树”，并给出了扩展数据结构的一般方法。&lt;/p&gt;</description>
    </item>
    <item>
      <title>《算法导论》第21章：并查集</title>
      <link>https://daichao1997.github.io/posts/tech/2020-08-31-itoa-ch21-disjoint_set/</link>
      <pubDate>Mon, 31 Aug 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-08-31-itoa-ch21-disjoint_set/</guid>
      <description>&lt;h3 id=&#34;并查集的基本操作&#34;&gt;并查集的基本操作&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;并查集&lt;/strong&gt;是一种由不相交集合组成的数据结构，它可以用 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&#34;false&#34;&gt;{&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;mo separator=&#34;true&#34;&gt;,&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;mo separator=&#34;true&#34;&gt;,&lt;/mo&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;.&lt;/mi&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;.&lt;/mi&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;.&lt;/mi&gt;&lt;mo separator=&#34;true&#34;&gt;,&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/msub&gt;&lt;mo stretchy=&#34;false&#34;&gt;}&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;S=\{S_1,S_2,...,S_k\}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt; 表示，其中 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;S_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt; 是由若干元素组成的集合，任意两个集合之间的交集都为 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;∅&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;\empty&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;，每个集合都有一个元素作为它的&lt;strong&gt;代表&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;并查集需要支持以下操作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAKE-SET(x)&lt;/code&gt;创建一个仅含 x 的新集合（x 不得同时属于其他集合）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UNION(x,y)&lt;/code&gt;将集合 x、y 合并到一起，形成新的集合&lt;/li&gt;
&lt;li&gt;&lt;code&gt;FIND-SET(x)&lt;/code&gt;返回集合 x 的代表&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;一般来说，每个元素都会先通过 MAKE-SET 形成只包含自己的集合，然后通过 UNION 相互兼并。MAKE-SET 和 UNION的运行次数是有限的，不会超过所有元素的总数 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;。与此同时，外部会通过FIND-SET查询某个元素当前属于哪个集合，该操作的次数没有上限。所以，一个并查集的运行效率可以通过两个变量衡量——MAKE-SET 的运行次数 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;，以及上述所有三种操作的总次数 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;m&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;m&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;。这里假设了每个元素都会先形成自己的集合。&lt;/p&gt;</description>
    </item>
    <item>
      <title>《算法导论》第9章：中位数与顺序统计量 (Medians and Order Statistics)</title>
      <link>https://daichao1997.github.io/posts/tech/2020-08-31-itoa-ch09-order_statistics/</link>
      <pubDate>Mon, 31 Aug 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-08-31-itoa-ch09-order_statistics/</guid>
      <description>&lt;p&gt;这一章主要研究这几个问题：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;怎么求最大/最小&lt;/li&gt;
&lt;li&gt;怎么同时求最大&amp;amp;最小&lt;/li&gt;
&lt;li&gt;怎么求第二大/小（习题9.1-1）&lt;/li&gt;
&lt;li&gt;怎么求第k小&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这些问题的算法并不难，本质上我们是想探讨它们所需要的最小比较次数，所以希望大家把重点放在理解证明过程上，学习证明思路，理解排序的本质。下文中，数据规模都用 &lt;span class=&#34;katex&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt; 表示。&lt;/p&gt;</description>
    </item>
    <item>
      <title>《算法导论》第13章：红黑树</title>
      <link>https://daichao1997.github.io/posts/tech/2020-08-30-itoa-ch13-rbtree/</link>
      <pubDate>Sun, 30 Aug 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-08-30-itoa-ch13-rbtree/</guid>
      <description>&lt;p&gt;今天来讲个有挑战性的内容——红黑树。这是我从本科开始一直没敢去碰的东西，主要是嫌麻烦，实际编程中又不怎么用，但最近就想看着玩。本文只能让你了解红黑树大概的样子，真要理解并形成深刻印象，还得去看《算法导论》的第12、13章。第12章（平衡二叉树）的笔记在上一篇文章里。&lt;/p&gt;</description>
    </item>
    <item>
      <title>《算法导论》第12章：二叉搜索树</title>
      <link>https://daichao1997.github.io/posts/tech/2020-08-28-itoa-ch12-bst/</link>
      <pubDate>Fri, 28 Aug 2020 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2020-08-28-itoa-ch12-bst/</guid>
      <description>&lt;p&gt;本文简单介绍二叉搜索树，为下一篇文章讲红黑树作铺垫。&lt;/p&gt;
&lt;h3 id=&#34;二叉搜索树&#34;&gt;二叉搜索树&lt;/h3&gt;
&lt;p&gt;二叉搜索树(Binary Search Tree, BST)是一棵二叉树，每个结点都记录着左子left、右子right、父结点p、关键字key。BST里的关键字总是满足&lt;strong&gt;二叉搜索树性质&lt;/strong&gt;：对于每个结点，其关键字都大于或等于它的任意左子，小于或等于它的任意右子。简单来说，就是“左小右大”。下面比较结点大小时，指的就是比较结点关键字的大小。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
