Data structure and algorithm in python3
《数据结构与算法-python语言描述》
作者:裘宗燕
数据结构可视化https://visualgo.net
ps.例子存在问题,有以下几个可能:
- 书上代码没给全,只描述了**,无法运行测试,查看结果
- 书上代码运行时,部分报错
- 我在学习时,部分代码没有理解或者读懂,无法运行测试,后续可能订正
- Introduction
第一章的示例代码
- Linear list
线性表和链表- samples:
本部分应用例子
- samples:
- String
字符串的匹配,KMP算法
- Stack and Queue
栈和队列- samples
本部分应用例子(某些例子存在问题,后续可能修正)
- samples
- Tree
二叉树与树- samples
本部分应用例子(某些例子存在问题,后续可能修正)
- samples
- Graph
图(本章节较为困难,以后再进行修正补充)
- Dictionary and collection
字典和集合(本章节较为困难,以后再进行修正补充)
- Sort
名称 | 最坏时间 | 最好时间 | 平均时间 | 类型 |
---|---|---|---|---|
插入排序(insert_sort) | O(n^2) | O(n) | O(n^2) | 稳定算法 |
冒泡排序(bubble_sort) | O(n^2) | O(n) | O(n^2) | 稳定算法 |
选择排序(select_sort) | O(n^2) | O(n) | O(n^2) | 不稳定算法 |
快速排序(quick_sort) | O(n^2) | O(n*logn) | O(n*logn) | 不稳定算法 |
归并排序(merge_sort) | O(n*logn) | O(n*logn) | O(n*logn) | 稳定算法 |
基数排序(radix_sort) | O(nlog(r)m) | O(nlog(r)m) | O(nlog(r)m) | 稳定算法 |