Python算法
Python算法
一、排序
1.冒泡排序
1 | def buble_sort(num): |
2.选择排序
1 | def select_sort(num): |
3.插入排序
1 | def insert_sort(num): |
4.快速排序
1 | def quick_sort(num): |
5.归并排序
1 | def merge_sort(num): |
6.python排序
1 | num = [5,2,3,6,8,9] |
二、查找算法
1.顺序查找
1 | def linear_search(nums, x): |
2.二分查找
1 | def binary_search(arr, x): |
3.哈希查找
1 | def hash_search(arr, target): |
三、字符串匹配
1.kmp算法
1 | def kmp_match(s, p): |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.