Skip to content

Commit

Permalink
update posts
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobinqt committed Aug 18, 2023
1 parent 79ef5f6 commit 0a8fd64
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions book.golang.toml → book.tech.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/

baseURL = 'https://example.com/golang'
title = 'Golang 学习笔记'
baseURL = 'https://example.com/tech'
title = 'PARROT'
theme = 'hugo-book'
publishdir = "public.golang.http"
publishdir = "public.tech.http"
defaultContentLanguage = "zh"

# Book configuration
Expand All @@ -26,7 +26,7 @@ startLevel = 1
[languages]
[languages.zh]
languageName = 'Chinese'
contentDir = 'book.golang'
contentDir = 'book.tech'
weight = 1

[menu]
Expand Down
2 changes: 1 addition & 1 deletion book.golang/_index.md → book.tech/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ title: 简介
type: docs
---

# Golang 学习笔记
# PARROT
2 changes: 1 addition & 1 deletion content/posts/developer/laravel-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ date: 2023-08-04

lastmod: 2023-08-04

draft: false
draft: true

author: "xiaobinqt"
description: "xiaobinqt,"
Expand Down
2 changes: 1 addition & 1 deletion content/posts/go/go-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ date: 2023-08-01

lastmod: 2023-08-01

draft: false
draft: true

author: "xiaobinqt"
description: "xiaobinqt,golang 面试常见问题,go,面试"
Expand Down
2 changes: 1 addition & 1 deletion content/posts/mysql/mysql-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ date: 2023-08-01

lastmod: 2023-08-01

draft: false
draft: true

author: "xiaobinqt"
description: "xiaobinqt,mysql 面试常见问题"
Expand Down
10 changes: 4 additions & 6 deletions content/posts/mysql/why-mysql-index-use-btree.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ math: true

这不是我开始这么去想的,看了很多文章都是从这一维度问答,这些回答让我失望。直到那天问了坐在我旁边那个整天摸鱼的 5 年程序员;他慵懒的回答:你想为什么是使用的是树结构呢?咦,听到这回答,一下打开了我的思绪,有点意思!

先抛开 B+ 树是什么,有什么优势,这些先入为主的答案。我并不想要往我脑袋硬塞硬邦邦的答案。

我想要的是为什么:question:
先抛开 B+ 树是什么,有什么优势,这些先入为主的答案。我想要的是为什么:question:

为什么 MySQL 的索引有那么多的数据结构可选,偏偏选树结构?为什么那么多的树结构?为什么又偏偏采用 B+ 树作为索引?

Expand Down Expand Up @@ -189,13 +187,13 @@ select * from weixin where age < 18

**完全二叉树**

完全二叉树的定义是如果这颗树的所有节点和同深度的满二叉树的的节点位置相同则这二叉树是完全二叉树。如下图。
完全二叉树是指从左至右填充节点,直到最后一层,且最后一层的节点都靠左对齐。因此,满二叉树的所有层都可能被填充满,而完全二叉树虽然最后一层不一定满,但是尽可能填充到最左侧。如下图。

![](https://cdn.xiaobinqt.cn/xiaobinqt.io/20230805/90538ecd70fc4c439054eed2e33b93c6.png '图片')

### 二叉查找树

接下来我们来简单看一下二叉查找树,此二叉查找树的 “二” 非彼二,因为此 “二” 既可以说是表示二叉的树,也可以表示二分查找,因为二叉查找树既是二叉也融合了二分查找。
此二叉查找树的 “二” 非彼二,因为此 “二” 既可以说是表示二叉的树,也可以表示二分查找,因为二叉查找树既是二叉也融合了二分查找。

先简单的看看二分查找,二分查找可以避免有序的数组从头依次的遍历查询,因为我们知道这种情况如果要查找一个数最差的情况时间复杂就是`O(n)`
,整体查询效率不高。而如果数组是**有序**的,就可以通过二分查找将每次的查询范围减半,时间复杂度自然就是`O(logn)`。如下图所示。
Expand All @@ -212,7 +210,7 @@ select * from weixin where age < 18

![](https://cdn.xiaobinqt.cn/xiaobinqt.io/20230805/2fa9c648547f4c15a87959a2b3459dfa.png '图片')

当二分查找树退化成链表时,我们都知道链表不仅不能高效查询而且也增加了磁盘 IO 操作,所以我们得划向下一个树型数据结构。
当二分查找树退化成链表时,我们知道链表不仅不能高效查询而且也增加了磁盘 IO 操作,所以我们得划向下一个树型数据结构。

### 自平衡二叉树/AVL树

Expand Down

0 comments on commit 0a8fd64

Please sign in to comment.