<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>数据结构与算法 on Two Tigers Engineering</title>
    <link>https://blog.twotigers.xyz/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/</link>
    <description>Recent content in 数据结构与算法 on Two Tigers Engineering</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 09 Dec 2021 09:12:25 +0800</lastBuildDate><atom:link href="https://blog.twotigers.xyz/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>一个简单的快排算法</title>
      <link>https://blog.twotigers.xyz/posts/algorithm/sort/quicksort/</link>
      <pubDate>Thu, 09 Dec 2021 09:12:25 +0800</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/algorithm/sort/quicksort/</guid>
      <description> 使用快排的思想 空间复杂度很垃圾, 只是为了更好的理解快排算法 TODO 修改成不需要额外空间的算法 def quicksort(data: list): if len(data) &amp;lt;= 1: return data less = [] more = [] pivot = data[0] for item in data: if item &amp;lt; pivot: less.append(item) elif item &amp;gt; pivot: more.append(item) return quicksort(less) + [pivot] + quicksort(more) data = [1, 4, 2, 6, 3, 10, 12, 11] print(quicksort(data)) </description>
    </item>
    
    <item>
      <title>二叉树生成与遍历</title>
      <link>https://blog.twotigers.xyz/posts/algorithm/tree/</link>
      <pubDate>Wed, 08 Dec 2021 14:12:25 +0800</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/algorithm/tree/</guid>
      <description>class Node: def __init__(self, val, left=None, right=None) -&amp;gt; None: self.val = val self.left = left self.right = right def create_tree(data: list): if not data: return None first_node = Node(data[0]) tmp_list = [first_node] tmp_count = 0 for item in data[1:]: node = tmp_list[0] new_node = Node(item) if item is not None else None if tmp_count == 0: node.left = new_node # add to tmp_list if item is not None: tmp_list.append(new_node) tmp_count += 1 continue if tmp_count == 1: node.</description>
    </item>
    
    <item>
      <title>二叉树</title>
      <link>https://blog.twotigers.xyz/posts/structure/tree/</link>
      <pubDate>Thu, 14 Oct 2021 20:00:08 +0800</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/structure/tree/</guid>
      <description>二叉树 本文摘自 代码随想录
定义 满二叉树 除最后一层无任何子节点外，每一层上的所有结点都有两个子结点的二叉树。
国内教程定义：一个二叉树，如果每一个层的结点数都达到最大值，则这个二叉树就是满二叉树。也就是说，如果一个二叉树的层数为K，且结点总数是(2^k) -1 ，则它就是满二叉树。
满二叉树的结点要么是叶子结点，度为0，要么是度为2的结点，不存在度为1的结点。
但是, 下图根据国内定义就不是一个满二叉树 满二叉树 百度百科
完全二叉树 一棵深度为k的有n个结点的二叉树，对树中的结点按从上至下、从左到右的顺序进行编号，如果编号为i（1≤i≤n）的结点与满二叉树中编号为i的结点在二叉树中的位置相同，则这棵二叉树称为完全二叉树
完全二叉树
二叉搜索树 一个有序树 若它的左子树不空，则左子树上所有结点的值均小于它的根结点的值；
若它的右子树不空，则右子树上所有结点的值均大于它的根结点的值；
它的左、右子树也分别为二叉排序树
平衡二叉搜索树 AVL (Adelson-Velsky and Landis) 空树 左右两个子树高度绝对值不超过1 (&amp;lt;=1), 并且两个子树都是 AVL 存储方式 顺序, 数组 链式, 指针方式 链式: 顺序: 遍历 如果父节点的数组下表是i，那么它的左孩子就是i * 2 + 1，右孩子就是 i * 2 + 2。 注意: 常用的还是链式</description>
    </item>
    
  </channel>
</rss>
