add MindMap

This commit is contained in:
KimYang
2020-09-26 22:33:18 +08:00
parent 853e5af6a5
commit 1a99a5919f
137 changed files with 6955 additions and 6955 deletions

24
.github/FUNDING.yml vendored
View File

@@ -1,12 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://cdn.jsdelivr.net/gh/KimYangOfCat/KimYangOfCat/img/sponsor.png
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://cdn.jsdelivr.net/gh/KimYangOfCat/KimYangOfCat/img/sponsor.png

View File

@@ -1,24 +1,24 @@
name: vuepress-deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: vuepress-deploy
uses: jenkey2011/vuepress-deploy@master
env:
ACCESS_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
TARGET_REPO: KimYangOfCat/2021-CSPostgraduate-408
TARGET_BRANCH: gh-pages
BUILD_SCRIPT: yarn && yarn build
BUILD_DIR: 408Notes/.vuepress/dist/
CNAME: 408.kimyang.cn
name: vuepress-deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: vuepress-deploy
uses: jenkey2011/vuepress-deploy@master
env:
ACCESS_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
TARGET_REPO: KimYangOfCat/2021-CSPostgraduate-408
TARGET_BRANCH: gh-pages
BUILD_SCRIPT: yarn && yarn build
BUILD_DIR: 408Notes/.vuepress/dist/
CNAME: 408.kimyang.cn

120
.gitignore vendored
View File

@@ -1,61 +1,61 @@
# Prerequisites
*.d
node_modules/
yarn.lock
package-lock.json
cmake-build-debug/*
.idea/*
408Notes/.vuepress/dist/*
.DS_Store
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
# Prerequisites
*.d
node_modules/
yarn.lock
package-lock.json
cmake-build-debug/*
.idea/*
408Notes/.vuepress/dist/*
.DS_Store
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@@ -1 +1 @@
# 408 真题
# 408 真题

View File

@@ -1,199 +1,199 @@
module.exports = {
title: "CSPostgraduate",
base: "/",
repo: "https://github.com/KimYangOfCat/2021-CSPostgraduate-408",
description:"2021 CSPostgraduate 408",
port:4080,
theme: '@vuepress/theme-default',
themeConfig: {
logo: 'icons.png',
head:[
['link',{rel:'icon',href:'/favicon.ico',type:"image/x-icon"}],
['link',{rel:' short icon',href:'/favicon.ico',type:"image/x-icon"}],
['link', { rel: 'apple-touch-icon', href: `/favicon.ico`,type:"image/x-icon" }],
],
nav: [
{text: '首页', link: '/'},
{text: '数据结构', link: '/DataStructure/'},
{text: '计算机组成原理', link: '/ComputerOrganization/'},
{text: '计算机网络', link: '/ComputerNetwork/'},
{text: '操作系统', link: '/OperatingSystem/'},
{text: '留言板', link: '/contact'},
// {text: 'GitHub', link: 'https://github.com/KimYangOfCat/2021-CSPostgraduate-408', target: '_blank'},
],
sidebar:
{
'/DataStructure/': getDataStructureSidebar(),
'/ComputerOrganization/': getComputerOrganizationSidebar(),
'/ComputerNetwork/': getComputerNetworkSidebar(),
'/OperatingSystem/': getOperatingSystemSidebar(),
// fallback
'/': [
// '', /* / */
// 'contact', /* /contact.html */
]
},
// 默认值是 true 。设置为 false 来禁用所有页面的 下一篇 链接
nextLinks: true,
// 默认值是 true 。设置为 false 来禁用所有页面的 上一篇 链接
prevLinks: true,
lastUpdated:"最后更新时间:",
smoothScroll: true,
// 假定是 GitHub. 同时也可以是一个完整的 GitLab URL
repo: 'KimYangOfCat/2021-CSPostgraduate-408',
// 自定义仓库链接文字。默认从 `themeConfig.repo` 中自动推断为
// "GitHub"/"GitLab"/"Bitbucket" 其中之一,或是 "Source"。
repoLabel: 'GitHub',
// 以下为可选的编辑链接选项
// 假如你的文档仓库和项目本身不在一个仓库:
// docsRepo: 'KimYangOfCat/2021-CSPostgraduate-408',
// 假如文档不是放在仓库的根目录下:
docsDir: '408Notes',
// 假如文档放在一个特定的分支下:
docsBranch: 'master',
// 默认是 false, 设置为 true 来启用
editLinks: true,
// 默认为 "Edit this page"
editLinkText: '帮助我们完善此页面吧~'
},
plugins: {
'@vssue/vuepress-plugin-vssue': {
baseURL:"https://github.com",
platform: 'github-v4', //v3的platform是githubv4的是github-v4
locale: 'zh', //语言
// 其他的 Vssue 配置
owner: 'KimYangOfCat', //github账户名
repo: '2021-CSPostgraduate-408', //github一个项目的名称
clientId: '0b51066b027f4cb4a5a3',//注册的Client ID
clientSecret: '4b816edafb10d7e828c0faaaa18df1e7d08585c2',//注册的Client Secret
autoCreateIssue:false,// 自动创建评论默认是false
labels:['Comments'],//Vssue 通过 title 和 labels 来确定用来存储评论的对应 Issue
prefix:'[Comments]',//Issue 标题的前缀
locale:'zh',//使用的语言。
issueContent: ({ url }) =>`这个 Issue 由评论系统自动创建,用来存储该页面的评论:${url}`,
},
},
}
function getDataStructureSidebar() {
return [
'/DataStructure/',
{
title: '零、绪论', // 必要的
path: '/DataStructure/DS_0_Introduction', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_0_Introduction/Doc_0_0_数据结构基本概念',
'/DataStructure/DS_0_Introduction/Doc_0_1_算法基本概念',
]
},
{
title: '一、线性表', // 必要的
path: '/DataStructure/DS_1_LinearList', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_1_LinearList/Doc_1_0_线性表',
'/DataStructure/DS_1_LinearList/Doc_1_1_顺序表',
'/DataStructure/DS_1_LinearList/Doc_1_2_单链表',
'/DataStructure/DS_1_LinearList/Doc_1_3_双链表',
'/DataStructure/DS_1_LinearList/Doc_1_4_循环链表',
'/DataStructure/DS_1_LinearList/Doc_1_5_静态链表',
'/DataStructure/DS_1_LinearList/Doc_1_6_章节总结',
]
},
{
title: '二、栈与队列', // 必要的
path: '/DataStructure/DS_2_StackAndQueue', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_2_StackAndQueue/Doc_2_0_栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_1_顺序栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_2_链栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_3_队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_4_顺序队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_5_链式队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_6_双端队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_7_栈的应用',
'/DataStructure/DS_2_StackAndQueue/Doc_2_8_队列的应用',
]
},
{
title: '三、字符串', // 必要的
path: '/DataStructure/DS_3_String', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_3_String/Doc_3_0_串',
'/DataStructure/DS_3_String/Doc_3_1_串的存储结构',
'/DataStructure/DS_3_String/Doc_3_2_模式匹配',
'/DataStructure/DS_3_String/Doc_3_3_KMP算法',
'/DataStructure/DS_3_String/Doc_3_4_KMP算法的优化',
]
},
{
title: '四、树与二叉树', // 必要的
path: '/DataStructure/DS_4_TreeAndBinaryTree', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_0_树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_1_树的性质',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_2_二叉树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_3_二叉树的性质',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_4_二叉树的存储结构',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_5_二叉树的遍历',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_6_二叉树的构造',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_7_线索二叉树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_8_二叉树的线索化',
]
},
{
title: '五、图', // 必要的
path: '/DataStructure/DS_5_Graph/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
{
title: '六、搜索', // 必要的
path: '/DataStructure/DS_6_Search/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
{
title: '七、排序', // 必要的
path: '/DataStructure/DS_7_Sort/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
]
}
function getComputerOrganizationSidebar() {
return [
'/ComputerOrganization/',
]
}
function getComputerNetworkSidebar() {
return [
'/ComputerNetwork/',
]
}
function getOperatingSystemSidebar() {
return [
'/OperatingSystem/',
]
module.exports = {
title: "CSPostgraduate",
base: "/",
repo: "https://github.com/KimYangOfCat/2021-CSPostgraduate-408",
description:"2021 CSPostgraduate 408",
port:4080,
theme: '@vuepress/theme-default',
themeConfig: {
logo: 'icons.png',
head:[
['link',{rel:'icon',href:'/favicon.ico',type:"image/x-icon"}],
['link',{rel:' short icon',href:'/favicon.ico',type:"image/x-icon"}],
['link', { rel: 'apple-touch-icon', href: `/favicon.ico`,type:"image/x-icon" }],
],
nav: [
{text: '首页', link: '/'},
{text: '数据结构', link: '/DataStructure/'},
{text: '计算机组成原理', link: '/ComputerOrganization/'},
{text: '计算机网络', link: '/ComputerNetwork/'},
{text: '操作系统', link: '/OperatingSystem/'},
{text: '留言板', link: '/contact'},
// {text: 'GitHub', link: 'https://github.com/KimYangOfCat/2021-CSPostgraduate-408', target: '_blank'},
],
sidebar:
{
'/DataStructure/': getDataStructureSidebar(),
'/ComputerOrganization/': getComputerOrganizationSidebar(),
'/ComputerNetwork/': getComputerNetworkSidebar(),
'/OperatingSystem/': getOperatingSystemSidebar(),
// fallback
'/': [
// '', /* / */
// 'contact', /* /contact.html */
]
},
// 默认值是 true 。设置为 false 来禁用所有页面的 下一篇 链接
nextLinks: true,
// 默认值是 true 。设置为 false 来禁用所有页面的 上一篇 链接
prevLinks: true,
lastUpdated:"最后更新时间:",
smoothScroll: true,
// 假定是 GitHub. 同时也可以是一个完整的 GitLab URL
repo: 'KimYangOfCat/2021-CSPostgraduate-408',
// 自定义仓库链接文字。默认从 `themeConfig.repo` 中自动推断为
// "GitHub"/"GitLab"/"Bitbucket" 其中之一,或是 "Source"。
repoLabel: 'GitHub',
// 以下为可选的编辑链接选项
// 假如你的文档仓库和项目本身不在一个仓库:
// docsRepo: 'KimYangOfCat/2021-CSPostgraduate-408',
// 假如文档不是放在仓库的根目录下:
docsDir: '408Notes',
// 假如文档放在一个特定的分支下:
docsBranch: 'master',
// 默认是 false, 设置为 true 来启用
editLinks: true,
// 默认为 "Edit this page"
editLinkText: '帮助我们完善此页面吧~'
},
plugins: {
'@vssue/vuepress-plugin-vssue': {
baseURL:"https://github.com",
platform: 'github-v4', //v3的platform是githubv4的是github-v4
locale: 'zh', //语言
// 其他的 Vssue 配置
owner: 'KimYangOfCat', //github账户名
repo: '2021-CSPostgraduate-408', //github一个项目的名称
clientId: '0b51066b027f4cb4a5a3',//注册的Client ID
clientSecret: '4b816edafb10d7e828c0faaaa18df1e7d08585c2',//注册的Client Secret
autoCreateIssue:false,// 自动创建评论默认是false
labels:['Comments'],//Vssue 通过 title 和 labels 来确定用来存储评论的对应 Issue
prefix:'[Comments]',//Issue 标题的前缀
locale:'zh',//使用的语言。
issueContent: ({ url }) =>`这个 Issue 由评论系统自动创建,用来存储该页面的评论:${url}`,
},
},
}
function getDataStructureSidebar() {
return [
'/DataStructure/',
{
title: '零、绪论', // 必要的
path: '/DataStructure/DS_0_Introduction', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_0_Introduction/Doc_0_0_数据结构基本概念',
'/DataStructure/DS_0_Introduction/Doc_0_1_算法基本概念',
]
},
{
title: '一、线性表', // 必要的
path: '/DataStructure/DS_1_LinearList', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_1_LinearList/Doc_1_0_线性表',
'/DataStructure/DS_1_LinearList/Doc_1_1_顺序表',
'/DataStructure/DS_1_LinearList/Doc_1_2_单链表',
'/DataStructure/DS_1_LinearList/Doc_1_3_双链表',
'/DataStructure/DS_1_LinearList/Doc_1_4_循环链表',
'/DataStructure/DS_1_LinearList/Doc_1_5_静态链表',
'/DataStructure/DS_1_LinearList/Doc_1_6_章节总结',
]
},
{
title: '二、栈与队列', // 必要的
path: '/DataStructure/DS_2_StackAndQueue', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_2_StackAndQueue/Doc_2_0_栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_1_顺序栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_2_链栈',
'/DataStructure/DS_2_StackAndQueue/Doc_2_3_队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_4_顺序队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_5_链式队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_6_双端队列',
'/DataStructure/DS_2_StackAndQueue/Doc_2_7_栈的应用',
'/DataStructure/DS_2_StackAndQueue/Doc_2_8_队列的应用',
]
},
{
title: '三、字符串', // 必要的
path: '/DataStructure/DS_3_String', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_3_String/Doc_3_0_串',
'/DataStructure/DS_3_String/Doc_3_1_串的存储结构',
'/DataStructure/DS_3_String/Doc_3_2_模式匹配',
'/DataStructure/DS_3_String/Doc_3_3_KMP算法',
'/DataStructure/DS_3_String/Doc_3_4_KMP算法的优化',
]
},
{
title: '四、树与二叉树', // 必要的
path: '/DataStructure/DS_4_TreeAndBinaryTree', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_0_树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_1_树的性质',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_2_二叉树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_3_二叉树的性质',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_4_二叉树的存储结构',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_5_二叉树的遍历',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_6_二叉树的构造',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_7_线索二叉树',
'/DataStructure/DS_4_TreeAndBinaryTree/Doc_4_8_二叉树的线索化',
]
},
{
title: '五、图', // 必要的
path: '/DataStructure/DS_5_Graph/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
{
title: '六、搜索', // 必要的
path: '/DataStructure/DS_6_Search/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
{
title: '七、排序', // 必要的
path: '/DataStructure/DS_7_Sort/', // 可选的, 标题的跳转链接,应为绝对路径且必须存在
collapsable: true, // 可选的, 默认值是 true,
sidebarDepth: 2, // 可选的, 默认值是 1
children: [
]
},
]
}
function getComputerOrganizationSidebar() {
return [
'/ComputerOrganization/',
]
}
function getComputerNetworkSidebar() {
return [
'/ComputerNetwork/',
]
}
function getOperatingSystemSidebar() {
return [
'/OperatingSystem/',
]
}

View File

@@ -1,3 +1,3 @@
.content {
font-size 30px
.content {
font-size 30px
}

View File

@@ -1,20 +1,20 @@
//
$accentColor = #46ADD8
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
$arrowBgColor = #ccc
$badgeTipColor = #1e87d8
$badgeWarningColor = darken(#ffe564, 35%)
$badgeErrorColor = #DA5961
//
$navbarHeight = 3.6rem
$sidebarWidth = 20rem
$contentWidth = 740px
$homePageWidth = 960px
//
$MQNarrow = 959px
$MQMobile = 719px
//
$accentColor = #46ADD8
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
$arrowBgColor = #ccc
$badgeTipColor = #1e87d8
$badgeWarningColor = darken(#ffe564, 35%)
$badgeErrorColor = #DA5961
//
$navbarHeight = 3.6rem
$sidebarWidth = 20rem
$contentWidth = 740px
$homePageWidth = 960px
//
$MQNarrow = 959px
$MQMobile = 719px
$MQMobileNarrow = 419px

View File

@@ -1,8 +1,8 @@
# 计算机网络
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
# 计算机网络
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,24 +1,24 @@
# 计算机系统概述
## 什么是计算机系统
计算机系统=硬件+软件
![image-20200726202448571](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4n8vx9dij31640qwh6a.jpg)
### 软件的划分
![image-20200726202536999](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4n9oi5scj31hi0lsx6b.jpg)
### 硬件的发展
![image-20200726203231845](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4ngvp5whj31k70u04qq.jpg)
微处理器的发展
![image-20200726203323797](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4nhrx8ffj31md0u0hdt.jpg)
![image-20200726203516013](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4njq1ov4j31c40leaua.jpg)
### 软件的发展
# 计算机系统概述
## 什么是计算机系统
计算机系统=硬件+软件
![image-20200726202448571](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4n8vx9dij31640qwh6a.jpg)
### 软件的划分
![image-20200726202536999](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4n9oi5scj31hi0lsx6b.jpg)
### 硬件的发展
![image-20200726203231845](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4ngvp5whj31k70u04qq.jpg)
微处理器的发展
![image-20200726203323797](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4nhrx8ffj31md0u0hdt.jpg)
![image-20200726203516013](https://tva1.sinaimg.cn/large/007S8ZIlly1gh4njq1ov4j31c40leaua.jpg)
### 软件的发展

View File

@@ -1,7 +1,7 @@
# 计算机组成原理
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
# 计算机组成原理
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,125 +1,125 @@
# 数据结构基本概念
![image-20200616203728181](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001224.jpg)
## 基本概念
### 什么是数据?
数据是**信息的载体**,是客观描述事物属性的数、字符及**所有能输入到计算机中并被计算机程序识别和处理的符号**的集合。数据是计算机程序加工的原料。
### 数据元素、数据项
**数据元素**是数据的基本单位,通常作为一个整体进行考虑和处理。
一个数据元素可由若干**数据项**组成,数据项是构成数据元素的不可分割的最小单位。
### 数据结构、数据对象
结构——各个元素之间的关系
**数据结构**是互相之间存在一个或多种**特定关系**的数据元素的集合。
**数据对象**是具有**相同性质**的数据元素的集合,是一个数据的子集。
## 三要素
![image-20200616204952204](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001225.jpg)
### 逻辑结构
即,数据元素之间的逻辑关系是什么?
![image-20200616205141919](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001226.jpg)
#### 集合
![image-20200616205508144](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001227.jpg)
各个数据元素同属一个集合,别无其它关系
#### 线性结构
![image-20200616205527638](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001228.jpg)
数据元素之间是一对一的关系,除了第一个元素,所有元素都有唯一前驱,除了最后一个元素,所有元素都有唯一后继
#### 树形结构
![image-20200616205648476](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001229.jpg)
数据元素之间是一对多的关系
#### 图结构
![image-20200616205732165](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001230.jpg)
数据元素之间是多对多的关系
### 物理结构
即,物理结构,如何用计算机表示数据元素的逻辑关系?
#### 顺序存储
![image-20200616205941135](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001231.jpg)
**把逻辑上相邻的元素存储在物理地址上也相邻的存储单元中**,元素之间的关系由存储单元的领接关系来体现。
#### 链式存储
![image-20200616210302754](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001232.jpg)
#### 索引存储
![image-20200616210349944](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001233.jpg)
#### 散列存储
![image-20200616210434678](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001234.jpg)
#### 总结
![image-20200616210508542](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001235.jpg)
1. 若采用顺序存储,则各个数据元素在物理上必须是连续的;若采用非顺存储,则各个数据元素在物理上是可以离散的
2. 数据的存储结构会影响存储空间的分配的方便程度
3. 数据的存储机构会影响对数据运算的速度
### 数据的运算
施加在数据上的运算包括运算的定义和实现。运算的定义是针对逻辑结构的,正对运算的功能;运算的实现是针对存储结构的,指的是运算实现的具体操作步骤。
## 数据类型、抽象数据类型
### 数据类型
数据类型是一个值的集合和定义在此集合的一组操作的总称。
1. 原子类型,其值不可再分的数据类型
2. 结构类型,其值可以再分解为若干成分(分量)的数据类型
![image-20200616211417412](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001236.jpg)
### 抽象数据类型
Abstract Data Type ADT是抽象数据组织及与之相关的操作。
ADT 是用数学化的语言定义数据的逻辑结构、定义运算。与其具体的实现无关(类似于定义类吗?可能)
## 总结
![image-20200616212103345](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001237.jpg)
![image-20200616212152228](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001238.jpg)
在探讨一种数据结构时:
1. 定义逻辑结构(数据原元素之间的关系)
2. 定义数据的运算(针对现实需求,应该对这种逻辑结构进行什么样的运算)
3. 确定某种存储结构,实现数据结构,并实现一些对数据结构的基本运算
![image-20200616212530957](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001239.jpg)
<!-- 评论模块,不可删除 -->
# 数据结构基本概念
![image-20200616203728181](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001224.jpg)
## 基本概念
### 什么是数据?
数据是**信息的载体**,是客观描述事物属性的数、字符及**所有能输入到计算机中并被计算机程序识别和处理的符号**的集合。数据是计算机程序加工的原料。
### 数据元素、数据项
**数据元素**是数据的基本单位,通常作为一个整体进行考虑和处理。
一个数据元素可由若干**数据项**组成,数据项是构成数据元素的不可分割的最小单位。
### 数据结构、数据对象
结构——各个元素之间的关系
**数据结构**是互相之间存在一个或多种**特定关系**的数据元素的集合。
**数据对象**是具有**相同性质**的数据元素的集合,是一个数据的子集。
## 三要素
![image-20200616204952204](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001225.jpg)
### 逻辑结构
即,数据元素之间的逻辑关系是什么?
![image-20200616205141919](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001226.jpg)
#### 集合
![image-20200616205508144](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001227.jpg)
各个数据元素同属一个集合,别无其它关系
#### 线性结构
![image-20200616205527638](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001228.jpg)
数据元素之间是一对一的关系,除了第一个元素,所有元素都有唯一前驱,除了最后一个元素,所有元素都有唯一后继
#### 树形结构
![image-20200616205648476](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001229.jpg)
数据元素之间是一对多的关系
#### 图结构
![image-20200616205732165](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001230.jpg)
数据元素之间是多对多的关系
### 物理结构
即,物理结构,如何用计算机表示数据元素的逻辑关系?
#### 顺序存储
![image-20200616205941135](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001231.jpg)
**把逻辑上相邻的元素存储在物理地址上也相邻的存储单元中**,元素之间的关系由存储单元的领接关系来体现。
#### 链式存储
![image-20200616210302754](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001232.jpg)
#### 索引存储
![image-20200616210349944](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001233.jpg)
#### 散列存储
![image-20200616210434678](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001234.jpg)
#### 总结
![image-20200616210508542](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001235.jpg)
1. 若采用顺序存储,则各个数据元素在物理上必须是连续的;若采用非顺存储,则各个数据元素在物理上是可以离散的
2. 数据的存储结构会影响存储空间的分配的方便程度
3. 数据的存储机构会影响对数据运算的速度
### 数据的运算
施加在数据上的运算包括运算的定义和实现。运算的定义是针对逻辑结构的,正对运算的功能;运算的实现是针对存储结构的,指的是运算实现的具体操作步骤。
## 数据类型、抽象数据类型
### 数据类型
数据类型是一个值的集合和定义在此集合的一组操作的总称。
1. 原子类型,其值不可再分的数据类型
2. 结构类型,其值可以再分解为若干成分(分量)的数据类型
![image-20200616211417412](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001236.jpg)
### 抽象数据类型
Abstract Data Type ADT是抽象数据组织及与之相关的操作。
ADT 是用数学化的语言定义数据的逻辑结构、定义运算。与其具体的实现无关(类似于定义类吗?可能)
## 总结
![image-20200616212103345](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001237.jpg)
![image-20200616212152228](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001238.jpg)
在探讨一种数据结构时:
1. 定义逻辑结构(数据原元素之间的关系)
2. 定义数据的运算(针对现实需求,应该对这种逻辑结构进行什么样的运算)
3. 确定某种存储结构,实现数据结构,并实现一些对数据结构的基本运算
![image-20200616212530957](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001239.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,134 +1,134 @@
# 算法基本概念
## 基本概念
![image-20200616214853491](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001358.jpg)
### 什么是算法?
程序=数据结构+算法
![image-20200616215006166](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001359.jpg)
###算法的特性
1. 有穷性:一个算法必须总在执行有穷步之后结束,且每一步都可在有穷时间内完成。
注:算法必须是有穷的,二程序可以是无穷的。
![image-20200616215340371](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001400.jpg)
2. 确定性:算法每一条指令必须有确切的含义,对于相同的输入只能得出相同的输出
3. 可行性:算法描述的操作都可以通过已经实现的基本运算执行有限次来实现。
4. 输入一个算法有0个或多个输入这些输入取自某个特定对象的集合。
5. 输出:一个算法有一个或多个输出,这些输出是与输入有着某种特定关系的量。
五个特性,缺一不可
####“好”算法的特质
1. 正确性:算法应能正确地解决求解问题。
2. 可读性:算法应具有良好的可读性,帮助人们理解。
3. 健壮性:输入非法数据时,算法能适当地做出反应或进行处理,而不会产生莫名其妙的输出结果。
4. 高效率与底存储量需求:执行速度快,时间复杂度低。不费内存,空间复杂度低。
###总结
![image-20200616220536590](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001401.jpg)
## 算法效率的度量
![image-20200616220923527](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001402.jpg)
### 如何评估算法时间开销?
**让算法先运行,事后统计运行时间?**
存在的问题?
* 和机器性能有关比如超级计算机VS单片机
* 和编程语言有关,越高级的语言执行效率越低,没错,就是越低
* 和编译程序产生的机器指令质量有关
* 有些算法是不能事后统计的,比如,导弹控制算法。
评价一个算法优劣时,需要排除与算法本身无关的外界因素,能否事先估计?
### 算法时间复杂度
事前预估算法时间开销T(n)与问题规模n的关系T 表示 time
如何计算T例子
![image-20200616234743261](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001403.jpg)
#### 问题1:是否可以忽略表达式某些部分?
![image-20200616235203889](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001404.jpg)
1. 加法规则多项相加只保留最高阶的项且系数变为1
![image-20200616235558501](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001405.jpg)
2. 乘法规则:多项相乘,都保留
![image-20200616235856976](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001406.jpg)
##### 算法时间复杂度阶数顺序
![image-20200617000121744](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001407.jpg)
![image-20200617000310666](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001408.jpg)
#### 如果有好几千行代码,需要一行一行数?
1. 顺序执行的代码只会影响常数项,可以忽略
2. 只需要挑循环中的一个基本操作分析它的执行次数和n的关系就好
3. 如果有多层嵌套循环,只需要关注最深层的循环循环了几次
#### 小练习
![image-20200617001603926](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001409.jpg)
![image-20200617001659516](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001410.jpg)
![image-20200617001353856](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001411.jpg)
#### 总结
![image-20200617001826231](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001412.jpg)
算法的性能问题只有在n很大时才会暴露出来。
### 算法空间复杂度
#### 原地工作算法
![image-20200617002424730](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001413.jpg)
分析空间复杂度时,只需关注与问题规模相关的变量就好(讲人话,就是,看程序中的变量就好)
![image-20200617002625466](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001414.jpg)
加法法则
![image-20200617002941853](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001415.jpg)
#### 函数递归调用带来的内存开销
![image-20200617003249255](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001416.jpg)
在这种情况下,空间复杂度等于递归调用的深度。
![image-20200617003702543](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001417.jpg)
递归调用的过程中,每一次开辟的内存空间也可以不一致,如上例。
#### 总结
![image-20200617003857723](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001418.jpg)
<!-- 评论模块,不可删除 -->
# 算法基本概念
## 基本概念
![image-20200616214853491](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001358.jpg)
### 什么是算法?
程序=数据结构+算法
![image-20200616215006166](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001359.jpg)
###算法的特性
1. 有穷性:一个算法必须总在执行有穷步之后结束,且每一步都可在有穷时间内完成。
注:算法必须是有穷的,二程序可以是无穷的。
![image-20200616215340371](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001400.jpg)
2. 确定性:算法每一条指令必须有确切的含义,对于相同的输入只能得出相同的输出
3. 可行性:算法描述的操作都可以通过已经实现的基本运算执行有限次来实现。
4. 输入一个算法有0个或多个输入这些输入取自某个特定对象的集合。
5. 输出:一个算法有一个或多个输出,这些输出是与输入有着某种特定关系的量。
五个特性,缺一不可
####“好”算法的特质
1. 正确性:算法应能正确地解决求解问题。
2. 可读性:算法应具有良好的可读性,帮助人们理解。
3. 健壮性:输入非法数据时,算法能适当地做出反应或进行处理,而不会产生莫名其妙的输出结果。
4. 高效率与底存储量需求:执行速度快,时间复杂度低。不费内存,空间复杂度低。
###总结
![image-20200616220536590](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001401.jpg)
## 算法效率的度量
![image-20200616220923527](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001402.jpg)
### 如何评估算法时间开销?
**让算法先运行,事后统计运行时间?**
存在的问题?
* 和机器性能有关比如超级计算机VS单片机
* 和编程语言有关,越高级的语言执行效率越低,没错,就是越低
* 和编译程序产生的机器指令质量有关
* 有些算法是不能事后统计的,比如,导弹控制算法。
评价一个算法优劣时,需要排除与算法本身无关的外界因素,能否事先估计?
### 算法时间复杂度
事前预估算法时间开销T(n)与问题规模n的关系T 表示 time
如何计算T例子
![image-20200616234743261](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001403.jpg)
#### 问题1:是否可以忽略表达式某些部分?
![image-20200616235203889](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001404.jpg)
1. 加法规则多项相加只保留最高阶的项且系数变为1
![image-20200616235558501](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001405.jpg)
2. 乘法规则:多项相乘,都保留
![image-20200616235856976](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001406.jpg)
##### 算法时间复杂度阶数顺序
![image-20200617000121744](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001407.jpg)
![image-20200617000310666](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001408.jpg)
#### 如果有好几千行代码,需要一行一行数?
1. 顺序执行的代码只会影响常数项,可以忽略
2. 只需要挑循环中的一个基本操作分析它的执行次数和n的关系就好
3. 如果有多层嵌套循环,只需要关注最深层的循环循环了几次
#### 小练习
![image-20200617001603926](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001409.jpg)
![image-20200617001659516](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001410.jpg)
![image-20200617001353856](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001411.jpg)
#### 总结
![image-20200617001826231](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001412.jpg)
算法的性能问题只有在n很大时才会暴露出来。
### 算法空间复杂度
#### 原地工作算法
![image-20200617002424730](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001413.jpg)
分析空间复杂度时,只需关注与问题规模相关的变量就好(讲人话,就是,看程序中的变量就好)
![image-20200617002625466](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001414.jpg)
加法法则
![image-20200617002941853](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001415.jpg)
#### 函数递归调用带来的内存开销
![image-20200617003249255](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001416.jpg)
在这种情况下,空间复杂度等于递归调用的深度。
![image-20200617003702543](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001417.jpg)
递归调用的过程中,每一次开辟的内存空间也可以不一致,如上例。
#### 总结
![image-20200617003857723](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810001418.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,11 +1,11 @@
# 绪论
## 本章目录
* [数据结构基本概念](Doc_0_0_数据结构基本概念.md)
* [算法基本概念](Doc_0_1_算法基本概念.md)
<!-- 评论模块,不可删除 -->
<Vssue />
# 绪论
## 本章目录
* [数据结构基本概念](Doc_0_0_数据结构基本概念.md)
* [算法基本概念](Doc_0_1_算法基本概念.md)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,43 +1,43 @@
# 线性表
##线性表的基本概念
![image-20200617165505571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002132.jpg)
数据结构的三要素:逻辑结构、数据的运算、存储结构(物理结构)
### 线性表的定义
线性表是具有相同数据类型的n(n>=0)个元素的有限序列。
![image-20200617165917735](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002133.jpg)
### 线性表的基本操作
![image-20200617171119623](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002134.jpg)
#### 什么时候要传入参数的引用“&”?
一种是值类型,使用时会直接复制原值,修改参数不会影响原值
![image-20200617171738597](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002135.jpg)
一种是引用类型使用时操作的是原值修改时直接修改原值C语言不支持这种引用类型
![image-20200617171916923](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002136.jpg)
#### 为什么要实现对数据结构的基本操作?
1. 团队合作编程,你定义的数据结构要让别人能够很方便的使用(封装)
2. 将常用的操作/运算封装称函数,避免重复工作,降低出错风险。
### 总结
![image-20200617171547528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002137.jpg)
注意⚠位序是用1开始计算的
<!-- 评论模块,不可删除 -->
# 线性表
##线性表的基本概念
![image-20200617165505571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002132.jpg)
数据结构的三要素:逻辑结构、数据的运算、存储结构(物理结构)
### 线性表的定义
线性表是具有相同数据类型的n(n>=0)个元素的有限序列。
![image-20200617165917735](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002133.jpg)
### 线性表的基本操作
![image-20200617171119623](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002134.jpg)
#### 什么时候要传入参数的引用“&”?
一种是值类型,使用时会直接复制原值,修改参数不会影响原值
![image-20200617171738597](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002135.jpg)
一种是引用类型使用时操作的是原值修改时直接修改原值C语言不支持这种引用类型
![image-20200617171916923](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002136.jpg)
#### 为什么要实现对数据结构的基本操作?
1. 团队合作编程,你定义的数据结构要让别人能够很方便的使用(封装)
2. 将常用的操作/运算封装称函数,避免重复工作,降低出错风险。
### 总结
![image-20200617171547528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002137.jpg)
注意⚠位序是用1开始计算的
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,204 +1,204 @@
# 顺序表
##顺序表的基本概念
![image-20200617172240151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002154.jpg)
### 顺序表的定义
![image-20200617172428297](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002155.jpg)
### 顺序表的初始化
#### 静态分配
![image-20200617172843813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002156.jpg)
具体实现:
![image-20200617173539443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002157.jpg)
```c
//初始化(静态分配)
void InitList(SqList &L){
for (int i = 0; i < MaxSize; i++) {
L.data[i]=0;//将所有元素的初始值默认设置为0
//这一步其实可以省略,但是省略之后,有可能受到内存中"脏数据"的影响
}
L.length=0;
}
```
##### 问题反思
1. 如果“数组”存满留怎么办?
可以放弃治疗,顺序表长刚开始确定后就无法更改(存储空间是静态的)
2. 如果一开始就声明一个很大的内存空间呢?会存在什么问题?
浪费,会造成大量的浪费。
#### 动态分配
![image-20200617190108177](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002158.jpg)
具体实现方式
![image-20200617190651552](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002159.jpg)
```c
//初始化(动态方式)
bool InitList(SeqList &L){
//用 malloc 函数申请一片连续的存储空间
L.data=(int *)malloc(InitSize*sizeof(int));
if (L.data==NULL)
//要细心呀,这里不小心写成了赋值语句,但是没有报错,找了半天错误!
return false;
//(int *) 是指针的强制类型转换
L.length=0;
L.MaxSize=InitSize;
return true;
}
```
#### 总结
![image-20200617190838244](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002200.jpg)
![image-20200617191008606](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002201.jpg)
### 顺序表的基本操作
#### 插入
ListInsert(&L,i,e):插入操作。在表L中的第i个位置上插入指定元素e。
![image-20200617211304785](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002202.jpg)
详细实现方式:
![image-20200617212225782](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002203.jpg)
优化之后:
![image-20200617212144846](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002204.jpg)
```c
bool ListInsert(SqList &L,int i,int e){
//判断插入的位置是否合法,
if (i<1||i>L.length+1)
return false;
//判断表是否存满了
if (L.length>=MaxSize)
return false;
//后面的元素后移
for (int j = L.length; j >=i ; j--) {
L.data[j]=L.data[j-1];
}
L.data[i-1]=e;
L.length++;
return true;
}
```
#####插入操作的时间复杂度分析
![image-20200617213723625](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002205.jpg)
#### 删除
![image-20200617220850929](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002206.jpg)
```c
//删除
bool ListDelete(SqList &L,int i,int &e){
//判断i的位置是否合法
if(i<0||i>L.length){
return false;
}
//取出将要被删除的数
e=L.data[i-1];
//将其后的数据前移
for (int j = i; j <=L.length ; j++) {
L.data[j-1]=L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
```
##### 删除操作的时间复杂度分析
![image-20200617221030044](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002207.jpg)
#### 总结反思
![image-20200617221250309](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002208.jpg)
#### 查找
#####按位查找
GetElem(L,i):按位查找操作获取表L中第i个位置的元素的值
###### 静态分配状态下的实现方式
![image-20200617222107279](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002209.jpg)
###### 动态分配状态下的实现方式
![image-20200617222212660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002210.jpg)
用指针加数组下标的方式取数据的时候,数组类型决定着取数据时取几个字节!!
```c
//按位查找
int GetElem(SeqList L,int i){
//判断是否越界
if (i<0||i>L.length)
return -1;
return L.data[i-1];
}
```
###### 按位查找的时间复杂度分析
![image-20200617222451314](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002211.jpg)
##### 按值查找
![image-20200618215105169](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002212.jpg)
```c
//按值查找
int LocateElem(SeqList L,int e){
//循环出查找
for (int i = 0; i <L.length ; i++) {
if (L.data[i]==e)
return i+1; //返回位序
}
return -1;
}
```
###### 结构类型的比较
![image-20200618215217216](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002213.jpg)
注意:考研初试中华,手写代码可以直接用“==”无论是ElemType是基本数据类型还是结构类型手写代码主要考察学生是否理解算法思想不会严格要求代码完全可运行
有的学校复试考《C语言程序设计》那么。。。也许就要语法严格一些
###### 按值查找的时间复杂度
![image-20200618215714251](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002214.jpg)
##### 总结反思
![image-20200618215837154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002215.jpg)
<!-- 评论模块,不可删除 -->
# 顺序表
##顺序表的基本概念
![image-20200617172240151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002154.jpg)
### 顺序表的定义
![image-20200617172428297](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002155.jpg)
### 顺序表的初始化
#### 静态分配
![image-20200617172843813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002156.jpg)
具体实现:
![image-20200617173539443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002157.jpg)
```c
//初始化(静态分配)
void InitList(SqList &L){
for (int i = 0; i < MaxSize; i++) {
L.data[i]=0;//将所有元素的初始值默认设置为0
//这一步其实可以省略,但是省略之后,有可能受到内存中"脏数据"的影响
}
L.length=0;
}
```
##### 问题反思
1. 如果“数组”存满留怎么办?
可以放弃治疗,顺序表长刚开始确定后就无法更改(存储空间是静态的)
2. 如果一开始就声明一个很大的内存空间呢?会存在什么问题?
浪费,会造成大量的浪费。
#### 动态分配
![image-20200617190108177](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002158.jpg)
具体实现方式
![image-20200617190651552](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002159.jpg)
```c
//初始化(动态方式)
bool InitList(SeqList &L){
//用 malloc 函数申请一片连续的存储空间
L.data=(int *)malloc(InitSize*sizeof(int));
if (L.data==NULL)
//要细心呀,这里不小心写成了赋值语句,但是没有报错,找了半天错误!
return false;
//(int *) 是指针的强制类型转换
L.length=0;
L.MaxSize=InitSize;
return true;
}
```
#### 总结
![image-20200617190838244](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002200.jpg)
![image-20200617191008606](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002201.jpg)
### 顺序表的基本操作
#### 插入
ListInsert(&L,i,e):插入操作。在表L中的第i个位置上插入指定元素e。
![image-20200617211304785](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002202.jpg)
详细实现方式:
![image-20200617212225782](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002203.jpg)
优化之后:
![image-20200617212144846](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002204.jpg)
```c
bool ListInsert(SqList &L,int i,int e){
//判断插入的位置是否合法,
if (i<1||i>L.length+1)
return false;
//判断表是否存满了
if (L.length>=MaxSize)
return false;
//后面的元素后移
for (int j = L.length; j >=i ; j--) {
L.data[j]=L.data[j-1];
}
L.data[i-1]=e;
L.length++;
return true;
}
```
#####插入操作的时间复杂度分析
![image-20200617213723625](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002205.jpg)
#### 删除
![image-20200617220850929](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002206.jpg)
```c
//删除
bool ListDelete(SqList &L,int i,int &e){
//判断i的位置是否合法
if(i<0||i>L.length){
return false;
}
//取出将要被删除的数
e=L.data[i-1];
//将其后的数据前移
for (int j = i; j <=L.length ; j++) {
L.data[j-1]=L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
```
##### 删除操作的时间复杂度分析
![image-20200617221030044](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002207.jpg)
#### 总结反思
![image-20200617221250309](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002208.jpg)
#### 查找
#####按位查找
GetElem(L,i):按位查找操作获取表L中第i个位置的元素的值
###### 静态分配状态下的实现方式
![image-20200617222107279](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002209.jpg)
###### 动态分配状态下的实现方式
![image-20200617222212660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002210.jpg)
用指针加数组下标的方式取数据的时候,数组类型决定着取数据时取几个字节!!
```c
//按位查找
int GetElem(SeqList L,int i){
//判断是否越界
if (i<0||i>L.length)
return -1;
return L.data[i-1];
}
```
###### 按位查找的时间复杂度分析
![image-20200617222451314](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002211.jpg)
##### 按值查找
![image-20200618215105169](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002212.jpg)
```c
//按值查找
int LocateElem(SeqList L,int e){
//循环出查找
for (int i = 0; i <L.length ; i++) {
if (L.data[i]==e)
return i+1; //返回位序
}
return -1;
}
```
###### 结构类型的比较
![image-20200618215217216](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002213.jpg)
注意:考研初试中华,手写代码可以直接用“==”无论是ElemType是基本数据类型还是结构类型手写代码主要考察学生是否理解算法思想不会严格要求代码完全可运行
有的学校复试考《C语言程序设计》那么。。。也许就要语法严格一些
###### 按值查找的时间复杂度
![image-20200618215714251](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002214.jpg)
##### 总结反思
![image-20200618215837154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002215.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,184 +1,184 @@
# 单链表
![image-20200618221439465](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002338.jpg)
![image-20200618221516210](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002339.jpg)
## 什么是单链表?
![image-20200618221658525](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002340.jpg)
## 单链表的定义
![image-20200618221959788](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002341.jpg)
### 别名
![image-20200618222203154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002342.jpg)
![image-20200618222313544](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002344.jpg)
注释:或者可以理解为指向头节点的指针既可以表示整个单链表也可以表示头节点,为了便于区分才建议使用 typedef 进行重命名,以方便区别其不同的含义
### 头插法建立单链表
![image-20200619095117732](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002344.jpg)
## 单链表的基本操作
### 单链表的初始化
#### 不带头节点的单链表的初始化
![image-20200619095400757](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002345.jpg)
#### 带头节点的单链表的初始化
![image-20200619095545238](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004036.jpg)
#### 两者区别是什么?
![image-20200619095738329](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004054.jpg)
### 总结
![image-20200619095821536](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004128.jpg)
### 插入和删除
![image-20200619104612536](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004120.jpg)
#### 插入
##### 按位序插入(带头节点的单链表)
![image-20200619105030154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004107.jpg)
具体实现
分析在表头插入
![image-20200619105401211](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004202.jpg)
分析为什么不能颠倒
![image-20200619105451377](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004209.jpg)
分析在表中插入
![image-20200619105800111](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004220.jpg)
分析在表尾插入
![image-20200619110039686](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004242.jpg)
分析插入位置超出表长
![image-20200619110159253](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004250.jpg)
总结
![image-20200619110309541](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004258.jpg)
##### 按位插入(不带头节点)
![image-20200619110418752](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004518.jpg)
具体实现
![image-20200619110547637](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004527.jpg)
结论:不带头节点的单链表,写代码更不方便,除非特别声明,默认推荐使用带头节点的实现方式,还有要注意在考试中带头、不带头都有可能考察,注意审题。
##### 指定节点的后插操作
![image-20200619111032277](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004537.jpg)
指定节点的前插操作
通过传入头指针实现前插
![image-20200619111607840](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004545.jpg)
先进行后插,然后交换前后数据,以此实现前插
![image-20200619111716141](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004557.jpg)
![image-20200619111814873](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004608.jpg)
#### 删除
##### 带有头节点版本
![image-20200619111915877](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004616.jpg)
具体实现
![image-20200619135048885](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004623.jpg)
###### 删除指定结点
![image-20200619135226089](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004635.jpg)
如果P是最后一个节点咋办
只能从表头表头依次寻找前驱时间复杂度O(n)
![image-20200619135401028](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004648.jpg)
单链表的局限性:无法逆向检索!!
#### 总结
![image-20200619135623242](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004703.jpg)
#### 查找
##### 按位查找(带头节点)
![image-20200619152704151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004721.jpg)
#####按值查找(带头节点)
![image-20200619153147639](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004724.jpg)
##### 求表的长度(带头节点)
![image-20200619153411974](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004735.jpg)
#### 总结
![image-20200619153525681](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004742.jpg)
## 单链表的建立方法
![image-20200619153742876](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004802.jpg)
PS找不到对象就娶一个数据元素吧哈哈
### 尾插法
第一种方法:
![image-20200619154012867](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004755.jpg)
问题:时间复杂度太高!!可以用一个指针记录最后一个数据元素的位置来优化时间。
优化之后:
![image-20200619172815577](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004814.jpg)
### 头插法
![image-20200619172945304](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004822.jpg)
具体实现:
![image-20200619173800669](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004833.jpg)
### 总结
![image-20200619173925151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004843.jpg)
<!-- 评论模块,不可删除 -->
# 单链表
![image-20200618221439465](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002338.jpg)
![image-20200618221516210](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002339.jpg)
## 什么是单链表?
![image-20200618221658525](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002340.jpg)
## 单链表的定义
![image-20200618221959788](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002341.jpg)
### 别名
![image-20200618222203154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002342.jpg)
![image-20200618222313544](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002344.jpg)
注释:或者可以理解为指向头节点的指针既可以表示整个单链表也可以表示头节点,为了便于区分才建议使用 typedef 进行重命名,以方便区别其不同的含义
### 头插法建立单链表
![image-20200619095117732](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002344.jpg)
## 单链表的基本操作
### 单链表的初始化
#### 不带头节点的单链表的初始化
![image-20200619095400757](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810002345.jpg)
#### 带头节点的单链表的初始化
![image-20200619095545238](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004036.jpg)
#### 两者区别是什么?
![image-20200619095738329](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004054.jpg)
### 总结
![image-20200619095821536](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004128.jpg)
### 插入和删除
![image-20200619104612536](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004120.jpg)
#### 插入
##### 按位序插入(带头节点的单链表)
![image-20200619105030154](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004107.jpg)
具体实现
分析在表头插入
![image-20200619105401211](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004202.jpg)
分析为什么不能颠倒
![image-20200619105451377](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004209.jpg)
分析在表中插入
![image-20200619105800111](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004220.jpg)
分析在表尾插入
![image-20200619110039686](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004242.jpg)
分析插入位置超出表长
![image-20200619110159253](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004250.jpg)
总结
![image-20200619110309541](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004258.jpg)
##### 按位插入(不带头节点)
![image-20200619110418752](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004518.jpg)
具体实现
![image-20200619110547637](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004527.jpg)
结论:不带头节点的单链表,写代码更不方便,除非特别声明,默认推荐使用带头节点的实现方式,还有要注意在考试中带头、不带头都有可能考察,注意审题。
##### 指定节点的后插操作
![image-20200619111032277](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004537.jpg)
指定节点的前插操作
通过传入头指针实现前插
![image-20200619111607840](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004545.jpg)
先进行后插,然后交换前后数据,以此实现前插
![image-20200619111716141](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004557.jpg)
![image-20200619111814873](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004608.jpg)
#### 删除
##### 带有头节点版本
![image-20200619111915877](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004616.jpg)
具体实现
![image-20200619135048885](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004623.jpg)
###### 删除指定结点
![image-20200619135226089](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004635.jpg)
如果P是最后一个节点咋办
只能从表头表头依次寻找前驱时间复杂度O(n)
![image-20200619135401028](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004648.jpg)
单链表的局限性:无法逆向检索!!
#### 总结
![image-20200619135623242](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004703.jpg)
#### 查找
##### 按位查找(带头节点)
![image-20200619152704151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004721.jpg)
#####按值查找(带头节点)
![image-20200619153147639](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004724.jpg)
##### 求表的长度(带头节点)
![image-20200619153411974](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004735.jpg)
#### 总结
![image-20200619153525681](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004742.jpg)
## 单链表的建立方法
![image-20200619153742876](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004802.jpg)
PS找不到对象就娶一个数据元素吧哈哈
### 尾插法
第一种方法:
![image-20200619154012867](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004755.jpg)
问题:时间复杂度太高!!可以用一个指针记录最后一个数据元素的位置来优化时间。
优化之后:
![image-20200619172815577](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004814.jpg)
### 头插法
![image-20200619172945304](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004822.jpg)
具体实现:
![image-20200619173800669](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004833.jpg)
### 总结
![image-20200619173925151](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004843.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,38 +1,38 @@
# 双链表
![image-20200620154549814](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004859.jpg)
## 单链表VS双链表
![image-20200620154721595](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004905.jpg)
## 双链表基本操作
### 初始化
![image-20200620154836876](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004914.jpg)
### 插入
![image-20200620155038642](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004927.jpg)
优化之后
![image-20200620155238232](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004934.jpg)
### 删除
![image-20200620155535132](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005044.jpg)
### 遍历
![image-20200620155741873](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005053.jpg)
## 总结反思
![image-20200620155909044](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005103.jpg)
<!-- 评论模块,不可删除 -->
# 双链表
![image-20200620154549814](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004859.jpg)
## 单链表VS双链表
![image-20200620154721595](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004905.jpg)
## 双链表基本操作
### 初始化
![image-20200620154836876](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004914.jpg)
### 插入
![image-20200620155038642](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004927.jpg)
优化之后
![image-20200620155238232](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810004934.jpg)
### 删除
![image-20200620155535132](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005044.jpg)
### 遍历
![image-20200620155741873](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005053.jpg)
## 总结反思
![image-20200620155909044](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005103.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,40 +1,40 @@
# 循环链表
![image-20200620160012077](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005122.jpg)
## 循环单链表
![image-20200620160101211](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005123.jpg)
具体实现:
![image-20200620160209813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005124.jpg)
优势:
![image-20200620160300669](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005125.jpg)
![image-20200620160451334](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005126.jpg)
## 循环双链表
![image-20200620160535337](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005127.jpg)
### 初始化
![image-20200620160644172](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005128.jpg)
### 插入
![image-20200620160728846](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005751.jpg)
### 删除
![image-20200620160824559](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005758.jpg)
## 总结反思
![image-20200620161033347](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005803.jpg)
<!-- 评论模块,不可删除 -->
# 循环链表
![image-20200620160012077](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005122.jpg)
## 循环单链表
![image-20200620160101211](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005123.jpg)
具体实现:
![image-20200620160209813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005124.jpg)
优势:
![image-20200620160300669](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005125.jpg)
![image-20200620160451334](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005126.jpg)
## 循环双链表
![image-20200620160535337](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005127.jpg)
### 初始化
![image-20200620160644172](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005128.jpg)
### 插入
![image-20200620160728846](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005751.jpg)
### 删除
![image-20200620160824559](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005758.jpg)
## 总结反思
![image-20200620161033347](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005803.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,32 +1,32 @@
# 静态链表
![image-20200620161229028](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005810.jpg)
## 什么是静态链表?
![image-20200620161554872](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005814.jpg)
## 定义一个静态链表
方法1:
![image-20200620161706934](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005821.jpg)
方法2:
![image-20200620161934969](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005825.jpg)
验证方法2的定义方法
![image-20200620162124454](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005830.jpg)
## 基本操作
![image-20200620162512284](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005835.jpg)
### 总结反思
![image-20200620162709709](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005841.jpg)
<!-- 评论模块,不可删除 -->
# 静态链表
![image-20200620161229028](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005810.jpg)
## 什么是静态链表?
![image-20200620161554872](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005814.jpg)
## 定义一个静态链表
方法1:
![image-20200620161706934](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005821.jpg)
方法2:
![image-20200620161934969](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005825.jpg)
验证方法2的定义方法
![image-20200620162124454](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005830.jpg)
## 基本操作
![image-20200620162512284](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005835.jpg)
### 总结反思
![image-20200620162709709](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005841.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,44 +1,44 @@
# 线性表章节复习反思
![image-20200620162832052](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005922.jpg)
##逻辑结构对比
![image-20200620162853478](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005932.jpg)
## 存储结构对比
![image-20200620163051729](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005938.jpg)
## 基本操作对比
![image-20200620163155730](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005945.jpg)
### 初始化(创建)
![image-20200620163353375](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005949.jpg)
### 销毁
![image-20200620163638128](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005954.jpg)
### 增加/删除
![image-20200620163904064](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005959.jpg)
### 查找
![image-20200620164016463](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010004.jpg)
## 总结
![image-20200620164133349](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010008.jpg)
具体使用时,需要根据具体场景去选择
## 开放式答题的思路
![image-20200620164325277](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010012.jpg)
<!-- 评论模块,不可删除 -->
# 线性表章节复习反思
![image-20200620162832052](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005922.jpg)
##逻辑结构对比
![image-20200620162853478](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005932.jpg)
## 存储结构对比
![image-20200620163051729](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005938.jpg)
## 基本操作对比
![image-20200620163155730](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005945.jpg)
### 初始化(创建)
![image-20200620163353375](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005949.jpg)
### 销毁
![image-20200620163638128](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005954.jpg)
### 增加/删除
![image-20200620163904064](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810005959.jpg)
### 查找
![image-20200620164016463](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010004.jpg)
## 总结
![image-20200620164133349](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010008.jpg)
具体使用时,需要根据具体场景去选择
## 开放式答题的思路
![image-20200620164325277](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010012.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,15 +1,15 @@
# 线性表
## 本章目录
* [线性表](Doc_1_0_线性表.md)
* [顺序表](Doc_1_1_顺序表.md)
* [单链表](Doc_1_2_单链表.md)
* [双链表](Doc_1_3_双链表.md)
* [循环链表](Doc_1_4_循环链表.md)
* [静态链表](Doc_1_5_静态链表.md)
* [章节总结](Doc_1_6_章节总结.md)
<!-- 评论模块,不可删除 -->
<Vssue />
# 线性表
## 本章目录
* [线性表](Doc_1_0_线性表.md)
* [顺序表](Doc_1_1_顺序表.md)
* [单链表](Doc_1_2_单链表.md)
* [双链表](Doc_1_3_双链表.md)
* [循环链表](Doc_1_4_循环链表.md)
* [静态链表](Doc_1_5_静态链表.md)
* [章节总结](Doc_1_6_章节总结.md)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,26 +1,26 @@
# 栈
![image-20200624150012426](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010108.jpg)
## 栈的定义
![image-20200624150149844](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010114.jpg)
![image-20200624150313680](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010121.jpg)
![image-20200624150459308](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010127.jpg)
## 栈的基本操作
![image-20200624150704360](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010132.jpg)
### 出栈顺序
![image-20200624150927909](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010138.jpg)
## 总结
![image-20200624151001874](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010144.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />
# 栈
![image-20200624150012426](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010108.jpg)
## 栈的定义
![image-20200624150149844](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010114.jpg)
![image-20200624150313680](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010121.jpg)
![image-20200624150459308](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010127.jpg)
## 栈的基本操作
![image-20200624150704360](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010132.jpg)
### 出栈顺序
![image-20200624150927909](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010138.jpg)
## 总结
![image-20200624151001874](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010144.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,44 +1,44 @@
# 顺序栈
![image-20200624151201362](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010154.jpg)
## 顺序栈的定义
![image-20200624151329974](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010159.jpg)
## 基本操作
### 初始化操作
![image-20200624151413408](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010206.jpg)
### 进栈操作
![image-20200624151826628](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010237.jpg)
### 出栈操作
![image-20200624152110685](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010246.jpg)
### 读取栈顶元素
![image-20200624152208184](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010251.jpg)
## 另一种基本操作的实现方式:
![image-20200624152341443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010257.jpg)
![image-20200624152540477](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010304.jpg)
## 共享栈
![image-20200624152655905](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010311.jpg)
## 总结
![image-20200624152849214](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010316.jpg)
<!-- 评论模块,不可删除 -->
# 顺序栈
![image-20200624151201362](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010154.jpg)
## 顺序栈的定义
![image-20200624151329974](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010159.jpg)
## 基本操作
### 初始化操作
![image-20200624151413408](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010206.jpg)
### 进栈操作
![image-20200624151826628](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010237.jpg)
### 出栈操作
![image-20200624152110685](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010246.jpg)
### 读取栈顶元素
![image-20200624152208184](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010251.jpg)
## 另一种基本操作的实现方式:
![image-20200624152341443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010257.jpg)
![image-20200624152540477](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010304.jpg)
## 共享栈
![image-20200624152655905](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010311.jpg)
## 总结
![image-20200624152849214](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010316.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,21 +1,21 @@
# 链栈
![image-20200624153019827](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010327.jpg)
## 复习单链表
![image-20200624153122502](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010335.jpg)
![image-20200624153252888](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010340.jpg)
## 链栈的定义
![image-20200624153433781](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010345.jpg)
## 总结
![image-20200624153535956](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010350.jpg)
<!-- 评论模块,不可删除 -->
# 链栈
![image-20200624153019827](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010327.jpg)
## 复习单链表
![image-20200624153122502](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010335.jpg)
![image-20200624153252888](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010340.jpg)
## 链栈的定义
![image-20200624153433781](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010345.jpg)
## 总结
![image-20200624153535956](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010350.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,22 +1,22 @@
# 队列
![image-20200624153725089](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010403.jpg)
## 队列的定义
![image-20200624153857510](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010411.jpg)
![image-20200624154000138](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010429.jpg)
![image-20200624154121849](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010439.jpg)
## 队列的基本操作
![image-20200624154224115](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010446.jpg)
## 总结
![image-20200624154248823](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010452.jpg)
<!-- 评论模块,不可删除 -->
# 队列
![image-20200624153725089](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010403.jpg)
## 队列的定义
![image-20200624153857510](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010411.jpg)
![image-20200624154000138](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010429.jpg)
![image-20200624154121849](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010439.jpg)
## 队列的基本操作
![image-20200624154224115](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010446.jpg)
## 总结
![image-20200624154248823](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010452.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,55 +1,55 @@
# 顺序队列
![image-20200624154351327](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010502.jpg)
## 顺序队列的定义
![image-20200624154511213](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010511.jpg)
### 顺序队列的初始化
![image-20200624154606843](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010516.jpg)
### 入队操作
![image-20200624155112673](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010521.jpg)
![image-20200624155125271](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010527.jpg)
### 循环队列
![image-20200624155155915](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010537.jpg)
![image-20200624155216098](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010542.jpg)
### 出队
![image-20200624155258305](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010547.jpg)
### 判空/判满
方案一:牺牲一个存储空间
![image-20200624155343663](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010552.jpg)
方案二利用size变量记录队列长度
![image-20200624155414159](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010559.jpg)
方案三利用tag记录最后一次操作
![image-20200624155619066](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010605.jpg)
## 其它实现方式
![image-20200624155808035](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010616.jpg)
![image-20200624155827353](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010620.jpg)
![image-20200624155906039](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010625.jpg)
## 总结
![image-20200624160059508](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010648.jpg)
<!-- 评论模块,不可删除 -->
# 顺序队列
![image-20200624154351327](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010502.jpg)
## 顺序队列的定义
![image-20200624154511213](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010511.jpg)
### 顺序队列的初始化
![image-20200624154606843](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010516.jpg)
### 入队操作
![image-20200624155112673](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010521.jpg)
![image-20200624155125271](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010527.jpg)
### 循环队列
![image-20200624155155915](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010537.jpg)
![image-20200624155216098](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010542.jpg)
### 出队
![image-20200624155258305](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010547.jpg)
### 判空/判满
方案一:牺牲一个存储空间
![image-20200624155343663](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010552.jpg)
方案二利用size变量记录队列长度
![image-20200624155414159](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010559.jpg)
方案三利用tag记录最后一次操作
![image-20200624155619066](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010605.jpg)
## 其它实现方式
![image-20200624155808035](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010616.jpg)
![image-20200624155827353](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010620.jpg)
![image-20200624155906039](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010625.jpg)
## 总结
![image-20200624160059508](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010648.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,45 +1,45 @@
# 链队列
![image-20200624160150945](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010936.jpg)
## 链队列的定义
![image-20200624160334221](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010945.jpg)
## 链队列的基本操作
### 链队列的初始化
![image-20200624160434942](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010950.jpg)
### 入队
带头节点
![image-20200624160602691](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010955.jpg)
不带头节点
![image-20200624160710140](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011000.jpg)
### 出队
带有头节点
![image-20200624160905141](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011005.jpg)
不带头节点
![image-20200624160952329](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011010.jpg)
### 判满
![image-20200624161057518](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011016.jpg)
## 总结
![image-20200624161134905](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011021.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />
# 链队列
![image-20200624160150945](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010936.jpg)
## 链队列的定义
![image-20200624160334221](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010945.jpg)
## 链队列的基本操作
### 链队列的初始化
![image-20200624160434942](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010950.jpg)
### 入队
带头节点
![image-20200624160602691](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810010955.jpg)
不带头节点
![image-20200624160710140](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011000.jpg)
### 出队
带有头节点
![image-20200624160905141](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011005.jpg)
不带头节点
![image-20200624160952329](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011010.jpg)
### 判满
![image-20200624161057518](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011016.jpg)
## 总结
![image-20200624161134905](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011021.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,35 +1,35 @@
# 双端队列
![image-20200624161331529](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011030.jpg)
## 双端队列的定义
![image-20200624161416772](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011037.jpg)
## 考点:判断输出序列的合法性
### 对于栈的输出序列的合法性
![image-20200624161642449](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011052.jpg)
绿色为合法,红色为非法
### 对于输入受限的双端队列的输出序列的合法性
![image-20200624162025565](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011057.jpg)
绿色为合法,红色为非法,带下划线是在栈中不合法,但在输入受限的双端队列中合法的。
### 对于输出受限的双端队列
![image-20200624162509184](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011102.jpg)
绿色为合法,红色为非法,带下划线是在栈中不合法,但在输出受限的双端队列中合法
这种输出受限的双端队列,看序号较大的元素输出的位置,这意味着,在它输出之前,比它小的元素的相对位置是确定的,接下来就是考虑有什么插入的方法能实现这种相对位置关系!
## 总结
## ![image-20200624162951819](https://tva1.sinaimg.cn/large/007S8ZIlly1gg3gmivt6mj30xv09ddla.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />
# 双端队列
![image-20200624161331529](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011030.jpg)
## 双端队列的定义
![image-20200624161416772](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011037.jpg)
## 考点:判断输出序列的合法性
### 对于栈的输出序列的合法性
![image-20200624161642449](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011052.jpg)
绿色为合法,红色为非法
### 对于输入受限的双端队列的输出序列的合法性
![image-20200624162025565](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011057.jpg)
绿色为合法,红色为非法,带下划线是在栈中不合法,但在输入受限的双端队列中合法的。
### 对于输出受限的双端队列
![image-20200624162509184](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011102.jpg)
绿色为合法,红色为非法,带下划线是在栈中不合法,但在输出受限的双端队列中合法
这种输出受限的双端队列,看序号较大的元素输出的位置,这意味着,在它输出之前,比它小的元素的相对位置是确定的,接下来就是考虑有什么插入的方法能实现这种相对位置关系!
## 总结
## ![image-20200624162951819](https://tva1.sinaimg.cn/large/007S8ZIlly1gg3gmivt6mj30xv09ddla.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,150 +1,150 @@
# 栈的应用
## 括号匹配问题
![image-20200624163218954](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011113.jpg)
### 实际过程
![image-20200624163415891](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011118.jpg)
####正好匹配
![image-20200624163523560](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011122.jpg)
####左右不匹配
![image-20200624163548297](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011127.jpg)
#### 右括号单身
![image-20200624163638571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011130.jpg)
#### 左括号单身
![image-20200624163721992](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011135.jpg)
#### 整个流程
![image-20200624163928215](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011139.jpg)
### 算法实现
![image-20200624164327998](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011144.jpg)
### 总结
![image-20200624164420239](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011149.jpg)
## 表达式求值
![image-20200624164751528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011154.jpg)
### 算数表达式是什么?
由三个部分组成(操作数,运算符,界限符)
![image-20200624165021200](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011203.jpg)
### 前/后缀表达式的诞生
![image-20200624165107095](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011211.jpg)
### 中/后/前缀表达式的区别
![image-20200624165500339](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011216.jpg)
#### 中转后的过程:
![image-20200624165755963](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011221.jpg)
**上图中,后缀表达式的算术符的先后次序对应中缀表达式的生效的先后次序**,但是这是一定的吗?
![image-20200624170300224](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011225.jpg)
左优先原则,可保证运算顺序唯一性,以确定机算算法输出结果的唯一性!!
![image-20200624190745666](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011717.jpg)
#### 机算算法实现
![image-20200624191112704](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011725.jpg)
![image-20200624191355054](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011729.jpg)
### 中转前的过程
![image-20200624191538706](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011737.jpg)
中转后和中转前的区别:
![image-20200624191614443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011742.jpg)
#### 中转前的机算过程:
![image-20200624191810971](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011746.jpg)
### 总结
![image-20200624191919379](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011751.jpg)
"左优先"/“右优先”原则和左/右操作数不是专业说法,仅供理解!
## 表达式求值——具体代码实现
![image-20200624192258712](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011755.jpg)
### 中转后机算
手算过程:
![image-20200624192506786](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011759.jpg)
机算过程:
![image-20200624193355396](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011804.jpg)
### 中缀表达式的计算
![image-20200624193844266](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011809.jpg)
![image-20200624194515343](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011813.jpg)
CPU只能执行单个的加减乘除运算上边这么搞的意义就是为了将高级程序语言编译成简单的机器码让CPU去执行
### 总结
![image-20200624194707110](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011820.jpg)
## 栈在递归中的应用
递归的过程就是函数调用的过程
![image-20200624195132597](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011839.jpg)
![image-20200624195412187](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011847.jpg)
### 适合用“递归”算法解决的问题
![image-20200624195452395](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011853.jpg)
求阶乘:
![image-20200624195709306](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011857.jpg)
**使用递归时,需要注意调用栈溢出!**
![image-20200624200031925](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011902.jpg)
**可以自定义栈将递归算法改造成非递归算法!**
求斐波那契数列
![image-20200624200155981](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011906.jpg)
### 总结
![image-20200624200214150](https://tva1.sinaimg.cn/large/007S8ZIlly1gg3mrhq6wnj30mq0adtbj.jpg)
<!-- 评论模块,不可删除 -->
# 栈的应用
## 括号匹配问题
![image-20200624163218954](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011113.jpg)
### 实际过程
![image-20200624163415891](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011118.jpg)
####正好匹配
![image-20200624163523560](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011122.jpg)
####左右不匹配
![image-20200624163548297](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011127.jpg)
#### 右括号单身
![image-20200624163638571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011130.jpg)
#### 左括号单身
![image-20200624163721992](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011135.jpg)
#### 整个流程
![image-20200624163928215](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011139.jpg)
### 算法实现
![image-20200624164327998](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011144.jpg)
### 总结
![image-20200624164420239](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011149.jpg)
## 表达式求值
![image-20200624164751528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011154.jpg)
### 算数表达式是什么?
由三个部分组成(操作数,运算符,界限符)
![image-20200624165021200](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011203.jpg)
### 前/后缀表达式的诞生
![image-20200624165107095](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011211.jpg)
### 中/后/前缀表达式的区别
![image-20200624165500339](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011216.jpg)
#### 中转后的过程:
![image-20200624165755963](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011221.jpg)
**上图中,后缀表达式的算术符的先后次序对应中缀表达式的生效的先后次序**,但是这是一定的吗?
![image-20200624170300224](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011225.jpg)
左优先原则,可保证运算顺序唯一性,以确定机算算法输出结果的唯一性!!
![image-20200624190745666](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011717.jpg)
#### 机算算法实现
![image-20200624191112704](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011725.jpg)
![image-20200624191355054](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011729.jpg)
### 中转前的过程
![image-20200624191538706](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011737.jpg)
中转后和中转前的区别:
![image-20200624191614443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011742.jpg)
#### 中转前的机算过程:
![image-20200624191810971](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011746.jpg)
### 总结
![image-20200624191919379](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011751.jpg)
"左优先"/“右优先”原则和左/右操作数不是专业说法,仅供理解!
## 表达式求值——具体代码实现
![image-20200624192258712](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011755.jpg)
### 中转后机算
手算过程:
![image-20200624192506786](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011759.jpg)
机算过程:
![image-20200624193355396](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011804.jpg)
### 中缀表达式的计算
![image-20200624193844266](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011809.jpg)
![image-20200624194515343](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011813.jpg)
CPU只能执行单个的加减乘除运算上边这么搞的意义就是为了将高级程序语言编译成简单的机器码让CPU去执行
### 总结
![image-20200624194707110](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011820.jpg)
## 栈在递归中的应用
递归的过程就是函数调用的过程
![image-20200624195132597](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011839.jpg)
![image-20200624195412187](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011847.jpg)
### 适合用“递归”算法解决的问题
![image-20200624195452395](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011853.jpg)
求阶乘:
![image-20200624195709306](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011857.jpg)
**使用递归时,需要注意调用栈溢出!**
![image-20200624200031925](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011902.jpg)
**可以自定义栈将递归算法改造成非递归算法!**
求斐波那契数列
![image-20200624200155981](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011906.jpg)
### 总结
![image-20200624200214150](https://tva1.sinaimg.cn/large/007S8ZIlly1gg3mrhq6wnj30mq0adtbj.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,27 +1,27 @@
# 队列的应用
## 树的层次遍历
提示:不知道树这种数据结构的同学,可以考虑先跳过本文内容,等了解树之后,再来康康~
![image-20200624200711109](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011917.jpg)
详细实现内容在树的章节实现!
## 图的广度优先遍历
遍历是指找出所有元素节点
![image-20200624200822823](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011940.jpg)
## 队列在操作系统中的应用
**CPU资源分配问题**
![image-20200624200936738](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011944.jpg)
**打印数据缓冲区**
![image-20200624201203709](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011949.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />
# 队列的应用
## 树的层次遍历
提示:不知道树这种数据结构的同学,可以考虑先跳过本文内容,等了解树之后,再来康康~
![image-20200624200711109](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011917.jpg)
详细实现内容在树的章节实现!
## 图的广度优先遍历
遍历是指找出所有元素节点
![image-20200624200822823](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011940.jpg)
## 队列在操作系统中的应用
**CPU资源分配问题**
![image-20200624200936738](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011944.jpg)
**打印数据缓冲区**
![image-20200624201203709](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810011949.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,16 +1,16 @@
# 栈和队列
## 本章目录
* [](Doc_2_0_栈.md)
* [顺序栈](Doc_2_1_顺序栈.md)
* [链栈](Doc_2_2_链栈.md)
* [队列](Doc_2_3_队列.md)
* [顺序队列](Doc_2_4_顺序队列.md)
* [链式队列](Doc_2_5_链式队列.md)
* [双端队列](Doc_2_6_双端队列.md)
* [栈的应用](Doc_2_7_栈的应用.md)
* [队列的应用](Doc_2_8_队列的应用.md)
<!-- 评论模块,不可删除 -->
# 栈和队列
## 本章目录
* [](Doc_2_0_栈.md)
* [顺序栈](Doc_2_1_顺序栈.md)
* [链栈](Doc_2_2_链栈.md)
* [队列](Doc_2_3_队列.md)
* [顺序队列](Doc_2_4_顺序队列.md)
* [链式队列](Doc_2_5_链式队列.md)
* [双端队列](Doc_2_6_双端队列.md)
* [栈的应用](Doc_2_7_栈的应用.md)
* [队列的应用](Doc_2_8_队列的应用.md)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,26 +1,26 @@
# 串
![image-20200803212400697](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012004.jpg)
## 定义
![image-20200803212845879](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012009.jpg)
![image-20200803213034578](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012302.jpg)
## 基本操作
![image-20200803213802729](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012312.jpg)
### 比较操作
![image-20200803214249875](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012325.jpg)
### 字符集编码
![image-20200803214352811](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012329.jpg)
![image-20200803215953538](https://tva1.sinaimg.cn/large/007S8ZIlly1ghdyy8zrrwj31sq0u0qv5.jpg)
<!-- 评论模块,不可删除 -->
# 串
![image-20200803212400697](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012004.jpg)
## 定义
![image-20200803212845879](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012009.jpg)
![image-20200803213034578](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012302.jpg)
## 基本操作
![image-20200803213802729](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012312.jpg)
### 比较操作
![image-20200803214249875](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012325.jpg)
### 字符集编码
![image-20200803214352811](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012329.jpg)
![image-20200803215953538](https://tva1.sinaimg.cn/large/007S8ZIlly1ghdyy8zrrwj31sq0u0qv5.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,30 +1,30 @@
# 存储结构
![image-20200803214458664](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012341.jpg)
## 顺序存储与堆分配存储
![image-20200803214622356](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012400.jpg)
![image-20200803215036742](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012407.jpg)
方案二的字符串长度不可以超过255
## 块链存储
![image-20200803215219679](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012416.jpg)
## 基本操作的实现
![image-20200803215331395](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012427.jpg)
![image-20200803215415087](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012432.jpg)
![image-20200803215555916](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012444.jpg)
![image-20200803215846955](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012449.jpg)
![image-20200803215910897](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012455.jpg)
<!-- 评论模块,不可删除 -->
# 存储结构
![image-20200803214458664](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012341.jpg)
## 顺序存储与堆分配存储
![image-20200803214622356](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012400.jpg)
![image-20200803215036742](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012407.jpg)
方案二的字符串长度不可以超过255
## 块链存储
![image-20200803215219679](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012416.jpg)
## 基本操作的实现
![image-20200803215331395](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012427.jpg)
![image-20200803215415087](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012432.jpg)
![image-20200803215555916](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012444.jpg)
![image-20200803215846955](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012449.jpg)
![image-20200803215910897](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012455.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,27 +1,27 @@
# 模式匹配
![image-20200803220247955](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012517.jpg)
## 朴素模式匹配算法
![image-20200803221038452](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012522.jpg)
![image-20200803224601338](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012527.jpg)
![image-20200803231428235](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012623.jpg)
### 性能分析
最好时间复杂度
![image-20200803231735244](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012632.jpg)
最坏时间复杂度
![image-20200803232029485](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012636.jpg)
思想总结
![image-20200803232154853](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012908.jpg)
<!-- 评论模块,不可删除 -->
# 模式匹配
![image-20200803220247955](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012517.jpg)
## 朴素模式匹配算法
![image-20200803221038452](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012522.jpg)
![image-20200803224601338](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012527.jpg)
![image-20200803231428235](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012623.jpg)
### 性能分析
最好时间复杂度
![image-20200803231735244](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012632.jpg)
最坏时间复杂度
![image-20200803232029485](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012636.jpg)
思想总结
![image-20200803232154853](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012908.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,57 +1,57 @@
# KMP 算法
简单模式匹配的缺点
![image-20200804224435660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012916.jpg)
改进思想
![image-20200804224530991](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012921.jpg)
情况一
![image-20200804224626232](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012925.jpg)
![image-20200804224704994](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012936.jpg)
![image-20200804224731389](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012941.jpg)
情况二
![image-20200804224917143](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012945.jpg)
情况三:
![iShot2020-08-04下午10.51.24](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012950.jpg)
4这里有可能多比较一次因为4和6已经不等但是1和6相同这里仍会期待1和6相同再进行一次比较所以这里它并不是最优的算法但是相比于朴素模式匹配它还是少对比了两次
![image-20200804225536657](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012954.jpg)
同理j指向3时少对比1次
总结:
![image-20200804230434402](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012959.jpg)
## 具体代码实现
![image-20200804230554660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013008.jpg)
### 求next数组
![image-20200805131252851](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013017.jpg)
![image-20200805131431528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013022.jpg)
![image-20200805131611443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013031.jpg)
### 代码实现求next数组
![image-20200805131821691](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013038.jpg)
## 回顾总结
![image](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013045.jpg)
<!-- 评论模块,不可删除 -->
# KMP 算法
简单模式匹配的缺点
![image-20200804224435660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012916.jpg)
改进思想
![image-20200804224530991](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012921.jpg)
情况一
![image-20200804224626232](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012925.jpg)
![image-20200804224704994](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012936.jpg)
![image-20200804224731389](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012941.jpg)
情况二
![image-20200804224917143](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012945.jpg)
情况三:
![iShot2020-08-04下午10.51.24](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012950.jpg)
4这里有可能多比较一次因为4和6已经不等但是1和6相同这里仍会期待1和6相同再进行一次比较所以这里它并不是最优的算法但是相比于朴素模式匹配它还是少对比了两次
![image-20200804225536657](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012954.jpg)
同理j指向3时少对比1次
总结:
![image-20200804230434402](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810012959.jpg)
## 具体代码实现
![image-20200804230554660](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013008.jpg)
### 求next数组
![image-20200805131252851](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013017.jpg)
![image-20200805131431528](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013022.jpg)
![image-20200805131611443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013031.jpg)
### 代码实现求next数组
![image-20200805131821691](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013038.jpg)
## 回顾总结
![image](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013045.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,15 +1,15 @@
# KMP 算法的优化
例1:KMP算法存在的问题
![image-20200805132559485](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013053.jpg)
例子2
![image-20200805132959285](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013100.png)
总结:
![image-20200805133126340](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013109.jpg)
<!-- 评论模块,不可删除 -->
# KMP 算法的优化
例1:KMP算法存在的问题
![image-20200805132559485](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013053.jpg)
例子2
![image-20200805132959285](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013100.png)
总结:
![image-20200805133126340](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013109.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,16 +1,16 @@
# 串
## 本章目录
+ [](Doc_3_0_串.md)
+ [串的存储结构](Doc_3_1_串的存储结构.md)
+ [模式匹配](Doc_3_2_模式匹配.md)
+ [KMP算法](Doc_3_3_KMP算法.md)
+ [KMP算法的优化](Doc_3_4_KMP算法的优化.md)
<!-- 评论模块,不可删除 -->
# 串
## 本章目录
+ [](Doc_3_0_串.md)
+ [串的存储结构](Doc_3_1_串的存储结构.md)
+ [模式匹配](Doc_3_2_模式匹配.md)
+ [KMP算法](Doc_3_3_KMP算法.md)
+ [KMP算法的优化](Doc_3_4_KMP算法的优化.md)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,31 +1,31 @@
# 树
![image-20200805134038848](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvre4k98j31rb0u0x1u.jpg)
## 基本概念
![image-20200805134446365](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvvovsbqj31mr0u0npf.jpg)
![image-20200805134643335](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvxq9vmyj31n60u0kjm.jpg)
树的应用
![image-20200805134753956](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvyy9mbej31qu0u0b29.jpg)
## 结点之间的关系描述
![image-20200805135051427](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw2189u0j31k80u01ky.jpg)
结点、树的属性描述
![image-20200805135229378](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw3pywvsj31t40u0e81.jpg)
![image-20200805135343002](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw4zzwvcj31oo0u0x6p.jpg)
![image-20200805135455518](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw69ehx0j31hm0u0b2a.jpg)
总结:
![image-20200805135536601](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw6z51b3j31f30u0b29.jpg)
<!-- 评论模块,不可删除 -->
# 树
![image-20200805134038848](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvre4k98j31rb0u0x1u.jpg)
## 基本概念
![image-20200805134446365](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvvovsbqj31mr0u0npf.jpg)
![image-20200805134643335](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvxq9vmyj31n60u0kjm.jpg)
树的应用
![image-20200805134753956](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfvyy9mbej31qu0u0b29.jpg)
## 结点之间的关系描述
![image-20200805135051427](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw2189u0j31k80u01ky.jpg)
结点、树的属性描述
![image-20200805135229378](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw3pywvsj31t40u0e81.jpg)
![image-20200805135343002](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw4zzwvcj31oo0u0x6p.jpg)
![image-20200805135455518](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw69ehx0j31hm0u0b2a.jpg)
总结:
![image-20200805135536601](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/007S8ZIlly1ghfw6z51b3j31f30u0b29.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 数的存储结构
<!-- 评论模块,不可删除 -->
# 数的存储结构
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 数和森林的遍历
<!-- 评论模块,不可删除 -->
# 数和森林的遍历
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 二叉排序树
<!-- 评论模块,不可删除 -->
<Vssue />
# 二叉排序树
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,5 +1,5 @@
# 平衡二叉树
<!-- 评论模块,不可删除 -->
<Vssue />
# 平衡二叉树
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 哈夫曼树
<!-- 评论模块,不可删除 -->
# 哈夫曼树
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,17 +1,17 @@
# 树的性质
![image-20200805182003121](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013150.jpg)
![image-20200805182120443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013201.jpg)
![image-20200805182206568](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013212.jpg)
![image-20200805182311435](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013216.jpg)
![image-20200805182352714](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013221.jpg)
![image-20200805182505953](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013225.jpg)
![image-20200805182524995](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013230.jpg)
<!-- 评论模块,不可删除 -->
# 树的性质
![image-20200805182003121](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013150.jpg)
![image-20200805182120443](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013201.jpg)
![image-20200805182206568](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013212.jpg)
![image-20200805182311435](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013216.jpg)
![image-20200805182352714](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013221.jpg)
![image-20200805182505953](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013225.jpg)
![image-20200805182524995](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013230.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,21 +1,21 @@
# 二叉树
![image-20200805182546741](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013238.jpg)
基本定义:
![image-20200805182702622](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013246.jpg)
常见术语:
![image-20200805183043813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013259.jpg)
![image-20200805183250777](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013306.jpg)
![image-20200805183426726](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013313.jpg)
总结:
![image-20200805183503356](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg49qdqdxj320l0u07wh.jpg)
<!-- 评论模块,不可删除 -->
# 二叉树
![image-20200805182546741](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013238.jpg)
基本定义:
![image-20200805182702622](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013246.jpg)
常见术语:
![image-20200805183043813](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013259.jpg)
![image-20200805183250777](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013306.jpg)
![image-20200805183426726](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013313.jpg)
总结:
![image-20200805183503356](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg49qdqdxj320l0u07wh.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,19 +1,19 @@
# 二叉树的性质
![image-20200805183656513](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013326.jpg)
![image-20200805183736605](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013333.jpg)
![image-20200805183803880](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013338.jpg)
满二叉树有最多结点
## 完全二叉树的性质
![image-20200805184001845](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013350.jpg)
![image-20200805184122555](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013400.jpg)
![image-20200805184243281](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg4hpehe1j31ow0u0qv5.jpg)
<!-- 评论模块,不可删除 -->
# 二叉树的性质
![image-20200805183656513](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013326.jpg)
![image-20200805183736605](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013333.jpg)
![image-20200805183803880](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013338.jpg)
满二叉树有最多结点
## 完全二叉树的性质
![image-20200805184001845](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013350.jpg)
![image-20200805184122555](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013400.jpg)
![image-20200805184243281](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg4hpehe1j31ow0u0qv5.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,33 +1,33 @@
# 二叉树的存储结构
## 顺序存储
![image-20200805184430918](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013411.jpg)
![image-20200805184628458](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013416.jpg)
问题:
![image-20200805184713701](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013420.jpg)
![image-20200805184820083](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013424.jpg)
判断左右孩子是否存在,只能使用 IsEmpty 变量
![image-20200805185018264](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013429.jpg)
## 链式存储
![image-20200805185151701](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013434.jpg)
![image-20200805185245744](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013447.jpg)
![image-20200805185454579](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013455.jpg)
总结回顾:
![image-20200805185538146](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013555.jpg)
![image-20200805185553685](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013603.jpg)
<!-- 评论模块,不可删除 -->
# 二叉树的存储结构
## 顺序存储
![image-20200805184430918](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013411.jpg)
![image-20200805184628458](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013416.jpg)
问题:
![image-20200805184713701](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013420.jpg)
![image-20200805184820083](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013424.jpg)
判断左右孩子是否存在,只能使用 IsEmpty 变量
![image-20200805185018264](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013429.jpg)
## 链式存储
![image-20200805185151701](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013434.jpg)
![image-20200805185245744](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013447.jpg)
![image-20200805185454579](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013455.jpg)
总结回顾:
![image-20200805185538146](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013555.jpg)
![image-20200805185553685](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013603.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,41 +1,41 @@
# 二叉树的先中后序遍历
什么是遍历?
![image-20200805185719033](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013609.jpg)
![image-20200805185844474](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013613.jpg)
## 先序遍历
![image-20200805190054413](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013618.jpg)
## 中序遍历
![image-20200805190238269](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013622.jpg)
## 后序遍历
![image-20200805190345489](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013630.jpg)
例题:算数表达式的分析树
![image-20200805190634571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013648.jpg)
例2:求树的深度
![image-20200805190929342](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013652.jpg)
## 总结
![image-20200805190951986](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013657.jpg)
## 二叉树的层序遍历
![image-20200805191125413](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013702.jpg)
### 代码实现
![image-20200805191445914](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg5f1pfwcj31ju0u04qq.jpg)
<!-- 评论模块,不可删除 -->
# 二叉树的先中后序遍历
什么是遍历?
![image-20200805185719033](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013609.jpg)
![image-20200805185844474](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013613.jpg)
## 先序遍历
![image-20200805190054413](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013618.jpg)
## 中序遍历
![image-20200805190238269](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013622.jpg)
## 后序遍历
![image-20200805190345489](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013630.jpg)
例题:算数表达式的分析树
![image-20200805190634571](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013648.jpg)
例2:求树的深度
![image-20200805190929342](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013652.jpg)
## 总结
![image-20200805190951986](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013657.jpg)
## 二叉树的层序遍历
![image-20200805191125413](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013702.jpg)
### 代码实现
![image-20200805191445914](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg5f1pfwcj31ju0u04qq.jpg)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,35 +1,35 @@
# 由先中后序遍历序列构造二叉树
不同二叉树的中序遍历
![image-20200805191801166](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013711.jpg)
![image-20200805191851595](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013825.jpg)
![image-20200805191913602](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013835.jpg)
![image-20200805191946368](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013854.jpg)
![image-20200805192027276](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013904.jpg)
## 前+中
![image-20200805192120760](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013912.jpg)
### 后+中
![image-20200805202834877](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013921.jpg)
### 层+中
![image-20200805202945647](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013929.jpg)
### 总结回顾
![image-20200805203145525](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg7n5qtacj31q00u0u0x.jpg)
若前序、后序、层序序列两两组合,是否能确定唯一的一颗二叉树?
答案是:不能,必须有中序序列划分左右子树🌲
<!-- 评论模块,不可删除 -->
<Vssue />
# 由先中后序遍历序列构造二叉树
不同二叉树的中序遍历
![image-20200805191801166](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013711.jpg)
![image-20200805191851595](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013825.jpg)
![image-20200805191913602](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013835.jpg)
![image-20200805191946368](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013854.jpg)
![image-20200805192027276](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013904.jpg)
## 前+中
![image-20200805192120760](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013912.jpg)
### 后+中
![image-20200805202834877](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013921.jpg)
### 层+中
![image-20200805202945647](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810013929.jpg)
### 总结回顾
![image-20200805203145525](https://tva1.sinaimg.cn/large/007S8ZIlly1ghg7n5qtacj31q00u0u0x.jpg)
若前序、后序、层序序列两两组合,是否能确定唯一的一颗二叉树?
答案是:不能,必须有中序序列划分左右子树🌲
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,45 +1,45 @@
# 线索二叉树
![image-20200810110140084](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810110140.png)
## 二叉树的中序遍历序列存在的问题
![image-20200810133755960](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810133756.png)
**不能直接从指定结点开始中序遍历**
## 中序线索二叉树
![image-20200810134119656](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134119.png)
### 线索二叉树的存储结构
![image-20200810134318361](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134318.png)
![image-20200810134401938](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134401.png)
## 先序线索二叉树
![image-20200810134451790](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134451.png)
### 先序线索二叉树的存储结构
![image-20200810134658200](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134658.png)
## 后序线索二叉树
![image-20200810134712565](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134712.png)
### 后序线索二叉树的存储结构
![image-20200810134733209](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134733.png)
## 对比
![image-20200810134806808](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134806.png)
## 总结回顾
![image-20200810134838622](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134838.png)
<!-- 评论模块,不可删除 -->
# 线索二叉树
![image-20200810110140084](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810110140.png)
## 二叉树的中序遍历序列存在的问题
![image-20200810133755960](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810133756.png)
**不能直接从指定结点开始中序遍历**
## 中序线索二叉树
![image-20200810134119656](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134119.png)
### 线索二叉树的存储结构
![image-20200810134318361](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134318.png)
![image-20200810134401938](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134401.png)
## 先序线索二叉树
![image-20200810134451790](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134451.png)
### 先序线索二叉树的存储结构
![image-20200810134658200](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134658.png)
## 后序线索二叉树
![image-20200810134712565](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134712.png)
### 后序线索二叉树的存储结构
![image-20200810134733209](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134733.png)
## 对比
![image-20200810134806808](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134806.png)
## 总结回顾
![image-20200810134838622](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810134838.png)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,15 +1,15 @@
# 二叉树的线索化
![image-20200810105331721](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810105331.png)
用土办法找到中序前驱
![image-20200810134958011](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810135203.png)
## 中序线索化
![image-20200810135151257](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810135151.png)
<!-- 评论模块,不可删除 -->
# 二叉树的线索化
![image-20200810105331721](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810105331.png)
用土办法找到中序前驱
![image-20200810134958011](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810135203.png)
## 中序线索化
![image-20200810135151257](https://cdn.jsdelivr.net/gh/KimYangOfCat/MyPicStorage/2021-CSPostgraduate-408/20200810135151.png)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 找线索二叉树结点的前驱和后继
<!-- 评论模块,不可删除 -->
<Vssue />
# 找线索二叉树结点的前驱和后继
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,17 +1,17 @@
# 树和二叉树
## 本章目录
* [](Doc_4_0_树.md)
* [树的性质](Doc_4_1_树的性质.md)
* [二叉树](Doc_4_2_二叉树.md)
* [二叉树的性质](Doc_4_3_二叉树的性质.md)
* [二叉树的存储结构](Doc_4_4_二叉树的存储结构.md)
* [二叉树的遍历](Doc_4_5_二叉树的遍历.md)
* [二叉树的构造](Doc_4_6_二叉树的构造.md)
* [线索二叉树](Doc_4_7_线索二叉树.md)
* [二叉树的线索化](Doc_4_8_二叉树的线索化.md)
<!-- 评论模块,不可删除 -->
# 树和二叉树
## 本章目录
* [](Doc_4_0_树.md)
* [树的性质](Doc_4_1_树的性质.md)
* [二叉树](Doc_4_2_二叉树.md)
* [二叉树的性质](Doc_4_3_二叉树的性质.md)
* [二叉树的存储结构](Doc_4_4_二叉树的存储结构.md)
* [二叉树的遍历](Doc_4_5_二叉树的遍历.md)
* [二叉树的构造](Doc_4_6_二叉树的构造.md)
* [线索二叉树](Doc_4_7_线索二叉树.md)
* [二叉树的线索化](Doc_4_8_二叉树的线索化.md)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,5 +1,5 @@
# 图
<!-- 评论模块,不可删除 -->
<Vssue />
# 图
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 图的基本操作
<!-- 评论模块,不可删除 -->
<Vssue />
# 图的基本操作
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,3 +1,3 @@
# 图的基本操作
<!-- 评论模块,不可删除 -->
# 图的基本操作
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,3 +1,3 @@
# 图的遍历
<!-- 评论模块,不可删除 -->
# 图的遍历
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,7 +1,7 @@
# 图
##本章目录
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
# 图
##本章目录
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,3 +1,3 @@
# 搜索
<!-- 评论模块,不可删除 -->
# 搜索
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,6 +1,6 @@
# 查找
## 本章目录
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
# 查找
## 本章目录
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,4 +1,4 @@
# 排序
## 本章目录
# 排序
## 本章目录
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧

View File

@@ -1,14 +1,14 @@
# 数据结构
## 章节目录
* [绪论](DS_0_Introduction)
* [线性表](DS_1_LinearList)
* [栈与队列](DS_2_StackAndQueue)
* [字符串](DS_3_String)
* [树与二叉树](DS_4_TreeAndBinaryTree)
* [](DS_5_Graph)
* [查找](DS_6_Search)
* [排序](DS_7_Sort)
<!-- 评论模块,不可删除 -->
<Vssue />
# 数据结构
## 章节目录
* [绪论](DS_0_Introduction)
* [线性表](DS_1_LinearList)
* [栈与队列](DS_2_StackAndQueue)
* [字符串](DS_3_String)
* [树与二叉树](DS_4_TreeAndBinaryTree)
* [](DS_5_Graph)
* [查找](DS_6_Search)
* [排序](DS_7_Sort)
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,11 +1,11 @@
# 操作系统
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<Vssue />
# 操作系统
内容建设中~👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧👨🏻‍🔧
<Vssue />

View File

@@ -1,183 +1,183 @@
---
home: true
heroImage: /icons@2x.png
heroText: 2021 计算机考研 408 专业课
tagline: 2021-CSPostgraduate-408
actionText: 开始阅读 →
actionLink: /DataStructure/
footer: GPL Licensed | Copyright © 2020-present Kim Yang
---
<div align="center">
![DataStructure](https://img.shields.io/static/v1?label=&message=DataStructure&color=brightgreen)
![ComputerOrganization](https://img.shields.io/static/v1?label=&message=ComputerOrganization&color=blueviolet)
![ComputerNetWork](https://img.shields.io/static/v1?label=&message=ComputerNetWork&color=blue)
![OperatingSystem](https://img.shields.io/static/v1?label=&message=OperatingSystem&color=important)
</div>
本仓库主要记录了 CS 考研 408 专业课的一些真题资料、笔记、思维导图以及算法源码。
关于项目的介绍博文:[Blog](https://kimyang.cn/posts/2020-08-31-408.html) 、[CSDN](https://blog.csdn.net/weixin_43316691/article/details/108634030) 、[知乎](https://zhuanlan.zhihu.com/p/249377361) 。
## 21年考408的院校(信息来源于网络,更准确的信息请于各高校官网查询)
### 985高校
| 浙江大学 | 上海交通大学 | 同济大学 | 中国科学技术大学 |武汉大学【新增】 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |:----------------------------------------------------------: |
| ![浙江大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-ZJU.png) | ![上海交通大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-SHJTU.webp) | ![同济大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-TJU.webp) | ![中国科学技术大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-CSTU.png) | ![武汉大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-WHU.jpg) |
| 南开大学【新增】 | 华东师范大学<br />【新增】 | 中山大学 | 复旦大学【新增】 | 华南理工大学 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![南开大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-NKU.png) | ![华东师范大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-ECNU.png) | ![中山大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-SYU.jpg) | ![复旦大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-FDU.jpg) | ![华南理工大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-TSCU.jpg) |
### 211高校
| 海南大学 | 广西大学 | 宁夏大学 | 贵州大学<br />【新增】 | 青海大学 | 上海大学 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![海南大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HNU.jpg) | ![广西大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-GXU.jpg) | ![宁夏大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-NXU.jpg) | ![贵州大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-GZU.png) | ![青海大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-QHU.jpg) | ![上海大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-SHU.png) |
| 郑州大学<br />【新增】 | 云南大学<br />【新增】 | 河北工业大学<br />【新增】 | 华中农业大学<br />【新增】 | 西南财经大学 | 武汉理工大学<br />【新增】 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![郑州大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-ZZU.jpg) | ![云南大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-YNU.jpg) | ![河北工业大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HBTU.webp) | ![华中农业大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HZAU.jpg) | ![西南财经大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-FESU.jpg) | ![武汉理工大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-WHTU.jpg) |
## 408 科目
### [数据结构](DataStructure)
`DataStructure`文件夹下为 2021 [王道考研](http://cskaoyan.com/forum.php) 课程数据结构源代码!点击此下载 [ 21王道数据结构 PDF](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8D)
#### [源码](DataStructure/Src)
408 所有科目基本都偏向理论,只有数据结构一门稍有实践性,故此动手写下所有数据结构源码,以章节分类整理,以供大家参考~
##### 源码目录
* [绪论](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_0_Introduction)
* [线性表](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_1_LinearList)
* [栈与队列](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_2_StackAndQueue)
* [字符串](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_3_String)
* [树与二叉树](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_4_TreeAndBinaryTree)
* [](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_5_Graph)
* [查找](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_6_Search)
* [排序](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_7_Sort)
##### 编程语言
虽然都是.cpp文件但其中的语法既有C++的语法也有部分C的语法如果想要C++版本的源码可以参考我学习数据结构时写的一些数据结构的C++版本源码![传送门](https://github.com/KimYangOfCat/Data_Structure) 在此~
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/CSKaoYanVIPMindMap)
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**数据结构**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### [计算机组成原理](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/CSKaoYanVIPMindMap)
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**计算机组成原理**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
持续更新中~
### [操作系统](OperatingSystem)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/CSKaoYanVIPMindMap)
持续更新中~
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**操作系统**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### [计算机网络](ComputerNetwork)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/CSKaoYanVIPMindMap)
持续更新中~
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**计算机网络**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### 总结
408四门科目除了数据结构有一些代码的实操之外其余三门课程都是以理论为主所以学习它们的过程中还是建议以书本为主。
即便是数据结构在408的考试时数据结构也只是要求写出算法逻辑就好并不要求代码有可执行性所以对于一些喜欢敲代码的小伙伴
不能一味沉浸在用键盘敲代码的状态中。为了提前适应考试还是提前适应在纸上写代码的感觉。因为日常敲代码的过程中智能的IDE会给你提供很大的帮助
你只需要记住核心逻辑,但是在纸上写代码, 一些基本的语法还是🉐️ 熟悉,并能默写出来。
## 视频教程
+ [数据结构](https://www.bilibili.com/video/BV1b7411N798)
+ [计算机组成原理](https://www.bilibili.com/video/BV1BE411D7ii)
+ [操作系统](https://www.bilibili.com/video/BV1YE411D7nH)
+ [计算机网络](https://www.bilibili.com/video/BV19E411D78Q)
所有视频教程均来源于王道考研B站官方账号视频大部分为旧版内容但其实知识要点都是一样的值得学习。其中也包含了部分新版视频全部新版视频为收费内容虽然白嫖很香😜 ,但建议在经济条件允许的条件下,支持正版👍🏻
## 辅导书籍
### 王道系列
王道系列起源于[王道考研论坛](http://cskaoyan.com/),从它的论坛中,你能找到不少经验贴,非常值得关注!而王道系列辅导书籍,题量充足,知识点全面,可能更适合科班考研🈶️ 一定专业课基础的同学。
需要2021王道高清无水印PDF可至 [Release](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8D) 中下载。
### 天勤系列
天勤系列,相比于王道更注重基础知识,,但是题量并没有王道的多。也正是由于它更注重基础,所以也许它更适合跨考计算机的同学。
但是总的来说,辅导资料这一块儿还是适合自己的最好。所以对自己的知识储备有较为清晰的认识也许对你复习 408 更有帮助。
需要2021天勤高清无水印PDF可至 [Release](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8Dv1) 中下载。
## 教材
| 数据结构<br/> 严薇敏 | 计算机组成原理 <br/>唐朔飞 | 操作系统 <br/>汤子瀛 | 计算机网络 <br/>谢希仁 | 计算机网络<br/>自顶向下方法 |
| :----------------------------------------------------------: | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ![数据结构](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/DS0.jpg) | ![计算机组成原理](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CO0.jpg) | ![操作系统](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/OS0.png) | ![计算机网络](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CN1.png) | ![计算机网络·自顶向下方法](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CN0.jpg) |
## 真题
干净无水印的真题资源十分稀少可贵,在搜集的过程中,作者尽力找了一些干净无水印的资源,奈何个人力量有限,其中有些真题资源的质量仍不如人意。
目前本仓库只收录了[408 真题](408Exam),如果你有其他专业课或者更干净无水印的真题资源,欢迎提交 PR 或者在 issues 中提交相关资源的下载链接,感激不尽~
## 下载:
~~### 镜像仓库:~~
~~本仓库与[ gitee 上的 CSPostgraduate-408-2021 仓库]()互为镜像仓库,保持同步更新。~~
~~若因网络问题无法在其一下载,可切换至另一仓库进行尝试~~
>由于仓库收录的资源越来越多,仓库体积已经超过 1.5GB,超过了 Gitee 单仓库体积上限,故无法保持再同步更新,非常抱歉~
>
>后面,作者会不定期手动将本仓库打包至下文中的网盘中,大家可尝试下载~
### 其他下载途径:
若因网络原因无法下载 Release 与真题中的资源,可点击下方网盘链接下载相应的资源:
> 链接: [https://pan.baidu.com/s/1pa2kQHhsvp9XaJSCS1v-xA](https://pan.baidu.com/s/1pa2kQHhsvp9XaJSCS1v-xA) 提取码: hdqb
>
> 若网盘链接失效,可在 issues 中提醒作者更新嗷~
## 🔥 贡献
看到这里了,如果觉得对你有所帮助的话,不妨给本仓库点个 Star ⭐ ️吧!
如果你有新的内容 📜 想要贡献到本仓库或者发现了本仓库的一些错误 🐛 ,👏🏻 欢迎阅读[贡献文档](CONTRIBUTE.md)提交Pr
## 🍰 赞赏
如果你觉得本仓库帮助到了你,欢迎你点击上方的
[Sponsor](https://cdn.jsdelivr.net/gh/KimYangOfCat/KimYangOfCat/img/sponsor.png)
按钮来赞助作者,这将会给作者更多更新的动力,感谢~
## ❤️ 致谢
欢迎你前来占据前排 👏🏻 ~
## 许可证
---
home: true
heroImage: /icons@2x.png
heroText: 2021 计算机考研 408 专业课
tagline: 2021-CSPostgraduate-408
actionText: 开始阅读 →
actionLink: /DataStructure/
footer: GPL Licensed | Copyright © 2020-present Kim Yang
---
<div align="center">
![DataStructure](https://img.shields.io/static/v1?label=&message=DataStructure&color=brightgreen)
![ComputerOrganization](https://img.shields.io/static/v1?label=&message=ComputerOrganization&color=blueviolet)
![ComputerNetWork](https://img.shields.io/static/v1?label=&message=ComputerNetWork&color=blue)
![OperatingSystem](https://img.shields.io/static/v1?label=&message=OperatingSystem&color=important)
</div>
本仓库主要记录了 CS 考研 408 专业课的一些真题资料、笔记、思维导图以及算法源码。
关于项目的介绍博文:[Blog](https://kimyang.cn/posts/2020-08-31-408.html) 、[CSDN](https://blog.csdn.net/weixin_43316691/article/details/108634030) 、[知乎](https://zhuanlan.zhihu.com/p/249377361) 。
## 21年考408的院校(信息来源于网络,更准确的信息请于各高校官网查询)
### 985高校
| 浙江大学 | 上海交通大学 | 同济大学 | 中国科学技术大学 |武汉大学【新增】 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |:----------------------------------------------------------: |
| ![浙江大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-ZJU.png) | ![上海交通大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-SHJTU.webp) | ![同济大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-TJU.webp) | ![中国科学技术大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-CSTU.png) | ![武汉大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-WHU.jpg) |
| 南开大学【新增】 | 华东师范大学<br />【新增】 | 中山大学 | 复旦大学【新增】 | 华南理工大学 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![南开大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-NKU.png) | ![华东师范大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-ECNU.png) | ![中山大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-SYU.jpg) | ![复旦大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-FDU.jpg) | ![华南理工大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/985-TSCU.jpg) |
### 211高校
| 海南大学 | 广西大学 | 宁夏大学 | 贵州大学<br />【新增】 | 青海大学 | 上海大学 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![海南大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HNU.jpg) | ![广西大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-GXU.jpg) | ![宁夏大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-NXU.jpg) | ![贵州大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-GZU.png) | ![青海大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-QHU.jpg) | ![上海大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-SHU.png) |
| 郑州大学<br />【新增】 | 云南大学<br />【新增】 | 河北工业大学<br />【新增】 | 华中农业大学<br />【新增】 | 西南财经大学 | 武汉理工大学<br />【新增】 |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![郑州大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-ZZU.jpg) | ![云南大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-YNU.jpg) | ![河北工业大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HBTU.webp) | ![华中农业大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-HZAU.jpg) | ![西南财经大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-FESU.jpg) | ![武汉理工大学](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/school/211-WHTU.jpg) |
## 408 科目
### [数据结构](DataStructure)
`DataStructure`文件夹下为 2021 [王道考研](http://cskaoyan.com/forum.php) 课程数据结构源代码!点击此下载 [ 21王道数据结构 PDF](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8D)
#### [源码](DataStructure/Src)
408 所有科目基本都偏向理论,只有数据结构一门稍有实践性,故此动手写下所有数据结构源码,以章节分类整理,以供大家参考~
##### 源码目录
* [绪论](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_0_Introduction)
* [线性表](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_1_LinearList)
* [栈与队列](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_2_StackAndQueue)
* [字符串](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_3_String)
* [树与二叉树](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_4_TreeAndBinaryTree)
* [](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_5_Graph)
* [查找](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_6_Search)
* [排序](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/Src/DS_7_Sort)
##### 编程语言
虽然都是.cpp文件但其中的语法既有C++的语法也有部分C的语法如果想要C++版本的源码可以参考我学习数据结构时写的一些数据结构的C++版本源码![传送门](https://github.com/KimYangOfCat/Data_Structure) 在此~
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/MindMap/CSKaoYanVIPMindMap)
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/DataStructure/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**数据结构**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### [计算机组成原理](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/MindMap/CSKaoYanVIPMindMap)
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerOrganization/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**计算机组成原理**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
持续更新中~
### [操作系统](OperatingSystem)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/MindMap/CSKaoYanVIPMindMap)
持续更新中~
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/OperatingSystem/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**操作系统**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### [计算机网络](ComputerNetwork)
#### [思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/)
+ [王道书籍上的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/BookMindMap)
+ [视频教程PPT中的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/MindMap/CSKaoYanVIPMindMap)
持续更新中~
#### [PPT](https://github.com/KimYangOfCat/CSPostgraduate-408-2021/tree/master/ComputerNetwork/PPT)
`PPT` 文件夹下存放的是 2021 王道考研**计算机网络**视频课程的 PPT以供大家快速查找知识点或着复习视频内容
### 总结
408四门科目除了数据结构有一些代码的实操之外其余三门课程都是以理论为主所以学习它们的过程中还是建议以书本为主。
即便是数据结构在408的考试时数据结构也只是要求写出算法逻辑就好并不要求代码有可执行性所以对于一些喜欢敲代码的小伙伴
不能一味沉浸在用键盘敲代码的状态中。为了提前适应考试还是提前适应在纸上写代码的感觉。因为日常敲代码的过程中智能的IDE会给你提供很大的帮助
你只需要记住核心逻辑,但是在纸上写代码, 一些基本的语法还是🉐️ 熟悉,并能默写出来。
## 视频教程
+ [数据结构](https://www.bilibili.com/video/BV1b7411N798)
+ [计算机组成原理](https://www.bilibili.com/video/BV1BE411D7ii)
+ [操作系统](https://www.bilibili.com/video/BV1YE411D7nH)
+ [计算机网络](https://www.bilibili.com/video/BV19E411D78Q)
所有视频教程均来源于王道考研B站官方账号视频大部分为旧版内容但其实知识要点都是一样的值得学习。其中也包含了部分新版视频全部新版视频为收费内容虽然白嫖很香😜 ,但建议在经济条件允许的条件下,支持正版👍🏻
## 辅导书籍
### 王道系列
王道系列起源于[王道考研论坛](http://cskaoyan.com/),从它的论坛中,你能找到不少经验贴,非常值得关注!而王道系列辅导书籍,题量充足,知识点全面,可能更适合科班考研🈶️ 一定专业课基础的同学。
需要2021王道高清无水印PDF可至 [Release](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8D) 中下载。
### 天勤系列
天勤系列,相比于王道更注重基础知识,,但是题量并没有王道的多。也正是由于它更注重基础,所以也许它更适合跨考计算机的同学。
但是总的来说,辅导资料这一块儿还是适合自己的最好。所以对自己的知识储备有较为清晰的认识也许对你复习 408 更有帮助。
需要2021天勤高清无水印PDF可至 [Release](https://github.com/KimYangOfCat/2021-CSPostgraduate-408/releases/tag/%E8%BE%85%E5%AF%BC%E4%B9%A6%E7%B1%8Dv1) 中下载。
## 教材
| 数据结构<br/> 严薇敏 | 计算机组成原理 <br/>唐朔飞 | 操作系统 <br/>汤子瀛 | 计算机网络 <br/>谢希仁 | 计算机网络<br/>自顶向下方法 |
| :----------------------------------------------------------: | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ![数据结构](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/DS0.jpg) | ![计算机组成原理](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CO0.jpg) | ![操作系统](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/OS0.png) | ![计算机网络](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CN1.png) | ![计算机网络·自顶向下方法](https://cdn.jsdelivr.net/gh/KimYangOfCat/CSPostgraduate-408-2021/imgs/book/CN0.jpg) |
## 真题
干净无水印的真题资源十分稀少可贵,在搜集的过程中,作者尽力找了一些干净无水印的资源,奈何个人力量有限,其中有些真题资源的质量仍不如人意。
目前本仓库只收录了[408 真题](408Exam),如果你有其他专业课或者更干净无水印的真题资源,欢迎提交 PR 或者在 issues 中提交相关资源的下载链接,感激不尽~
## 下载:
~~### 镜像仓库:~~
~~本仓库与[ gitee 上的 CSPostgraduate-408-2021 仓库]()互为镜像仓库,保持同步更新。~~
~~若因网络问题无法在其一下载,可切换至另一仓库进行尝试~~
>由于仓库收录的资源越来越多,仓库体积已经超过 1.5GB,超过了 Gitee 单仓库体积上限,故无法保持再同步更新,非常抱歉~
>
>后面,作者会不定期手动将本仓库打包至下文中的网盘中,大家可尝试下载~
### 其他下载途径:
若因网络原因无法下载 Release 与真题中的资源,可点击下方网盘链接下载相应的资源:
> 链接: [https://pan.baidu.com/s/1pa2kQHhsvp9XaJSCS1v-xA](https://pan.baidu.com/s/1pa2kQHhsvp9XaJSCS1v-xA) 提取码: hdqb
>
> 若网盘链接失效,可在 issues 中提醒作者更新嗷~
## 🔥 贡献
看到这里了,如果觉得对你有所帮助的话,不妨给本仓库点个 Star ⭐ ️吧!
如果你有新的内容 📜 想要贡献到本仓库或者发现了本仓库的一些错误 🐛 ,👏🏻 欢迎阅读[贡献文档](CONTRIBUTE.md)提交Pr
## 🍰 赞赏
如果你觉得本仓库帮助到了你,欢迎你点击上方的
[Sponsor](https://cdn.jsdelivr.net/gh/KimYangOfCat/KimYangOfCat/img/sponsor.png)
按钮来赞助作者,这将会给作者更多更新的动力,感谢~
## ❤️ 致谢
欢迎你前来占据前排 👏🏻 ~
## 许可证
本仓库采用GPL许可证希望能为开源世界贡献一份力量

View File

@@ -1,11 +1,11 @@
# 留言板
如果你有任何关于项目的建议,疑问与催更等等,欢迎在下面的评论区留言哟~。
当然,如果你只想夸夸不经意间帮助到你的勤奋的我😉,也欢迎你在下面留言哟~
如果想要私聊一些问题的话,欢迎<a href="mailto:Kim.Yang.YJ@outlook.com">给我发送邮件</a>
<!-- 评论模块,不可删除 -->
# 留言板
如果你有任何关于项目的建议,疑问与催更等等,欢迎在下面的评论区留言哟~。
当然,如果你只想夸夸不经意间帮助到你的勤奋的我😉,也欢迎你在下面留言哟~
如果想要私聊一些问题的话,欢迎<a href="mailto:Kim.Yang.YJ@outlook.com">给我发送邮件</a>
<!-- 评论模块,不可删除 -->
<Vssue />

View File

@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.15)
project(2021_CSKaoYan_408)
set(CMAKE_CXX_STANDARD 14)
# 遍历项目根目录下所有的 .cpp 文件
# 排除掉leetcode 下的代码其不需要在Clion 中编译运行!
file (GLOB_RECURSE files ./*.cpp ./*/*.cpp ./*/*/*.cpp ./*/*/*/*.cpp)
foreach (file ${files})
string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file})
add_executable (${exe} ${file})
message (\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe})
cmake_minimum_required(VERSION 3.15)
project(2021_CSKaoYan_408)
set(CMAKE_CXX_STANDARD 14)
# 遍历项目根目录下所有的 .cpp 文件
# 排除掉leetcode 下的代码其不需要在Clion 中编译运行!
file (GLOB_RECURSE files ./*.cpp ./*/*.cpp ./*/*/*.cpp ./*/*/*/*.cpp)
foreach (file ${files})
string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file})
add_executable (${exe} ${file})
message (\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe})
endforeach ()

View File

@@ -1,42 +1,42 @@
# 贡献文档
## 分支说明
- `master` 默认分支,发布分支。
- `beta`:测试分支,用于合并所有 PR 请求时,测试冲突及内容检查。
- `dev`:作者个人开发分支。
- `gh-pages`web 端笔记发布分支,由 CI 根据 master 内容自动更新。
## 资源贡献
目前本仓库急需干净无水印的各高校的专业课真题资源,如果你手中恰好有相关资源,欢迎👏提交 PR 或者在 issues 中留下相关资源的下载链接🔗,感激不尽~
### PR 说明
由于目前本仓库只收录了 408 的历年真题,且全部存放在 `408Exam` 文件夹下;
+ 如果你想要贡献的真题是 408 的,请在存放在 `408Exam` 文件夹下。
+ 如果你想要贡献的是其学校专业课的真题资源,请在 `OtherExam` 文件夹下,以`专业课代码`新建文件夹,在该文件夹下再以 `学校名称`新建文件夹,然后在该文件夹下再以`专业课名称_学校名称_年份`命名相关资源文件。
## 工具说明
### 思维导图
所有以 `.xmind` 结尾的文件均是作者使用 `XMind` 软件制作出来的思维导图源文件,故推荐使用正版软件打开相关思维导图文件。
### IDE
书写并运行源码使用的 IDE 是 `CLion`,其主要的配置文件是仓库根目录下的 `CMakeLists.txt` 文件。
## Web 笔记
本仓库的 Web 端笔记预览主要使用 `vuepress` 生成使用的是默认主题仅对颜色、Logo 等进行了个性化自定义。
Web 笔记主要存放在 `408Notes` 文件夹下,主要的包管理文件为 `/package.json`,主题相关的配置文件主要位于 `/408Notes/.vuepress` 文件夹中。
### Web 本地预览
1. 确保本地环境中有 `Node.js``Vue`,若无,可参考官网文档进行安装。
2. 进入项目根目录,运行 `npm install``yarn isntall`,进行项目依赖初始化操作。前者使用 `npm` 进行包管理,后者使用 `yarn` 进行包管理。
3. 启动开发环境,运行 `npm run dev``yarn dev`启动完成之后便可在游览器中访问http://localhost:4080/ 查看效果。
## 致谢
欢迎你前来占据前排👏🏻~
# 贡献文档
## 分支说明
- `master` 默认分支,发布分支。
- `beta`:测试分支,用于合并所有 PR 请求时,测试冲突及内容检查。
- `dev`:作者个人开发分支。
- `gh-pages`web 端笔记发布分支,由 CI 根据 master 内容自动更新。
## 资源贡献
目前本仓库急需干净无水印的各高校的专业课真题资源,如果你手中恰好有相关资源,欢迎👏提交 PR 或者在 issues 中留下相关资源的下载链接🔗,感激不尽~
### PR 说明
由于目前本仓库只收录了 408 的历年真题,且全部存放在 `408Exam` 文件夹下;
+ 如果你想要贡献的真题是 408 的,请在存放在 `408Exam` 文件夹下。
+ 如果你想要贡献的是其学校专业课的真题资源,请在 `OtherExam` 文件夹下,以`专业课代码`新建文件夹,在该文件夹下再以 `学校名称`新建文件夹,然后在该文件夹下再以`专业课名称_学校名称_年份`命名相关资源文件。
## 工具说明
### 思维导图
所有以 `.xmind` 结尾的文件均是作者使用 `XMind` 软件制作出来的思维导图源文件,故推荐使用正版软件打开相关思维导图文件。
### IDE
书写并运行源码使用的 IDE 是 `CLion`,其主要的配置文件是仓库根目录下的 `CMakeLists.txt` 文件。
## Web 笔记
本仓库的 Web 端笔记预览主要使用 `vuepress` 生成使用的是默认主题仅对颜色、Logo 等进行了个性化自定义。
Web 笔记主要存放在 `408Notes` 文件夹下,主要的包管理文件为 `/package.json`,主题相关的配置文件主要位于 `/408Notes/.vuepress` 文件夹中。
### Web 本地预览
1. 确保本地环境中有 `Node.js``Vue`,若无,可参考官网文档进行安装。
2. 进入项目根目录,运行 `npm install``yarn isntall`,进行项目依赖初始化操作。前者使用 `npm` 进行包管理,后者使用 `yarn` 进行包管理。
3. 启动开发环境,运行 `npm run dev``yarn dev`启动完成之后便可在游览器中访问http://localhost:4080/ 查看效果。
## 致谢
欢迎你前来占据前排👏🏻~

View File

@@ -1,7 +1,7 @@
# 王道书本上的思维导图
+ [物理层](CN_1_物理层.xmind)
+ [数据链路层](CN_2_数据链路层.xmind)
+ [网络层](CN_3_网络层.xmind)
+ [传输层](CN_4_传输层.xmind)
+ [应用层](CN_5_应用层.xmind)
# 王道书本上的思维导图
+ [物理层](CN_1_物理层.xmind)
+ [数据链路层](CN_2_数据链路层.xmind)
+ [网络层](CN_3_网络层.xmind)
+ [传输层](CN_4_传输层.xmind)
+ [应用层](CN_5_应用层.xmind)

View File

@@ -1,7 +1,7 @@
# 王道考研论坛 VIP 学员使用的思维导图
+[计算机网络体系结构](CN_0_计算机网络体系结构.pdf)
+[物理层](CN_1_物理层.pdf)
+[数据链路层](CN_2_数据链路层.pdf)
+[网络层](CN_3_网络层.pdf)
+[传输层](CN_4_传输层.pdf)
# 王道考研论坛 VIP 学员使用的思维导图
+[计算机网络体系结构](CN_0_计算机网络体系结构.pdf)
+[物理层](CN_1_物理层.pdf)
+[数据链路层](CN_2_数据链路层.pdf)
+[网络层](CN_3_网络层.pdf)
+[传输层](CN_4_传输层.pdf)
+[应用层](CN_5_应用层.pdf)

View File

@@ -1,3 +1,3 @@
# 第一章 计算机网络概述 思维导图
# 第一章 计算机网络概述 思维导图

View File

@@ -1,2 +1,2 @@
# 第二章 物理层 思维导图
# 第二章 物理层 思维导图

View File

@@ -1 +1 @@
# 第三章 思维导图 思维导图
# 第三章 思维导图 思维导图

View File

@@ -1 +1 @@
# 视频教程(PPT)中的思维导图
# 视频教程(PPT)中的思维导图

View File

@@ -1,4 +1,4 @@
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](CSKaoYanVIPMindMap)

View File

@@ -1,6 +1,6 @@
# 计算机网络(ComputerNetwork)
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容
# 计算机网络(ComputerNetwork)
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容

View File

@@ -1,5 +1,5 @@
# 王道书本上的思维导图
+ [计算机系统概述](CO_0_计算机系统概述.xmind)
+ [数据表示和运算](CO_1_数据的表示与运算.xmind)
+ [存储系统](CO_2_存储系统.xmind)
+ [指令系统](CO_3_指令系统.xmind)
# 王道书本上的思维导图
+ [计算机系统概述](CO_0_计算机系统概述.xmind)
+ [数据表示和运算](CO_1_数据的表示与运算.xmind)
+ [存储系统](CO_2_存储系统.xmind)
+ [指令系统](CO_3_指令系统.xmind)

View File

@@ -1,8 +1,8 @@
# 王道考研论坛 VIP 学员使用的思维导图
+ [计算机系统概述](CO_0_计算机系统概述.pdf)
+ [数据表示和运算](CO_1_数据表示和运算.pdf)
+ [存储系统](CO_2_存储系统.pdf)
+ [指令系统](CO_3_指令系统.pdf)
+ [中央处理器](CO_4_中央处理器.pdf)
+ [总线](CO_5_总线.pdf)
+ [IO系统](CO_6_IO系统.pdf)
# 王道考研论坛 VIP 学员使用的思维导图
+ [计算机系统概述](CO_0_计算机系统概述.pdf)
+ [数据表示和运算](CO_1_数据表示和运算.pdf)
+ [存储系统](CO_2_存储系统.pdf)
+ [指令系统](CO_3_指令系统.pdf)
+ [中央处理器](CO_4_中央处理器.pdf)
+ [总线](CO_5_总线.pdf)
+ [IO系统](CO_6_IO系统.pdf)

View File

@@ -1,2 +1,2 @@
# 视频教程(PPT)中的思维导图
# 视频教程(PPT)中的思维导图
等待更新中

View File

@@ -1,5 +1,5 @@
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](CSKaoYanVIPMindMap)
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](CSKaoYanVIPMindMap)

View File

@@ -1,12 +1,12 @@
# 计算机组成原理(ComputerOrganization)
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容
# 计算机组成原理(ComputerOrganization)
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容

View File

@@ -1,2 +1,2 @@
# 王道书上每一章最后的思维导图
# 王道书上每一章最后的思维导图

View File

@@ -1,2 +1,2 @@
# 等待更新中
# 等待更新中

View File

@@ -1,3 +1,3 @@
# 图
# 图

View File

@@ -1,2 +1,2 @@
# 查找
# 查找

View File

@@ -1,2 +1,2 @@
# 排序
# 排序

View File

@@ -1 +1 @@
# 视频教程(PPT)中的思维导图
# 视频教程(PPT)中的思维导图

View File

@@ -1,4 +1,4 @@
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
# 思维导图
+ [王道书籍上的思维导图](BookMindMap)
+ [视频教程PPT中的思维导图](PPTMindMap)
+ [王道论坛VIP学员独享的思维导图](CSKaoYanVIPMindMap)

View File

@@ -1,12 +1,12 @@
# 数据结构(DataStructure)
## [源码](Src)
源码存放于 `Src` 文件夹下,以章节分类整理,可自行根据学习进度获取源码在本地环境中运行~
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容
# 数据结构(DataStructure)
## [源码](Src)
源码存放于 `Src` 文件夹下,以章节分类整理,可自行根据学习进度获取源码在本地环境中运行~
## [思维导图](MindMap)
本科目的思维导图文件存放在 `MainMap` 文件夹下,均为 Xmind 源文件,下载后可直接在本地编辑修改。
## [PPT](PPT)
`PPT` 文件夹下存放的是 2021 王道考研视频课程讲解用的 PPT以供大家快速查找知识点或着复习视频内容

View File

@@ -1,87 +1,87 @@
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
#include <stdio.h>
/**实现模块**/
//下面四种函数的时间复杂度值得分析一二
//逐步递增型爱你
void LoveYou0(int n) {
int i = 1;
while (i <= n) {
printf("I love you %d \n", i);
i++;
}
printf("I love you more than %d\n", n);
}
//嵌套循环型爱你
void loveYou1(int n) {
int i = 1;
while (i <= n) {
i++;
printf("I love you %d\n", i);
for (int j = 1; j < n; j++) {
printf("I love you too\n");
}
}
printf("I love you more than %d\n", n);
}
//指数递增型爱你
void loveYou2(int n) {
int i = 1;
while (i <= n) {
printf("I love you %d\n", i);
i = i * 2;
}
printf("I love you more than %d\n ", n);
}
//搜索数字型爱你
void loveYou3(int flag[], int n) {
printf("I Am kim\n");
for (int i = 0; i < n; i++) {
//我觉这里应该是数组长度
if (flag[i] == n) {
printf("I love you %d\n", n);
break;//找到之后就跳出循环
}
}
}
//递归型爱你
void loveYou4(int n) {
int a, b, c;
if (n > 1) {
loveYou4(n - 1);
}
printf("I love you %d\n", n);
}//递归调用会带来多余的内存开销
/**实现模块**/
/**测试模块**/
//测试函数
void testModule() {
LoveYou0(30);
loveYou1(30);
loveYou2(30);
int array[5] = {2, 10, 100, 1000, 10000};
//声明一个数组并初始化
loveYou3(array, 10);
loveYou4(4);
}
/**测试模块**/
int main() {
testModule();
return 0;
}
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
#include <stdio.h>
/**实现模块**/
//下面四种函数的时间复杂度值得分析一二
//逐步递增型爱你
void LoveYou0(int n) {
int i = 1;
while (i <= n) {
printf("I love you %d \n", i);
i++;
}
printf("I love you more than %d\n", n);
}
//嵌套循环型爱你
void loveYou1(int n) {
int i = 1;
while (i <= n) {
i++;
printf("I love you %d\n", i);
for (int j = 1; j < n; j++) {
printf("I love you too\n");
}
}
printf("I love you more than %d\n", n);
}
//指数递增型爱你
void loveYou2(int n) {
int i = 1;
while (i <= n) {
printf("I love you %d\n", i);
i = i * 2;
}
printf("I love you more than %d\n ", n);
}
//搜索数字型爱你
void loveYou3(int flag[], int n) {
printf("I Am kim\n");
for (int i = 0; i < n; i++) {
//我觉这里应该是数组长度
if (flag[i] == n) {
printf("I love you %d\n", n);
break;//找到之后就跳出循环
}
}
}
//递归型爱你
void loveYou4(int n) {
int a, b, c;
if (n > 1) {
loveYou4(n - 1);
}
printf("I love you %d\n", n);
}//递归调用会带来多余的内存开销
/**实现模块**/
/**测试模块**/
//测试函数
void testModule() {
LoveYou0(30);
loveYou1(30);
loveYou2(30);
int array[5] = {2, 10, 100, 1000, 10000};
//声明一个数组并初始化
loveYou3(array, 10);
loveYou4(4);
}
/**测试模块**/
int main() {
testModule();
return 0;
}

View File

@@ -1,224 +1,224 @@
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序表——静态分配的实现方式
/**定义模块**/
#include <stdio.h>
#define MaxSize 10
typedef struct {
int data[MaxSize];
int length;
} SqList;
//函数声明
void InitList(SqList &L); //初始化
bool Empty(SqList L); //判空
bool ListInsert(SqList &L, int i, int e); //插入
bool ListDelete(SqList &L, int i, int &e); //删除
int GetElem(SqList L, int i); //按位查找
int LocateElem(SqList L, int e); //按值查找
bool LocateChangeElem(SqList &L, int e, int em); //按值修改
bool getChangeElem(SqList &L, int i, int em); //按位修改
void PrintSqList(SqList L); //打印函数
void testModule(); //测试模块
/**定义模块**/
/**实现模块**/
//初始化
void InitList(SqList &L) {
for (int i = 0; i < MaxSize; i++) {
L.data[i] = 0;//将所有元素的初始值默认设置为0
//这一步其实可以省略,但是省略之后,有可能受到内存中"脏数据"的影响
}
L.length = 0;
}
//判空
bool Empty(SqList L) {
return (L.length == 0);
}
//插入
bool ListInsert(SqList &L, int i, int e) {
//判断插入的位置是否合法,
if (i < 1 || i > L.length + 1)
return false;
//判断表是否存满了
if (L.length >= MaxSize)
return false;
//后面的元素后移
for (int j = L.length; j >= i; j--) {
L.data[j] = L.data[j - 1];
}
L.data[i - 1] = e;
L.length++;
return true;
}
//删除
bool ListDelete(SqList &L, int i, int &e) {
//判断i的位置是否合法
if (i < 0 || i > L.length) {
return false;
}
//取出将要被删除的数
e = L.data[i - 1];
//将其后的数据前移
for (int j = i; j <= L.length; j++) {
L.data[j - 1] = L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
//查找
//按位查找
int GetElem(SqList L, int i) {
//判断是否越界
if (i < 0 || i > L.length)
return -1;
return L.data[i - 1];
}
//按值查找
int LocateElem(SqList L, int e) {
//循环出查找
for (int i = 0; i < L.length; i++) {
if (L.data[i] == e)
return i + 1; //返回位序
}
return -1;
}
//改
//先查找后改值
//由此分为两种方式,先按位查找后改值;或先按值查找后改值
//先按值查找后改值
bool LocateChangeElem(SqList &L, int e, int em) {
//按值查找得到位序
int bitOrder = LocateElem(L, e);
//改值
if (bitOrder != -1) {
L.data[bitOrder] = em;
return true;
} else {
return false;
}
}
//先按位序查找后改值
bool getChangeElem(SqList &L, int i, int em) {
//注意由于是改值涉及修改原数据,所以需要用引用传递的方式
//给的位序,首先判断i是否合法
if (i < 0 || i >= L.length)return false;
//由于是用数组实现的方式可以直接利用i查找
L.data[i] = em;
return true;
}
//销毁
//由于静态分配方式是通过声明数组的方式实现的故不需要手动销毁SqList表在使用完成之后系统会自动删除数据并回收数据空间
/**实现模块**/
/**测试模块**/
//测试
//打印整个顺序表
void PrintSqList(SqList L) {
//循环打印
printf("开始打印顺序表\n");
for (int i = 0; i < L.length; i++) {
printf("Data[%d]==%d\n", i, L.data[i]);
}
printf("打印结束!\n");
}
//测试函数
void testModule() {
SqList L;
InitList(L);
// 初试化一些值
L.data[0] = 1;
L.data[1] = 2;
L.data[2] = 3;
L.length = 3;
//插入操作
if (ListInsert(L, 2, 3)) {
printf("插入成功了\n");
} else {
printf("插入失败了i的位置不合法请检查\n");
}
//删除操作
int e = -1;
if (ListDelete(L, 2, e)) {
printf("删除成功!删除的值是:%d\n", e);
} else {
printf("删除失败,请检查位序是否正确\n");
}
//数组当前长度
printf("数组当前长度是多少?%d\n", L.length);
//查找第一个元素是什么?
printf("第一个元素是什么?\n %d\n", GetElem(L, 1));
//查找值为3的元素在什么位置
printf("第一个值为3的元素在什么位置\n %d \n", LocateElem(L, 3));
//打印输出
PrintSqList(L);
//测试改模块功能是否正常
int e1 = 2;
int em1 = 6;
int i = 1;
int em2 = 7;
printf("开始测试【改】\n"
"第一种方式先按值查找后改值\n");
if (LocateChangeElem(L, e1, em1)) {
printf("第一种先按值查找后改值成功啦,改变后的值如下:\n");
PrintSqList(L);
} else {
printf("第一种先按值查找后改值失败了,再检查一下吧!\n");
}
printf("第二种先按位序查找后改值\n");
if (getChangeElem(L, i, em2)) {
printf("第二种先按位序查找后改值的方式成功啦,改变后的值如下:\n");
PrintSqList(L);
} else {
printf("第二种先按位序查找后改值的方式失败了,再检查一下吧!\n");
}
if (Empty(L)) {
printf("顺序表为空!\n");
} else {
printf("顺序表非空!\n");
}
//打印输出
PrintSqList(L);
}
/**测试模块**/
//主函数
int main() {
testModule();
return 0;
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序表——静态分配的实现方式
/**定义模块**/
#include <stdio.h>
#define MaxSize 10
typedef struct {
int data[MaxSize];
int length;
} SqList;
//函数声明
void InitList(SqList &L); //初始化
bool Empty(SqList L); //判空
bool ListInsert(SqList &L, int i, int e); //插入
bool ListDelete(SqList &L, int i, int &e); //删除
int GetElem(SqList L, int i); //按位查找
int LocateElem(SqList L, int e); //按值查找
bool LocateChangeElem(SqList &L, int e, int em); //按值修改
bool getChangeElem(SqList &L, int i, int em); //按位修改
void PrintSqList(SqList L); //打印函数
void testModule(); //测试模块
/**定义模块**/
/**实现模块**/
//初始化
void InitList(SqList &L) {
for (int i = 0; i < MaxSize; i++) {
L.data[i] = 0;//将所有元素的初始值默认设置为0
//这一步其实可以省略,但是省略之后,有可能受到内存中"脏数据"的影响
}
L.length = 0;
}
//判空
bool Empty(SqList L) {
return (L.length == 0);
}
//插入
bool ListInsert(SqList &L, int i, int e) {
//判断插入的位置是否合法,
if (i < 1 || i > L.length + 1)
return false;
//判断表是否存满了
if (L.length >= MaxSize)
return false;
//后面的元素后移
for (int j = L.length; j >= i; j--) {
L.data[j] = L.data[j - 1];
}
L.data[i - 1] = e;
L.length++;
return true;
}
//删除
bool ListDelete(SqList &L, int i, int &e) {
//判断i的位置是否合法
if (i < 0 || i > L.length) {
return false;
}
//取出将要被删除的数
e = L.data[i - 1];
//将其后的数据前移
for (int j = i; j <= L.length; j++) {
L.data[j - 1] = L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
//查找
//按位查找
int GetElem(SqList L, int i) {
//判断是否越界
if (i < 0 || i > L.length)
return -1;
return L.data[i - 1];
}
//按值查找
int LocateElem(SqList L, int e) {
//循环出查找
for (int i = 0; i < L.length; i++) {
if (L.data[i] == e)
return i + 1; //返回位序
}
return -1;
}
//改
//先查找后改值
//由此分为两种方式,先按位查找后改值;或先按值查找后改值
//先按值查找后改值
bool LocateChangeElem(SqList &L, int e, int em) {
//按值查找得到位序
int bitOrder = LocateElem(L, e);
//改值
if (bitOrder != -1) {
L.data[bitOrder] = em;
return true;
} else {
return false;
}
}
//先按位序查找后改值
bool getChangeElem(SqList &L, int i, int em) {
//注意由于是改值涉及修改原数据,所以需要用引用传递的方式
//给的位序,首先判断i是否合法
if (i < 0 || i >= L.length)return false;
//由于是用数组实现的方式可以直接利用i查找
L.data[i] = em;
return true;
}
//销毁
//由于静态分配方式是通过声明数组的方式实现的故不需要手动销毁SqList表在使用完成之后系统会自动删除数据并回收数据空间
/**实现模块**/
/**测试模块**/
//测试
//打印整个顺序表
void PrintSqList(SqList L) {
//循环打印
printf("开始打印顺序表\n");
for (int i = 0; i < L.length; i++) {
printf("Data[%d]==%d\n", i, L.data[i]);
}
printf("打印结束!\n");
}
//测试函数
void testModule() {
SqList L;
InitList(L);
// 初试化一些值
L.data[0] = 1;
L.data[1] = 2;
L.data[2] = 3;
L.length = 3;
//插入操作
if (ListInsert(L, 2, 3)) {
printf("插入成功了\n");
} else {
printf("插入失败了i的位置不合法请检查\n");
}
//删除操作
int e = -1;
if (ListDelete(L, 2, e)) {
printf("删除成功!删除的值是:%d\n", e);
} else {
printf("删除失败,请检查位序是否正确\n");
}
//数组当前长度
printf("数组当前长度是多少?%d\n", L.length);
//查找第一个元素是什么?
printf("第一个元素是什么?\n %d\n", GetElem(L, 1));
//查找值为3的元素在什么位置
printf("第一个值为3的元素在什么位置\n %d \n", LocateElem(L, 3));
//打印输出
PrintSqList(L);
//测试改模块功能是否正常
int e1 = 2;
int em1 = 6;
int i = 1;
int em2 = 7;
printf("开始测试【改】\n"
"第一种方式先按值查找后改值\n");
if (LocateChangeElem(L, e1, em1)) {
printf("第一种先按值查找后改值成功啦,改变后的值如下:\n");
PrintSqList(L);
} else {
printf("第一种先按值查找后改值失败了,再检查一下吧!\n");
}
printf("第二种先按位序查找后改值\n");
if (getChangeElem(L, i, em2)) {
printf("第二种先按位序查找后改值的方式成功啦,改变后的值如下:\n");
PrintSqList(L);
} else {
printf("第二种先按位序查找后改值的方式失败了,再检查一下吧!\n");
}
if (Empty(L)) {
printf("顺序表为空!\n");
} else {
printf("顺序表非空!\n");
}
//打印输出
PrintSqList(L);
}
/**测试模块**/
//主函数
int main() {
testModule();
return 0;
}

View File

@@ -1,215 +1,215 @@
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序表——动态分配的实现方式
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
#define InitSize 10
typedef struct {
int *data; //指示动态分配数组的指针
int MaxSize;//顺序表的最大容量
int length;//顺序表当前的长度
} SeqList;
//函数声明
bool InitList(SeqList &L); //初始化
bool Empty(SeqList L); //判空
bool Full(SeqList L); //判满
void IncreaseSize(SeqList &L, int len); //动态扩展空间
bool ListInsert(SeqList &L, int i, int e); //插入
int GetElem(SeqList L, int i); //按位查找
int LocateElem(SeqList L, int e); //按值查找
bool ListDelete(SeqList &L, int i, int &e); //删除
void DestroySqList(SeqList &L); //销毁
/**定义模块**/
/**实现模块**/
//初始化
bool InitList(SeqList &L) {
//用 malloc 函数申请一片连续的存储空间
L.data = (int *) malloc(InitSize * sizeof(int));
if (L.data == NULL)
//要细心呀,这里不小心写成了赋值语句,但是没有报错,找了半天错误!
return false;
//(int *) 是指针的强制类型转换
L.length = 0;
L.MaxSize = InitSize;
return true;
}
//判空
bool Empty(SeqList L) {
return (L.length == 0);
}
//判满
bool Full(SeqList L) {
return (L.length >= L.MaxSize);
}
//扩展空间
void IncreaseSize(SeqList &L, int len) {
printf("开始扩展表存储空间。。。\n");
int *p = L.data;
L.data = (int *) malloc((InitSize + len) * sizeof(int));
printf("开始复制转移数据。。。\n");
for (int i = 0; i < L.length; i++) {
L.data[i] = p[i];
}
printf("之前内存空间的长度是:%d\n", L.MaxSize);
L.MaxSize = L.MaxSize + len;
free(p);
//malloc 函数用于申请内存空间free 函数用于释放内存空间;
printf("现在的内存空间长度是%d\n", L.MaxSize);
}
//插入
bool ListInsert(SeqList &L, int i, int e) {
//判断插入的位置是否合法,
if (i < 1 || i > L.length + 1)
return false;
//判断表是否存满了
// if (L.length>=L.MaxSize)
// return false;
if (Full(L))
return false;
//后面的元素后移
for (int j = L.length; j >= i; j--) {
L.data[j] = L.data[j - 1];
}
L.data[i - 1] = e;
L.length++;
return true;
}
//按位查找
int GetElem(SeqList L, int i) {
//判断是否越界
if (i < 0 || i > L.length)
return -1;
return L.data[i - 1];
}
//按值查找
int LocateElem(SeqList L, int e) {
//循环出查找
for (int i = 0; i < L.length; i++) {
if (L.data[i] == e)
return i + 1; //返回位序
}
return -1;
}
//删除
bool ListDelete(SeqList &L, int i, int &e) {
//判断i的位置是否合法
if (i < 0 || i > L.length) {
return false;
}
//取出将要被删除的数
e = L.data[i - 1];
//将其后的数据前移
for (int j = i; j <= L.length; j++) {
L.data[j - 1] = L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
//销毁
//由于动态分配方式使用malloc申请的内存空间故需要使用free函数手动释放空间
void DestroySqList(SeqList &L) {
free(L.data);
L.data = NULL;
L.length = 0;
}
/**实现模块**/
/**测试模块**/
//测试
//打印整个顺序表
void PrintSqList(SeqList L) {
if (L.data == NULL || L.length == 0)
printf("这是一个空表!");
else {
//循环打印
printf("开始打印顺序表\n");
for (int i = 0; i < L.length; i++) {
printf("Data[%d]==%d\n", i, L.data[i]);
}
printf("打印结束!\n");
}
}
//测试输出
void TestPrint(bool test, char message[]) {
if (test)
printf("%s成功啦!\n", message);
else
printf("%s失败啦\n", message);
}
void testModule() {
SeqList L;
TestPrint(InitList(L), "初始化");
// 初试化一些值
L.data[0] = 1;
L.data[1] = 2;
L.data[2] = 3;
L.length = 3;
PrintSqList(L);
//循环插入直到表满
int i = 4;
int InsertValue = 4;
while (L.length < L.MaxSize) {
TestPrint(ListInsert(L, i, InsertValue), "插入");
i++;
InsertValue++;
}
PrintSqList(L);
//表满则扩展空间
if (Full(L))IncreaseSize(L, 5);
//按位查找
printf("第5个元素是%d\n", GetElem(L, 5));
//按值查找
printf("值为6的元素的位序是%d\n", LocateElem(L, 6));
//删除
int e;
TestPrint(ListDelete(L, 4, e), "删除");
printf("删除的元素是%d\n", e);
PrintSqList(L);
//销毁
DestroySqList(L);
TestPrint(Empty(L), "删除");
PrintSqList(L);
}
/**测试模块**/
int main() {
testModule();
return 0;
//
// Created by kim on 2020/6/17.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序表——动态分配的实现方式
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
#define InitSize 10
typedef struct {
int *data; //指示动态分配数组的指针
int MaxSize;//顺序表的最大容量
int length;//顺序表当前的长度
} SeqList;
//函数声明
bool InitList(SeqList &L); //初始化
bool Empty(SeqList L); //判空
bool Full(SeqList L); //判满
void IncreaseSize(SeqList &L, int len); //动态扩展空间
bool ListInsert(SeqList &L, int i, int e); //插入
int GetElem(SeqList L, int i); //按位查找
int LocateElem(SeqList L, int e); //按值查找
bool ListDelete(SeqList &L, int i, int &e); //删除
void DestroySqList(SeqList &L); //销毁
/**定义模块**/
/**实现模块**/
//初始化
bool InitList(SeqList &L) {
//用 malloc 函数申请一片连续的存储空间
L.data = (int *) malloc(InitSize * sizeof(int));
if (L.data == NULL)
//要细心呀,这里不小心写成了赋值语句,但是没有报错,找了半天错误!
return false;
//(int *) 是指针的强制类型转换
L.length = 0;
L.MaxSize = InitSize;
return true;
}
//判空
bool Empty(SeqList L) {
return (L.length == 0);
}
//判满
bool Full(SeqList L) {
return (L.length >= L.MaxSize);
}
//扩展空间
void IncreaseSize(SeqList &L, int len) {
printf("开始扩展表存储空间。。。\n");
int *p = L.data;
L.data = (int *) malloc((InitSize + len) * sizeof(int));
printf("开始复制转移数据。。。\n");
for (int i = 0; i < L.length; i++) {
L.data[i] = p[i];
}
printf("之前内存空间的长度是:%d\n", L.MaxSize);
L.MaxSize = L.MaxSize + len;
free(p);
//malloc 函数用于申请内存空间free 函数用于释放内存空间;
printf("现在的内存空间长度是%d\n", L.MaxSize);
}
//插入
bool ListInsert(SeqList &L, int i, int e) {
//判断插入的位置是否合法,
if (i < 1 || i > L.length + 1)
return false;
//判断表是否存满了
// if (L.length>=L.MaxSize)
// return false;
if (Full(L))
return false;
//后面的元素后移
for (int j = L.length; j >= i; j--) {
L.data[j] = L.data[j - 1];
}
L.data[i - 1] = e;
L.length++;
return true;
}
//按位查找
int GetElem(SeqList L, int i) {
//判断是否越界
if (i < 0 || i > L.length)
return -1;
return L.data[i - 1];
}
//按值查找
int LocateElem(SeqList L, int e) {
//循环出查找
for (int i = 0; i < L.length; i++) {
if (L.data[i] == e)
return i + 1; //返回位序
}
return -1;
}
//删除
bool ListDelete(SeqList &L, int i, int &e) {
//判断i的位置是否合法
if (i < 0 || i > L.length) {
return false;
}
//取出将要被删除的数
e = L.data[i - 1];
//将其后的数据前移
for (int j = i; j <= L.length; j++) {
L.data[j - 1] = L.data[j];
}
//线性表长度减一
L.length--;
return true;
}
//销毁
//由于动态分配方式使用malloc申请的内存空间故需要使用free函数手动释放空间
void DestroySqList(SeqList &L) {
free(L.data);
L.data = NULL;
L.length = 0;
}
/**实现模块**/
/**测试模块**/
//测试
//打印整个顺序表
void PrintSqList(SeqList L) {
if (L.data == NULL || L.length == 0)
printf("这是一个空表!");
else {
//循环打印
printf("开始打印顺序表\n");
for (int i = 0; i < L.length; i++) {
printf("Data[%d]==%d\n", i, L.data[i]);
}
printf("打印结束!\n");
}
}
//测试输出
void TestPrint(bool test, char message[]) {
if (test)
printf("%s成功啦!\n", message);
else
printf("%s失败啦\n", message);
}
void testModule() {
SeqList L;
TestPrint(InitList(L), "初始化");
// 初试化一些值
L.data[0] = 1;
L.data[1] = 2;
L.data[2] = 3;
L.length = 3;
PrintSqList(L);
//循环插入直到表满
int i = 4;
int InsertValue = 4;
while (L.length < L.MaxSize) {
TestPrint(ListInsert(L, i, InsertValue), "插入");
i++;
InsertValue++;
}
PrintSqList(L);
//表满则扩展空间
if (Full(L))IncreaseSize(L, 5);
//按位查找
printf("第5个元素是%d\n", GetElem(L, 5));
//按值查找
printf("值为6的元素的位序是%d\n", LocateElem(L, 6));
//删除
int e;
TestPrint(ListDelete(L, 4, e), "删除");
printf("删除的元素是%d\n", e);
PrintSqList(L);
//销毁
DestroySqList(L);
TestPrint(Empty(L), "删除");
PrintSqList(L);
}
/**测试模块**/
int main() {
testModule();
return 0;
}

View File

@@ -1,158 +1,158 @@
//
// Created by kim on 2020/6/19.
// Copyright (c) Kim Yang All rights reserved.
//
//带头节点的单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode {
int data;
LNode *next;
} LNode, *LinkList;
//函数定义
bool InitList(LinkList &L); //初始化
bool Empty(LinkList L); //盘空
bool ListInsert(LinkList &L, int i, int e);//按位插入
bool InsertNextNode(LNode *p, int e);//指定节点的后插操作
bool InsertPriorNode(LNode *p, int e);//指定节点的前插操作————先完成后插,再交换数据以实现前插
bool ListDelete(LinkList &L, int i, int &e);//按指定位序删除节点并返回其值
bool DeleteNode(LNode *p);//删除指定节点
/**定义模块**/
/**实现模块**/
//初试化(带有头节点)
bool InitList(LinkList &L) {
L = (LNode *) malloc(sizeof(LNode));//分配一个头节点
if (L == NULL)
return false;//头节点分配失败,可能是内存不足
L->next = NULL;//头节点之后暂时没有节点,头节点也不存放数据
return true;
}
//判空
bool Empty(LinkList L) {
// if(L->next==NULL)
// return true;
// else
// return false;
return (L->next == NULL);
}
//按位插入
bool ListInsert(LinkList &L, int i, int e) {
if (i < 1)return false;//判断位序i是否合法
LNode *p;//指针指向当前扫面到的节点
int j = 0;//记录p指向的节点的位序
p = L;//L指向头节点从头开始
while (p != NULL && j < i - 1) {
//循环扫描
p = p->next;
j++;
}
if (p == NULL) //i值超过来表长不合法
return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
//下面的顺序不可交换
s->next = p->next;
p->next = s;
return true;
}
//指定节点的后插操作
bool InsertNextNode(LNode *p, int e) {
if (p == NULL)
return false;//判断指定节点是否存在
LNode *s = (LNode *) malloc(sizeof(LNode));
if (s == NULL)return false;//分配内存失败
s->data = e;
s->next = p->next;
p->next = s;
return true;
}
//指定节点的前插操作
//先完成后插,再交换数据以实现前插
bool InsertPriorNode(LNode *p, int e) {
if (p == NULL)return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
if (s == NULL)return false;
s->next = p->next;
p->next = s;
s->data = p->data;
p->data = e;
return true;
}
//按指定位序删除节点并返回其值
bool ListDelete(LinkList &L, int i, int &e) {
if (i < 1)return false;
LNode *p;
int j = 0;
p = L;
while (p != NULL && j < i - 1) {
p = p->next;
j++;
}
LNode *q = p->next;
e = q->data;
p->next = q->next;
free(q);
return true;
}
//删除指定节点
bool DeleteNode(LNode *p) {
}
/**实现模块**/
/**测试模块**/
//Test
void TestPrint(bool test, char about[]) {
if (test)
printf("%s成功\n", about);
else
printf("%s失败\n", about);
}
void PrintList(LinkList L) {
//循环打印整个链表
LNode *p = L->next;//扫描指针
int j = 0;
if (p == NULL)printf("这是一个空表\n");
while (p != NULL) {
printf("LinkList[%d]=%d\n", j, p->data);
p = p->next;
j++;
}
}
void TestModule() {
LinkList L;
TestPrint(InitList(L), "初始化");
PrintList(L);
TestPrint(ListInsert(L, 1, 3), "按位插入");
PrintList(L);
int e;
TestPrint(ListDelete(L, 1, e), "删除");
PrintList(L);
printf("被删除的数据是:%d\n", e);
}
/**测试模块**/
int main() {
TestModule();
return 0;
//
// Created by kim on 2020/6/19.
// Copyright (c) Kim Yang All rights reserved.
//
//带头节点的单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode {
int data;
LNode *next;
} LNode, *LinkList;
//函数定义
bool InitList(LinkList &L); //初始化
bool Empty(LinkList L); //盘空
bool ListInsert(LinkList &L, int i, int e);//按位插入
bool InsertNextNode(LNode *p, int e);//指定节点的后插操作
bool InsertPriorNode(LNode *p, int e);//指定节点的前插操作————先完成后插,再交换数据以实现前插
bool ListDelete(LinkList &L, int i, int &e);//按指定位序删除节点并返回其值
bool DeleteNode(LNode *p);//删除指定节点
/**定义模块**/
/**实现模块**/
//初试化(带有头节点)
bool InitList(LinkList &L) {
L = (LNode *) malloc(sizeof(LNode));//分配一个头节点
if (L == NULL)
return false;//头节点分配失败,可能是内存不足
L->next = NULL;//头节点之后暂时没有节点,头节点也不存放数据
return true;
}
//判空
bool Empty(LinkList L) {
// if(L->next==NULL)
// return true;
// else
// return false;
return (L->next == NULL);
}
//按位插入
bool ListInsert(LinkList &L, int i, int e) {
if (i < 1)return false;//判断位序i是否合法
LNode *p;//指针指向当前扫面到的节点
int j = 0;//记录p指向的节点的位序
p = L;//L指向头节点从头开始
while (p != NULL && j < i - 1) {
//循环扫描
p = p->next;
j++;
}
if (p == NULL) //i值超过来表长不合法
return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
//下面的顺序不可交换
s->next = p->next;
p->next = s;
return true;
}
//指定节点的后插操作
bool InsertNextNode(LNode *p, int e) {
if (p == NULL)
return false;//判断指定节点是否存在
LNode *s = (LNode *) malloc(sizeof(LNode));
if (s == NULL)return false;//分配内存失败
s->data = e;
s->next = p->next;
p->next = s;
return true;
}
//指定节点的前插操作
//先完成后插,再交换数据以实现前插
bool InsertPriorNode(LNode *p, int e) {
if (p == NULL)return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
if (s == NULL)return false;
s->next = p->next;
p->next = s;
s->data = p->data;
p->data = e;
return true;
}
//按指定位序删除节点并返回其值
bool ListDelete(LinkList &L, int i, int &e) {
if (i < 1)return false;
LNode *p;
int j = 0;
p = L;
while (p != NULL && j < i - 1) {
p = p->next;
j++;
}
LNode *q = p->next;
e = q->data;
p->next = q->next;
free(q);
return true;
}
//删除指定节点
bool DeleteNode(LNode *p) {
}
/**实现模块**/
/**测试模块**/
//Test
void TestPrint(bool test, char about[]) {
if (test)
printf("%s成功\n", about);
else
printf("%s失败\n", about);
}
void PrintList(LinkList L) {
//循环打印整个链表
LNode *p = L->next;//扫描指针
int j = 0;
if (p == NULL)printf("这是一个空表\n");
while (p != NULL) {
printf("LinkList[%d]=%d\n", j, p->data);
p = p->next;
j++;
}
}
void TestModule() {
LinkList L;
TestPrint(InitList(L), "初始化");
PrintList(L);
TestPrint(ListInsert(L, 1, 3), "按位插入");
PrintList(L);
int e;
TestPrint(ListDelete(L, 1, e), "删除");
PrintList(L);
printf("被删除的数据是:%d\n", e);
}
/**测试模块**/
int main() {
TestModule();
return 0;
}

View File

@@ -1,120 +1,120 @@
//
// Created by kim on 2020/6/19.
// Copyright (c) Kim Yang All rights reserved.
//
//不带头节点的单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode {
int data;
struct LNode *next;
} LNode, *LinkList;
//等价于
//struct LNode{
// int data;
// struct LNode *next;
//};
//
//typedef struct LNode LNode;
//typedef struct LNode *LinkList;
//函数声明
bool InitList(LinkList &L);//初始化
bool Empty(LinkList L);//判断是否为空
bool ListInsert(LinkList &L, int i, int e);//插入
/**定义模块**/
/**实现模块**/
//初始化
bool InitList(LinkList &L) {
L = NULL;//空表暂时没有任何数据
return true;
}
//判断是否为空
bool Empty(LinkList L) {
return (L == NULL);
}
//等价于
//bool Empty1(LinkList L){
// if (L==NULL)
// return true;
// else
// return false;
//}
bool ListInsert(LinkList &L, int i, int e) {
if (i < 1)return false;//判断位序i是否合法
//不带头节点时,插入位置正好为表头时,得单独处理
if (i = 1) {
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
s->next = L;
L = s;
return true;
}
LNode *p;//指针指向当前扫面到的节点
int j = 0;//记录p指向的节点的位序
p = L;//L指向头节点从头开始
while (p != NULL && j < i - 1) {
//循环扫描
p = p->next;
j++;
}
if (p == NULL) //i值超过来表长不合法
return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
//下面的顺序不可交换
s->next = p->next;
p->next = s;
return true;
}
/**实现模块**/
/**测试模块**/
//Test
void TestPrint(bool test, char about[]) {
if (test)
printf("%s成功\n", about);
else
printf("%s失败\n", about);
}
void PrintList(LinkList L) {
//循环打印整个链表
LNode *p = L;//扫描指针
int j = 0;
if (p == NULL)printf("这是一个空表\n");
while (p != NULL) {
printf("LinkList[%d]=%d", j, p->data);
p = p->next;
j++;
}
}
void TestModule() {
LinkList L;
TestPrint(InitList(L), "初始化");
PrintList(L);
TestPrint(ListInsert(L, 1, 2), "按位插入");
PrintList(L);
}
/**测试模块**/
int main() {
TestModule();
return 0;
//
// Created by kim on 2020/6/19.
// Copyright (c) Kim Yang All rights reserved.
//
//不带头节点的单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode {
int data;
struct LNode *next;
} LNode, *LinkList;
//等价于
//struct LNode{
// int data;
// struct LNode *next;
//};
//
//typedef struct LNode LNode;
//typedef struct LNode *LinkList;
//函数声明
bool InitList(LinkList &L);//初始化
bool Empty(LinkList L);//判断是否为空
bool ListInsert(LinkList &L, int i, int e);//插入
/**定义模块**/
/**实现模块**/
//初始化
bool InitList(LinkList &L) {
L = NULL;//空表暂时没有任何数据
return true;
}
//判断是否为空
bool Empty(LinkList L) {
return (L == NULL);
}
//等价于
//bool Empty1(LinkList L){
// if (L==NULL)
// return true;
// else
// return false;
//}
bool ListInsert(LinkList &L, int i, int e) {
if (i < 1)return false;//判断位序i是否合法
//不带头节点时,插入位置正好为表头时,得单独处理
if (i = 1) {
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
s->next = L;
L = s;
return true;
}
LNode *p;//指针指向当前扫面到的节点
int j = 0;//记录p指向的节点的位序
p = L;//L指向头节点从头开始
while (p != NULL && j < i - 1) {
//循环扫描
p = p->next;
j++;
}
if (p == NULL) //i值超过来表长不合法
return false;
LNode *s = (LNode *) malloc(sizeof(LNode));
s->data = e;
//下面的顺序不可交换
s->next = p->next;
p->next = s;
return true;
}
/**实现模块**/
/**测试模块**/
//Test
void TestPrint(bool test, char about[]) {
if (test)
printf("%s成功\n", about);
else
printf("%s失败\n", about);
}
void PrintList(LinkList L) {
//循环打印整个链表
LNode *p = L;//扫描指针
int j = 0;
if (p == NULL)printf("这是一个空表\n");
while (p != NULL) {
printf("LinkList[%d]=%d", j, p->data);
p = p->next;
j++;
}
}
void TestModule() {
LinkList L;
TestPrint(InitList(L), "初始化");
PrintList(L);
TestPrint(ListInsert(L, 1, 2), "按位插入");
PrintList(L);
}
/**测试模块**/
int main() {
TestModule();
return 0;
}

View File

@@ -1,131 +1,131 @@
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//带有头节点版本——双链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct DNode {
int data;//数据域
struct DNode *prior, *next;//前指针和后指针
} DNode, *DLinkList;
//函数声明
bool InitDLinkList(DLinkList &L);//初始化
bool Empty(DLinkList L);//判空
bool InsertNextElem(DNode *p, DNode *s);//指定节点的后插操作
bool DeleteNextNode(DNode *p);//删除P节点的后继节点
bool DestroyList(DLinkList &L);//销毁整个表
bool PrintNextElems(DNode *p);//从P点向后遍历
bool PrintPriorElems(DNode *p);//从P点向前遍历
bool PrintPriorElemsOverHead(DNode *p);//从P点向前遍历跳过头节点
/**定义模块**/
/**实现模块**/
//初始化
bool InitDLinkList(DLinkList &L) {
L = (DNode *) malloc(sizeof(DNode));//分配一个头节点
if (L == NULL)
return false;
L->prior == NULL;//头节点前后指针都指向空
L->next == NULL;
return true;
}
//判空
bool Empty(DLinkList L) {
return (L->next == NULL);
}
//指定节点的后插操作
bool InsertNextElem(DNode *p, DNode *s) {
//注意顺序不可交换
s->next = p->next;
p->next->prior = s;
s->prior = p;
p->next = s;
}
//删除P节点的后继节点
bool DeleteNextNode(DNode *p) {
if (p == NULL)return false;//p节点为空
DNode *q = p->next;
if (q == NULL)return false;//P节点没有后继
p->next = q->next;
if (q->next != NULL)//q不是最后一个节点
q->next->prior = p;
free(q);//手动释放内存空间
return true;
}
//销毁整个表
bool DestroyList(DLinkList &L) {
//循环删除并释放每个节点
while (L->next != NULL)
DeleteNextNode(L);
free(L);//释放头节点
L = NULL;//头指针指向NULL
}
//从P点向后遍历
bool PrintNextElems(DNode *p) {
if (p == NULL)return false;//
while (p != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->next;
}
return true;
}
//从P点向前遍历
bool PrintPriorElems(DNode *p) {
if (p == NULL)return false;//
while (p != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->prior;
}
return true;
}
//从P点向前遍历跳过头节点
bool PrintPriorElemsOverHead(DNode *p) {
if (p == NULL)return false;//
while (p->prior != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->prior;
}
return true;
}
/**实现模块**/
/**测试模块**/
//测试函数
void TestPrint(bool test, char message[]) {
if (test)
printf("%s成功啦\n", message);
else
printf("%s失败啦\n", message);
}
void TestModule() {
DLinkList L;
TestPrint(InitDLinkList(L), "初始化");
}
/**测试模块**/
int main() {
TestModule();
return 0;
}
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//带有头节点版本——双链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct DNode {
int data;//数据域
struct DNode *prior, *next;//前指针和后指针
} DNode, *DLinkList;
//函数声明
bool InitDLinkList(DLinkList &L);//初始化
bool Empty(DLinkList L);//判空
bool InsertNextElem(DNode *p, DNode *s);//指定节点的后插操作
bool DeleteNextNode(DNode *p);//删除P节点的后继节点
bool DestroyList(DLinkList &L);//销毁整个表
bool PrintNextElems(DNode *p);//从P点向后遍历
bool PrintPriorElems(DNode *p);//从P点向前遍历
bool PrintPriorElemsOverHead(DNode *p);//从P点向前遍历跳过头节点
/**定义模块**/
/**实现模块**/
//初始化
bool InitDLinkList(DLinkList &L) {
L = (DNode *) malloc(sizeof(DNode));//分配一个头节点
if (L == NULL)
return false;
L->prior == NULL;//头节点前后指针都指向空
L->next == NULL;
return true;
}
//判空
bool Empty(DLinkList L) {
return (L->next == NULL);
}
//指定节点的后插操作
bool InsertNextElem(DNode *p, DNode *s) {
//注意顺序不可交换
s->next = p->next;
p->next->prior = s;
s->prior = p;
p->next = s;
}
//删除P节点的后继节点
bool DeleteNextNode(DNode *p) {
if (p == NULL)return false;//p节点为空
DNode *q = p->next;
if (q == NULL)return false;//P节点没有后继
p->next = q->next;
if (q->next != NULL)//q不是最后一个节点
q->next->prior = p;
free(q);//手动释放内存空间
return true;
}
//销毁整个表
bool DestroyList(DLinkList &L) {
//循环删除并释放每个节点
while (L->next != NULL)
DeleteNextNode(L);
free(L);//释放头节点
L = NULL;//头指针指向NULL
}
//从P点向后遍历
bool PrintNextElems(DNode *p) {
if (p == NULL)return false;//
while (p != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->next;
}
return true;
}
//从P点向前遍历
bool PrintPriorElems(DNode *p) {
if (p == NULL)return false;//
while (p != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->prior;
}
return true;
}
//从P点向前遍历跳过头节点
bool PrintPriorElemsOverHead(DNode *p) {
if (p == NULL)return false;//
while (p->prior != NULL) {
printf("当前节点的值是:%d", p->data);
p = p->prior;
}
return true;
}
/**实现模块**/
/**测试模块**/
//测试函数
void TestPrint(bool test, char message[]) {
if (test)
printf("%s成功啦\n", message);
else
printf("%s失败啦\n", message);
}
void TestModule() {
DLinkList L;
TestPrint(InitDLinkList(L), "初始化");
}
/**测试模块**/
int main() {
TestModule();
return 0;
}

View File

@@ -1,51 +1,51 @@
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//循环单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode{
int data;
struct LNode *next;
}LNode,*LinkList;
//函数声明
bool InitRLinkList(LinkList &L);//初始化
bool IsTail(LinkList L,LNode *p);//判断P是不是表尾指针
/**定义模块**/
/**实现模块**/
//初始化一个循环单链表
bool InitRLinkList(LinkList &L){
L=(LNode *)malloc(sizeof(LNode));//分配一个头节点
if (L=NULL)
return false;//内存不足,分配失败;
L->next=L;//头节点nex指向头节点以此形成循环链表
return true;
}
//判断P是不是表尾指针
bool IsTail(LinkList L,LNode *p){
return (p->next==L);
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
TestModule();
return 0;
}
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//循环单链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct LNode{
int data;
struct LNode *next;
}LNode,*LinkList;
//函数声明
bool InitRLinkList(LinkList &L);//初始化
bool IsTail(LinkList L,LNode *p);//判断P是不是表尾指针
/**定义模块**/
/**实现模块**/
//初始化一个循环单链表
bool InitRLinkList(LinkList &L){
L=(LNode *)malloc(sizeof(LNode));//分配一个头节点
if (L=NULL)
return false;//内存不足,分配失败;
L->next=L;//头节点nex指向头节点以此形成循环链表
return true;
}
//判断P是不是表尾指针
bool IsTail(LinkList L,LNode *p){
return (p->next==L);
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
TestModule();
return 0;
}

View File

@@ -1,70 +1,70 @@
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//循环双链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct DNode{
int data;
struct DNode *prior,*next;
}DNode,*DLinkList;
//函数声明
bool InitRDLinkList(DLinkList &L);//初始化
bool iTail(DLinkList L,DNode *p);//判断节点p是不是循环双链表的表尾节点
bool InsertNextDNode(DNode *p,DNode *s);//在p节点之后插入s节点
bool DeleteNextDNode(DLinkList &L,DNode *p);//删除操作
/**定义模块**/
/**实现模块**/
//初始化
bool InitRDLinkList(DLinkList &L){
L=(DNode *)malloc(sizeof(DNode));//分配头节点
if (L==NULL)return false;
L->prior=L;
L->next=L;//循环抱住自己
return true;
}
//判断节点p是不是循环双链表的表尾节点
bool iTail(DLinkList L,DNode *p){
return (p->next==L);
}
//在p节点之后插入s节点
bool InsertNextDNode(DNode *p,DNode *s){
s->next=p->next;
p->next->prior=s;
s->prior=p;
p->next=s;
return true;
}
//删除操作
bool DeleteNextDNode(DLinkList &L,DNode *p){
DNode *q = p->next;
p->next=q->next;
q->next->prior=p;
free(q);
return true;
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
TestModule();
return 0;
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//循环双链表
#include <stdio.h>
#include <stdlib.h>
/**定义模块**/
typedef struct DNode{
int data;
struct DNode *prior,*next;
}DNode,*DLinkList;
//函数声明
bool InitRDLinkList(DLinkList &L);//初始化
bool iTail(DLinkList L,DNode *p);//判断节点p是不是循环双链表的表尾节点
bool InsertNextDNode(DNode *p,DNode *s);//在p节点之后插入s节点
bool DeleteNextDNode(DLinkList &L,DNode *p);//删除操作
/**定义模块**/
/**实现模块**/
//初始化
bool InitRDLinkList(DLinkList &L){
L=(DNode *)malloc(sizeof(DNode));//分配头节点
if (L==NULL)return false;
L->prior=L;
L->next=L;//循环抱住自己
return true;
}
//判断节点p是不是循环双链表的表尾节点
bool iTail(DLinkList L,DNode *p){
return (p->next==L);
}
//在p节点之后插入s节点
bool InsertNextDNode(DNode *p,DNode *s){
s->next=p->next;
p->next->prior=s;
s->prior=p;
p->next=s;
return true;
}
//删除操作
bool DeleteNextDNode(DLinkList &L,DNode *p){
DNode *q = p->next;
p->next=q->next;
q->next->prior=p;
free(q);
return true;
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
TestModule();
return 0;
}

View File

@@ -1,55 +1,55 @@
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//静态链表
#include <stdlib.h>
#include <stdlib.h>
#define MaxSize 10
/**定义模块**/
//第一种定义方法
struct Node0{
int data;
int next;
};
//第二种定义方法
typedef struct Node{
int data;
int next;
}SLinkList[MaxSize];
//相比之下,第二种方法可读性更强!,推荐
//函数声明
/**定义模块**/
/**实现模块**/
void testSLinkList(){
//声明时
struct Node0 a[MaxSize];
}
void TestSLinkList(){
//第二种方法声明时
SLinkList a;
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
//后续来填坑吧!!
TestModule();
return 0;
//
// Created by kim on 2020/6/20.
// Copyright (c) Kim Yang All rights reserved.
//
//静态链表
#include <stdlib.h>
#include <stdlib.h>
#define MaxSize 10
/**定义模块**/
//第一种定义方法
struct Node0{
int data;
int next;
};
//第二种定义方法
typedef struct Node{
int data;
int next;
}SLinkList[MaxSize];
//相比之下,第二种方法可读性更强!,推荐
//函数声明
/**定义模块**/
/**实现模块**/
void testSLinkList(){
//声明时
struct Node0 a[MaxSize];
}
void TestSLinkList(){
//第二种方法声明时
SLinkList a;
}
/**实现模块**/
/**测试模块**/
void TestModule(){
}
/**测试模块**/
int main(){
//后续来填坑吧!!
TestModule();
return 0;
}

View File

@@ -1,217 +1,217 @@
//
// Created by kim on 2020/6/21.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序栈的实现
#include <stdio.h>
/**定义模块**/
# define MaxSize 10
typedef struct {
int data[MaxSize];
int top;
} SqStack;
//函数声明
void InitStack(SqStack &S);//初始化
bool Push(SqStack &S, int t);//入栈
bool Pop(SqStack &S, int &x);//出栈,并打印出栈顶元素
bool GetTop(SqStack S, int &x);//读取栈顶元素
int GetTopOther(SqStack S);//读取栈顶元素的第二种实现方式
void InitStack1(SqStack &S);//初始化1
bool Push1(SqStack &S, int t);//入栈初始化1
bool Pop1(SqStack &S, int &x);//出栈,并打印出栈顶元素初始化1
bool GetTop1(SqStack S, int &x);//读取栈顶元素初始化1
int GetTopOther1(SqStack S);//读取栈顶元素的第二种实现方式
/**定义模块**/
/**实现模块**/
//初始化
void InitStack(SqStack &S) {
S.top = -1;//这种初始化的方式,栈顶指针始终指向栈顶元素
}
//初始化1
void InitStack1(SqStack &S) {
S.top = 0;//这种初始化方式,栈顶指针始终会指向栈顶元素的下一空元素
}
//入栈
bool Push(SqStack &S, int t) {
if (S.top == MaxSize - 1)return false;//栈满
S.data[++S.top] = t;
// 等价下面两个语句
// S.top+=1;//先将栈顶指针指向下一个位置
// S.data[S.top]=t;//再填充元素
return true;
}
//入栈初始化1
bool Push1(SqStack &S, int t) {
if (S.top == MaxSize)return false;//栈满,注意初始化条件不一样判空的条件也不一样了
S.data[S.top++] = t;
// 等价下面两个语句
// S.data[S.top]=t;
// S.top+=1;
//注意初始化方式不同,上边的顺序也不一样了,先填充元素,再移动指针
return true;
}
//出栈,并打印出栈顶元素
bool Pop(SqStack &S, int &x) {
//判断
if (S.top == -1)return false;//栈空报错
x = S.data[S.top--];
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top -=1;//再改指针
return true;
}
//出栈,并打印出栈顶元素初始化1
bool Pop1(SqStack &S, int &x) {
//判断
if (S.top == 0)return false;//栈空报错,注意判空条件
x = S.data[--S.top];
// 等价于下面
// S.top -=1;
// x=S.data[S.top];
//注意初始化方式不同,上边的顺序也不一样了,先将指针指向当前栈顶元素,再将其取出
return true;
}
//读取栈顶元素
bool GetTop(SqStack S, int &x) {
if (S.top == -1)return false;
x = S.data[S.top];
return true;
}
//读取栈顶元素初始化1
bool GetTop1(SqStack S, int &x) {
if (S.top == 0)return false;
x = S.data[S.top - 1];//注意按初始化1的方式这里指针减1才是栈顶元素的位置
// 同时注意不能使用--S.top,因为这里是读取,不可修改原栈,所以不可和出栈一样
//但即时这里你错误使用了--S.top也不会有问题因为此处的S是值传递非引用传递所以你修改的也只是复制之后的S不会影响原栈S即时这样也不建议使用--S.top如果老师较真的话可以扣分哒
return true;
}
//读取栈顶元素的第二种实现方式
//利用返回值返回栈顶元素,若成功就返回栈顶元素,失败就返回-1
//缺点:如果栈顶元素就是-1容易造成误判正因它的缺点如果考试考到了它写这种方式应该是会被扣部分分数的
int GetTopOther(SqStack S) {
if (S.top == -1)return -1;
return S.data[S.top];
}
int GetTopOther1(SqStack S) {
if (S.top == 0)return -1;
return S.data[S.top - 1];
}
/**实现模块**/
/**测试模块**/
//打印整个栈
void PrintStack(SqStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top >= 0) {//注意判空的条件
printf("S[%d]=%d\n", S.top, S.data[S.top--]);
}
printf("栈打印完毕\n");
}
//打印整个栈初始化方式1
void PrintStack1(SqStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top > 0) {//注意判空的条件
printf("S1[%d]=%d\n", S.top - 1, S.data[--S.top]);//初始化方式1得先移动指针再获取元素
}
printf("栈打印完毕\n");
}
void testStack() {
printf("开始测试\n");
SqStack S;
printf("测试第一种初始化方式\n");
InitStack(S);
if (Push(S, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push(S, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack(S);
int x;
if (Pop(S, x)) {
printf("出栈成功,弹出的元素为:%d\n", x);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack(S);
int x1;
if (GetTop(S, x1)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x1);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
int x4 = GetTopOther(S);
if (x4 != -1) {
printf("第二种读取栈顶元素的方式成功了,栈顶元素为:%d\n", x4);
} else {
printf("第二种读取栈顶元素的方式失败了\n");
}
printf("测试第二种初始化方式\n");
SqStack S1;
InitStack1(S1);
if (Push1(S1, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push1(S1, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack1(S1);
int x2;
if (Pop1(S1, x2)) {
printf("出栈成功,弹出的元素为[%d]\n", x2);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack1(S1);
int x3;
if (GetTop1(S1, x3)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x3);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
int x5 = GetTopOther1(S1);
if (x5 != -1) {
printf("第二种读取栈顶元素的方式成功了,栈顶元素为:%d\n", x5);
} else {
printf("第二种读取栈顶元素的方式失败了\n");
}
printf("测试完毕了!\n");
}
/**测试模块**/
int main() {
printf("Hello, SqStack!");
testStack();
return 0;
//
// Created by kim on 2020/6/21.
// Copyright (c) Kim Yang All rights reserved.
//
//顺序栈的实现
#include <stdio.h>
/**定义模块**/
# define MaxSize 10
typedef struct {
int data[MaxSize];
int top;
} SqStack;
//函数声明
void InitStack(SqStack &S);//初始化
bool Push(SqStack &S, int t);//入栈
bool Pop(SqStack &S, int &x);//出栈,并打印出栈顶元素
bool GetTop(SqStack S, int &x);//读取栈顶元素
int GetTopOther(SqStack S);//读取栈顶元素的第二种实现方式
void InitStack1(SqStack &S);//初始化1
bool Push1(SqStack &S, int t);//入栈初始化1
bool Pop1(SqStack &S, int &x);//出栈,并打印出栈顶元素初始化1
bool GetTop1(SqStack S, int &x);//读取栈顶元素初始化1
int GetTopOther1(SqStack S);//读取栈顶元素的第二种实现方式
/**定义模块**/
/**实现模块**/
//初始化
void InitStack(SqStack &S) {
S.top = -1;//这种初始化的方式,栈顶指针始终指向栈顶元素
}
//初始化1
void InitStack1(SqStack &S) {
S.top = 0;//这种初始化方式,栈顶指针始终会指向栈顶元素的下一空元素
}
//入栈
bool Push(SqStack &S, int t) {
if (S.top == MaxSize - 1)return false;//栈满
S.data[++S.top] = t;
// 等价下面两个语句
// S.top+=1;//先将栈顶指针指向下一个位置
// S.data[S.top]=t;//再填充元素
return true;
}
//入栈初始化1
bool Push1(SqStack &S, int t) {
if (S.top == MaxSize)return false;//栈满,注意初始化条件不一样判空的条件也不一样了
S.data[S.top++] = t;
// 等价下面两个语句
// S.data[S.top]=t;
// S.top+=1;
//注意初始化方式不同,上边的顺序也不一样了,先填充元素,再移动指针
return true;
}
//出栈,并打印出栈顶元素
bool Pop(SqStack &S, int &x) {
//判断
if (S.top == -1)return false;//栈空报错
x = S.data[S.top--];
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top -=1;//再改指针
return true;
}
//出栈,并打印出栈顶元素初始化1
bool Pop1(SqStack &S, int &x) {
//判断
if (S.top == 0)return false;//栈空报错,注意判空条件
x = S.data[--S.top];
// 等价于下面
// S.top -=1;
// x=S.data[S.top];
//注意初始化方式不同,上边的顺序也不一样了,先将指针指向当前栈顶元素,再将其取出
return true;
}
//读取栈顶元素
bool GetTop(SqStack S, int &x) {
if (S.top == -1)return false;
x = S.data[S.top];
return true;
}
//读取栈顶元素初始化1
bool GetTop1(SqStack S, int &x) {
if (S.top == 0)return false;
x = S.data[S.top - 1];//注意按初始化1的方式这里指针减1才是栈顶元素的位置
// 同时注意不能使用--S.top,因为这里是读取,不可修改原栈,所以不可和出栈一样
//但即时这里你错误使用了--S.top也不会有问题因为此处的S是值传递非引用传递所以你修改的也只是复制之后的S不会影响原栈S即时这样也不建议使用--S.top如果老师较真的话可以扣分哒
return true;
}
//读取栈顶元素的第二种实现方式
//利用返回值返回栈顶元素,若成功就返回栈顶元素,失败就返回-1
//缺点:如果栈顶元素就是-1容易造成误判正因它的缺点如果考试考到了它写这种方式应该是会被扣部分分数的
int GetTopOther(SqStack S) {
if (S.top == -1)return -1;
return S.data[S.top];
}
int GetTopOther1(SqStack S) {
if (S.top == 0)return -1;
return S.data[S.top - 1];
}
/**实现模块**/
/**测试模块**/
//打印整个栈
void PrintStack(SqStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top >= 0) {//注意判空的条件
printf("S[%d]=%d\n", S.top, S.data[S.top--]);
}
printf("栈打印完毕\n");
}
//打印整个栈初始化方式1
void PrintStack1(SqStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top > 0) {//注意判空的条件
printf("S1[%d]=%d\n", S.top - 1, S.data[--S.top]);//初始化方式1得先移动指针再获取元素
}
printf("栈打印完毕\n");
}
void testStack() {
printf("开始测试\n");
SqStack S;
printf("测试第一种初始化方式\n");
InitStack(S);
if (Push(S, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push(S, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack(S);
int x;
if (Pop(S, x)) {
printf("出栈成功,弹出的元素为:%d\n", x);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack(S);
int x1;
if (GetTop(S, x1)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x1);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
int x4 = GetTopOther(S);
if (x4 != -1) {
printf("第二种读取栈顶元素的方式成功了,栈顶元素为:%d\n", x4);
} else {
printf("第二种读取栈顶元素的方式失败了\n");
}
printf("测试第二种初始化方式\n");
SqStack S1;
InitStack1(S1);
if (Push1(S1, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push1(S1, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack1(S1);
int x2;
if (Pop1(S1, x2)) {
printf("出栈成功,弹出的元素为[%d]\n", x2);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack1(S1);
int x3;
if (GetTop1(S1, x3)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x3);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
int x5 = GetTopOther1(S1);
if (x5 != -1) {
printf("第二种读取栈顶元素的方式成功了,栈顶元素为:%d\n", x5);
} else {
printf("第二种读取栈顶元素的方式失败了\n");
}
printf("测试完毕了!\n");
}
/**测试模块**/
int main() {
printf("Hello, SqStack!");
testStack();
return 0;
}

View File

@@ -1,178 +1,178 @@
//
// Created by kim on 2020/7/28.
// Copyright (c) Kim Yang All rights reserved.
//
//共享顺序栈的实现
//简单来说就是两个栈共享一片存储空间,提高顺序栈的对存储空间的使用率
#include <stdio.h>
/**定义模块**/
# define MaxSize 10
typedef struct {
int data[MaxSize];
int top0;
int top1;
} ShStack;
//从结构体的定义就可以看出来,两个共享栈的根源就在于定义两个指针
//函数声明
void InitStack(ShStack &S);//初始化
bool Push0(ShStack &S, int t);//入栈0
bool Push1(ShStack &S, int t);//入栈1
bool Pop0(ShStack &S, int &x);//出栈,并打印出栈顶元素
bool Pop1(ShStack &S, int &x);//出栈1
bool GetTop0(ShStack S, int &x);//读取栈顶元素栈0
bool GetTop1(ShStack S, int &x);//栈1
/**定义模块**/
/**实现模块**/
//初始化
void InitStack(ShStack &S) {
S.top0 = -1;//这种初始化的方式,栈顶指针始终指向栈顶元素
S.top1 = MaxSize;//这里的MaxSize就是所谓的第二个栈的栈底
//可以根据顺序栈的第二种初试化方式,思考一下这种共享顺序栈的第二种初始化方式
//S.top0=0
//S.top1=MaxSize-1
}
//入栈0
bool Push0(ShStack &S, int t) {
if (S.top0 + 1 == S.top1)return false;//注意共享栈满的条件
S.data[++S.top0] = t;//仔细品味一下这个++S.top
return true;
}
//入栈1
bool Push1(ShStack &S, int t) {
if (S.top0 + 1 == S.top1)return false;//注意共享栈满的条件
S.data[--S.top1] = t;//仔细品味一下这个--S.top想想为什么
return true;
}
//出栈,并打印出栈顶元素
bool Pop0(ShStack &S, int &x) {
//判断
if (S.top0 == -1)return false;//栈空报错
x = S.data[S.top0--];
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top -=1;//再改指针
return true;
}
//出栈1
bool Pop1(ShStack &S, int &x) {
//判断
if (S.top1 == MaxSize)return false;//注意一下它的栈空报错条件
x = S.data[S.top1++];//注意这个栈修改指针是++
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top +=1;//再改指针
return true;
}
//读取栈顶元素栈0
bool GetTop0(ShStack S, int &x) {
if (S.top0 == -1)return false;
x = S.data[S.top0];
return true;
}
//栈1
bool GetTop1(ShStack S, int &x) {
if (S.top1 == MaxSize)return false;
x = S.data[S.top1];
return true;
}
/**实现模块**/
/**测试模块**/
//打印整个栈,栈0
void PrintStack0(ShStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top0 > -1) {//注意判空的条件
printf("S[%d]=%d\n", S.top0, S.data[S.top0--]);
}
printf("栈打印完毕\n");
}
//打印整个栈
void PrintStack1(ShStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top1 < MaxSize) {//注意判空的条件
printf("S[%d]=%d\n", S.top1, S.data[S.top1++]);
}
printf("栈打印完毕\n");
}
void testShStack() {
printf("开始测试\n");
ShStack S;
InitStack(S);
printf("测试第一个栈\n");
if (Push0(S, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push0(S, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack0(S);
int x;
if (Pop0(S, x)) {
printf("出栈成功,弹出的元素为:%d\n", x);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack0(S);
int x1;
if (GetTop0(S, x1)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x1);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
printf("测试第二个栈\n");
if (Push1(S, 10)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push1(S, 9)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack1(S);
int x3;
if (Pop1(S, x3)) {
printf("出栈成功,弹出的元素为:%d\n", x3);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack1(S);
int x4;
if (GetTop1(S, x4)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x4);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
printf("测试完毕了!\n");
}
/**测试模块**/
int main() {
printf("Hello, ShStack!");
testShStack();
return 0;
//
// Created by kim on 2020/7/28.
// Copyright (c) Kim Yang All rights reserved.
//
//共享顺序栈的实现
//简单来说就是两个栈共享一片存储空间,提高顺序栈的对存储空间的使用率
#include <stdio.h>
/**定义模块**/
# define MaxSize 10
typedef struct {
int data[MaxSize];
int top0;
int top1;
} ShStack;
//从结构体的定义就可以看出来,两个共享栈的根源就在于定义两个指针
//函数声明
void InitStack(ShStack &S);//初始化
bool Push0(ShStack &S, int t);//入栈0
bool Push1(ShStack &S, int t);//入栈1
bool Pop0(ShStack &S, int &x);//出栈,并打印出栈顶元素
bool Pop1(ShStack &S, int &x);//出栈1
bool GetTop0(ShStack S, int &x);//读取栈顶元素栈0
bool GetTop1(ShStack S, int &x);//栈1
/**定义模块**/
/**实现模块**/
//初始化
void InitStack(ShStack &S) {
S.top0 = -1;//这种初始化的方式,栈顶指针始终指向栈顶元素
S.top1 = MaxSize;//这里的MaxSize就是所谓的第二个栈的栈底
//可以根据顺序栈的第二种初试化方式,思考一下这种共享顺序栈的第二种初始化方式
//S.top0=0
//S.top1=MaxSize-1
}
//入栈0
bool Push0(ShStack &S, int t) {
if (S.top0 + 1 == S.top1)return false;//注意共享栈满的条件
S.data[++S.top0] = t;//仔细品味一下这个++S.top
return true;
}
//入栈1
bool Push1(ShStack &S, int t) {
if (S.top0 + 1 == S.top1)return false;//注意共享栈满的条件
S.data[--S.top1] = t;//仔细品味一下这个--S.top想想为什么
return true;
}
//出栈,并打印出栈顶元素
bool Pop0(ShStack &S, int &x) {
//判断
if (S.top0 == -1)return false;//栈空报错
x = S.data[S.top0--];
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top -=1;//再改指针
return true;
}
//出栈1
bool Pop1(ShStack &S, int &x) {
//判断
if (S.top1 == MaxSize)return false;//注意一下它的栈空报错条件
x = S.data[S.top1++];//注意这个栈修改指针是++
// 等价于下面
// x=S.data[S.top];//先取元素
// S.top +=1;//再改指针
return true;
}
//读取栈顶元素栈0
bool GetTop0(ShStack S, int &x) {
if (S.top0 == -1)return false;
x = S.data[S.top0];
return true;
}
//栈1
bool GetTop1(ShStack S, int &x) {
if (S.top1 == MaxSize)return false;
x = S.data[S.top1];
return true;
}
/**实现模块**/
/**测试模块**/
//打印整个栈,栈0
void PrintStack0(ShStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top0 > -1) {//注意判空的条件
printf("S[%d]=%d\n", S.top0, S.data[S.top0--]);
}
printf("栈打印完毕\n");
}
//打印整个栈
void PrintStack1(ShStack S) {
printf("从栈顶元素开始,栈如下:\n");
while (S.top1 < MaxSize) {//注意判空的条件
printf("S[%d]=%d\n", S.top1, S.data[S.top1++]);
}
printf("栈打印完毕\n");
}
void testShStack() {
printf("开始测试\n");
ShStack S;
InitStack(S);
printf("测试第一个栈\n");
if (Push0(S, 1)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push0(S, 2)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack0(S);
int x;
if (Pop0(S, x)) {
printf("出栈成功,弹出的元素为:%d\n", x);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack0(S);
int x1;
if (GetTop0(S, x1)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x1);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
printf("测试第二个栈\n");
if (Push1(S, 10)) {
printf("入栈成功啦!\n");
} else {
printf("入栈失败了\n");
}
if (Push1(S, 9)) {
printf("入栈又成功啦!\n");
} else {
printf("入栈又失败了\n");
}
PrintStack1(S);
int x3;
if (Pop1(S, x3)) {
printf("出栈成功,弹出的元素为:%d\n", x3);
} else {
printf("出栈失败了,再检出一下吧!\n");
}
PrintStack1(S);
int x4;
if (GetTop1(S, x4)) {
printf("读取栈顶元素成功了,栈顶元素为:%d\n", x4);
} else {
printf("读取栈顶元素失败,再检查一下吧!\n");
}
printf("测试完毕了!\n");
}
/**测试模块**/
int main() {
printf("Hello, ShStack!");
testShStack();
return 0;
}

Some files were not shown because too many files have changed in this diff Show More