mirror of
https://github.com/heqin-zhu/algorithm.git
synced 2024-03-22 13:30:46 +08:00
Add license and bages, change urls
This commit is contained in:
parent
b6805c66ce
commit
b69b5641d0
12
LICENSE
Normal file
12
LICENSE
Normal file
|
@ -0,0 +1,12 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
|
||||
Copyright (C) 2019 Heqin Zhu <zhuheqin1@gmail.com>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
15
README.md
15
README.md
|
@ -1,5 +1,13 @@
|
|||
|
||||
# Algorithm
|
||||
# Algorithm and data structures
|
||||
|
||||
[![Stars](https://img.shields.io/github/stars/mbinary/algorithm-in-python.svg?label=Stars&style=social)](https://github.com/mbinary/algorithm-in-python/stargazers)
|
||||
[![Forks](https://img.shields.io/github/forks/mbinary/algorithm-in-python.svg?label=Fork&style=social)](https://github.com/mbinary/algorithm-in-python/network/members)
|
||||
[![repo-size](https://img.shields.io/github/repo-size/mbinary/algorithm-in-python.svg)]()
|
||||
[![License](https://img.shields.io/badge/LICENSE-WTFPL-blue.svg)](LICENSE)
|
||||
[![Language](https://img.shields.io/badge/language-python3-orange.svg)]()
|
||||
<!-- [![Build](https://travis-ci.org/mbinary/PL0-compiler.svg?branch=master)]() -->
|
||||
|
||||
>Notes and codes for learning algorithm and data structures :smiley:
|
||||
|
||||
Some pictures and ideas are from `<<Introduction to Algotithm>>`
|
||||
|
@ -7,10 +15,11 @@ Some pictures and ideas are from `<<Introduction to Algotithm>>`
|
|||
I use python 3.6+ and c/c++ to implement them.
|
||||
|
||||
# Notice
|
||||
Currently, Github can't render latex math formulas.Thus,if you want to view the markodwn notes which contain latex math formulas, you can visit [my blog](https://mbinary.coding.me)
|
||||
Currently, Github can't render latex math formulas.Thus,if you want to view the markodwn notes which contain latex math formulas, you can visit [my blog](https://mbinary.xyz)
|
||||
|
||||
# Index
|
||||
* [.](.)
|
||||
* [LICENSE](./LICENSE)
|
||||
* [README.md](./README.md)
|
||||
* [backtracking](./backtracking)
|
||||
* [dataStructure](./dataStructure)
|
||||
|
@ -74,6 +83,7 @@ Currently, Github can't render latex math formulas.Thus,if you want to view the
|
|||
* [binary_search.hs](./search/binary_search.hs)
|
||||
* [bloomFilter.py](./search/bloomFilter.py)
|
||||
* [schedule.py](./search/schedule.py)
|
||||
* [work_dispatch.py](./search/work_dispatch.py)
|
||||
* [sort](./sort)
|
||||
* [binaryTree.py](./sort/binaryTree.py)
|
||||
* [heapSort.py](./sort/heapSort.py)
|
||||
|
@ -88,6 +98,7 @@ Currently, Github can't render latex math formulas.Thus,if you want to view the
|
|||
* [manacher.py](./string/manacher.py)
|
||||
* [markov.py](./string/markov.py)
|
||||
* [rabin_karp.py](./string/rabin_karp.py)
|
||||
* [rotate.py](./string/rotate.py)
|
||||
* [src](./string/src)
|
||||
* [sunday.py](./string/sunday.py)
|
||||
* [wildcard_matching.py](./string/wildcard_matching.py)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : allOoneDS.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:07
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : testAllOne.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:07
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : bTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-08-29 12:49
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : binaryHeap.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : binaryTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:07
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : adjacentList.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-26 10:33
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : directed.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-26 10:33
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : graph.cc
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-26 10:33
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : undirected.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-26 10:33
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : hashTable.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-08 16:39
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : huffman.cc
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-25 22:32
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : intervalTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-18 10:48
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : leftHeap.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : loserTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : map.cc
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-04-26 10:33
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : polynomial.cpp
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:07
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : polynomial.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:07
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : redBlackTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-14 16:15
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : redBlackTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-14 16:15
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : splayTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : mapSum.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-14 23:11
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : maxXor.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-22 09:51
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : trie.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : accountsMerge.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-18 17:07
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : unionFind.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-18 14:53
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : winnerTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : min_distance_of_n_points.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-24 22:03
|
||||
# Description:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# 算法笔记
|
||||
>注意, 目前 github 上的文档不支持 latex 数学公式渲染
|
||||
所以如果想有较好的阅读体验, 可以移步到[我的博客](https://mbinary.coding.me)
|
||||
所以如果想有较好的阅读体验, 可以移步到[我的博客](https://mbinary.xyz)
|
||||
|
||||
# 索引
|
||||
* [.](.)
|
||||
|
|
|
@ -52,7 +52,7 @@ description:
|
|||
性质:
|
||||
$h\leq \left\lfloor \log _{d}\left({\frac {n+1}{2}}\right)\right\rfloor .$
|
||||
|
||||
如下是 度为2的 B 树, 每个结点可能有2,3或4 个孩子, 所以也叫 2,3,4树, 等价于[红黑树](https://mbinary.coding.me/red-black-tree.html#more)
|
||||
如下是 度为2的 B 树, 每个结点可能有2,3或4 个孩子, 所以也叫 2,3,4树, 等价于[红黑树](https://mbinary.xyz/red-black-tree.html#more)
|
||||
![](https://upload-images.jianshu.io/upload_images/7130568-30342360fb9674b4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
|
||||
|
||||
<a id="markdown-3-查找操作" name="3-查找操作"></a>
|
||||
|
|
|
@ -75,7 +75,7 @@ description:
|
|||
|
||||
<a id="markdown-13-树" name="13-树"></a>
|
||||
## 1.3. 树
|
||||
无圈连通图, $E = V-1$, 详细见[树](https://mbinary.coding.me/tree.html),
|
||||
无圈连通图, $E = V-1$, 详细见[树](https://mbinary.xyz/tree.html),
|
||||
|
||||
<a id="markdown-2-搜索" name="2-搜索"></a>
|
||||
# 2. 搜索
|
||||
|
@ -196,7 +196,7 @@ while not que.isempty():
|
|||
* 设置结点的 minAdjEdge, 需要$O(lgv)$, 循环 E 次,则 总共$O(ElgV)$
|
||||
|
||||
综上, 时间复杂度为$O(ElgV)$
|
||||
如果使用的是 [斐波那契堆](https://mbinary.coding.me/fib-heap.html), 则可改进到 $O(E+VlgV)$
|
||||
如果使用的是 [斐波那契堆](https://mbinary.xyz/fib-heap.html), 则可改进到 $O(E+VlgV)$
|
||||
|
||||
<a id="markdown-4-单源最短路" name="4-单源最短路"></a>
|
||||
# 4. 单源最短路
|
||||
|
|
|
@ -383,7 +383,7 @@ def find(root,i):
|
|||
# File : redBlackTree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-14 16:15
|
||||
# Description:
|
||||
|
|
|
@ -215,7 +215,7 @@ Aho-Corasick automation,是在字典树上添加匹配失败边(失配指针),
|
|||
|
||||
<a id="markdown-54-treap" name="54-treap"></a>
|
||||
## 5.4. treap
|
||||
[前面提到](#21-随机构造的二叉查找树), 随机构造的二叉查找树高度为 $h=O(logn)$,以及在[算法 general](https://mbinary.coding.me/alg-genral.html) 中说明了怎样 随机化(shuffle)一个给定的序列.
|
||||
[前面提到](#21-随机构造的二叉查找树), 随机构造的二叉查找树高度为 $h=O(logn)$,以及在[算法 general](https://mbinary.xyz/alg-genral.html) 中说明了怎样 随机化(shuffle)一个给定的序列.
|
||||
|
||||
所以,为了得到一个平衡的二叉排序树,我们可以将给定的序列随机化, 然后再进行构造二叉排序树.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : lcs.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-08-25 12:00
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : matrixChainMultiply.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-05 19:09
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : splitStripe.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-08-24 17:07
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : stoneGame.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-14 14:32
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : wildcard_matching.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-13 22:46
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : isBipartGraph.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-21 15:00
|
||||
# Description: Judge if a graph is bipartite
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Number Theory
|
||||
>See more details on [my blog](https://mbinary.coding.me/number-theory.html)
|
||||
>See more details on [my blog](https://mbinary.xyz/number-theory.html)
|
||||
|
||||
## gcd.py
|
||||
- gcd(a,b)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : num_weight.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 21:36
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : fastPow.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-17 21:39
|
||||
# Description: fast power
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : euler.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-16 10:53
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : factorize.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-16 09:36
|
||||
# Description: factorization, using pollard's rho algorithm and miller-rabin primality test
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : gcd.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-16 10:06
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : hammingDistance.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-17 17:36
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : isPrime.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-03-04 21:34
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : modulo_equation.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-3-4 21:14
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : interplotion.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
@ -14,7 +14,7 @@
|
|||
# File : interplotion.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.github.io
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-18 09:29
|
||||
# Description: 插值计算,有牛顿插值,拉格朗日插值,以及通过插值得到的多项式估计新的函数值
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : iteration.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : least_square.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
@ -15,7 +15,7 @@
|
|||
> Author: mbinary
|
||||
> Mail: zhuheqin1@gmail.com
|
||||
> Created Time: Sat 07 Apr 2018 09:55:25 PM DST
|
||||
> Blog: https://mbinary.github.io
|
||||
> Blog: https://mbinary.xyz
|
||||
> Description: 最小二乘法解线性方程组, 解矛盾方程组
|
||||
************************************************************************'''
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : linear_equation.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
@ -15,7 +15,7 @@
|
|||
> File Name: doolittle.py
|
||||
> Author: mbinary
|
||||
> Mail: zhuheqin1@gmail.com
|
||||
> Blog: https://mbinary.github.io
|
||||
> Blog: https://mbinary.xyz
|
||||
> Created Time: 2018-04-20 08:32
|
||||
************************************************************************'''
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : numerical_differential.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : numerical_integration.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
@ -15,7 +15,7 @@
|
|||
# File : numerical integration.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.github.io
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-11 08:58
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : solve-linear-by-iteration.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
@ -15,7 +15,7 @@
|
|||
# File : solve-linear-by-iteration.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.github.io
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-04 07:42
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : vector_norm.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-02 21:14
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : permute_back_track.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-25 12:32
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : permute_cantor.c
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-17 11:25
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : permute_divide_and_conquer.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-25 12:23
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : permute_next_permutation.c
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-17 14:31
|
||||
# Description: support duplicate values.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : 8Astar.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 23:06
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : BFS_knight.hs
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-11 19:40
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : bloomFilter.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-10-17 11:19
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : schedule.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-11-30 12:00
|
||||
# Description:
|
||||
|
|
37
search/work_dispatch.py
Normal file
37
search/work_dispatch.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
'''
|
||||
设有n件工作要分配给n个人去完成,将工作i分配给第j个人所需费用为c_ij 。试设计一个算法,为每个人分配1件不同的工作,并使总费用达到最小。
|
||||
'''
|
||||
def dispatch(mat):
|
||||
'''mat: matrix of c_ij'''
|
||||
def _util(i,arrange,cost):
|
||||
''' for i-th work'''
|
||||
nonlocal total,used,rst
|
||||
if i==n:
|
||||
total=cost
|
||||
rst = arrange.copy() # copy is needed
|
||||
else:
|
||||
for j in range(n):
|
||||
if not used[j] and( total is None or cost+mat[i][j]<total):
|
||||
used[j]=True
|
||||
arrange[i] = j
|
||||
_util(i+1,arrange,cost+mat[i][j])
|
||||
used[j]=False
|
||||
total = None
|
||||
rst = None
|
||||
n = len(mat)
|
||||
used = [False for i in range(n)]
|
||||
_util(0,[-1]*n,0)
|
||||
return total,rst
|
||||
|
||||
|
||||
import random
|
||||
if __name__=='__main__':
|
||||
n = 10
|
||||
mat = [[random.randint(1,100) for i in range(n)] for i in range(n)]
|
||||
print('work matrix: c_ij: work_i and person_j')
|
||||
for i in range(n):
|
||||
print(mat[i])
|
||||
print('result: ',end='')
|
||||
print(dispatch(mat))
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
# File : sort.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-05 17:18
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : heapSort.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-05 16:24
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : quickSort.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 10:31
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : radixSort.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 15:52
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : select.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 17:13
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : shellSort.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 16:30
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : KMP.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-11 14:02
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : manacher.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 15:56
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : markov.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-06 15:57
|
||||
# Description:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : rabin_karp.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-11 00:01
|
||||
# Description: rabin-karp algorithm
|
||||
|
|
112
string/rotate.py
Normal file
112
string/rotate.py
Normal file
|
@ -0,0 +1,112 @@
|
|||
''' mbinary
|
||||
#########################################################################
|
||||
# File : rotate.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-05-19 21:54
|
||||
# Description: three methods of rotating a list
|
||||
|
||||
1. 利用 ba=(br)^T(ar)^T=(arbr)^T,通过三次反转字符串: 即首先对序列前部分逆序,再对序列后部分逆序,再对整个序列全部逆序
|
||||
|
||||
2. 分组交换(尽可能使数组的前面连续几个数为所要结果):a长度大于b,将 ab 分成 a0a1b,交换 a0 和 b,得 ba1a0,只需再交换 a1和 a0。若 a 长度小于 b,将 ab 分成 ab0b1,交换 a 和 b0,得 b0ab1,只需再交换 a 和b0。通过不断将数组划分,和交换,直到不能再划分为止。分组过程与求最大公约数很相似。
|
||||
|
||||
3.所有序号为 (j+i*m) % n (j 表示每个循环链起始位置,i 为计数变量,m 表示左旋转位数,n 表示字符串长度),会构成一个循环链(共有 gcd(n,m)个,gcd 为 n、m 的最大公约数),每个循环链上的元素只要移动一个位置即可,最后整个过程总共交换了 n 次(每一次循环链,是交换 n/gcd(n,m)次,总共 gcd(n,m)个循环链。所以,总共交换 n 次)。
|
||||
|
||||
#########################################################################
|
||||
'''
|
||||
|
||||
def rotate(s,k,right=False):
|
||||
def reverse(a,b):
|
||||
while a<b:
|
||||
s[a],s[b]=s[b],s[a]
|
||||
a+=1
|
||||
b-=1
|
||||
n=len(s)
|
||||
k = k%n if not right else n-k%n
|
||||
reverse(0,k-1)
|
||||
reverse(k,n-1)
|
||||
reverse(0,n-1)
|
||||
return s
|
||||
|
||||
|
||||
|
||||
def rotate2(s,k,right=False):
|
||||
def swap(a,b,c):
|
||||
for i in range(c):
|
||||
s[a+i],s[b+i] = s[b+i],s[a+i]
|
||||
def _rot(pl,pr):
|
||||
''' swap s[pl,pr) , s[pr:]'''
|
||||
if pr==n:return
|
||||
if pr-pl<=n-pr:
|
||||
swap(pl,pr,pr-pl)
|
||||
_rot(pr,2*pr-pl)
|
||||
else:
|
||||
swap(pl,pr,n-pr)
|
||||
_rot(n-pr+pl,pr)
|
||||
n=len(s)
|
||||
k = k%n if not right else n-k%n
|
||||
_rot(0,k)
|
||||
return s
|
||||
|
||||
|
||||
|
||||
def rotate3(s,k,right=False):
|
||||
def gcd(a,b):
|
||||
if b==0:return a
|
||||
return gcd(b,a%b)
|
||||
|
||||
n=len(s)
|
||||
k = k%n if not right else n-k%n
|
||||
r=gcd(n,k)
|
||||
for i in range(r):
|
||||
tmp = s[i]
|
||||
j = (i+k)%n
|
||||
while j!=i:
|
||||
s[j-k] = s[j]
|
||||
j = (j+k)%n
|
||||
s[(j-k+n)%n] = tmp
|
||||
return s
|
||||
|
||||
|
||||
def test():
|
||||
def f(func,*args,right=False):
|
||||
print(' '.join(['testing:',func.__name__,str(args),'right=',str(right)]))
|
||||
rst = func(*args,right=right)
|
||||
print('result',rst)
|
||||
print()
|
||||
return f
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
s=[i for i in range(10)]
|
||||
tester= test()
|
||||
tester(rotate,s,4,right=True)
|
||||
tester(rotate,s,4)
|
||||
tester(rotate2,s,2,right=True)
|
||||
tester(rotate2,s,2)
|
||||
tester(rotate3,s,132,right=True)
|
||||
tester(rotate3,s,132)
|
||||
|
||||
|
||||
'''
|
||||
testing: rotate ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4) right= True
|
||||
result [6, 7, 8, 9, 0, 1, 2, 3, 4, 5]
|
||||
|
||||
testing: rotate ([6, 7, 8, 9, 0, 1, 2, 3, 4, 5], 4) right= False
|
||||
result [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
testing: rotate2 ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2) right= True
|
||||
result [8, 9, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||
|
||||
testing: rotate2 ([8, 9, 0, 1, 2, 3, 4, 5, 6, 7], 2) right= False
|
||||
result [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
testing: rotate3 ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 132) right= True
|
||||
result [8, 9, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||
|
||||
testing: rotate3 ([8, 9, 0, 1, 2, 3, 4, 5, 6, 7], 132) right= False
|
||||
result [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
'''
|
|
@ -3,7 +3,7 @@
|
|||
# File : sunday.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-11 15:26
|
||||
# Description: 字符串模式匹配, sunday 算法, kmp 的改进
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# File : wildcard_matching.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-13 22:46
|
||||
# Description:
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
README = r'''
|
||||
# Algorithm
|
||||
# Algorithm and data structures
|
||||
|
||||
[![Stars](https://img.shields.io/github/stars/mbinary/algorithm-in-python.svg?label=Stars&style=social)](https://github.com/mbinary/algorithm-in-python/stargazers)
|
||||
[![Forks](https://img.shields.io/github/forks/mbinary/algorithm-in-python.svg?label=Fork&style=social)](https://github.com/mbinary/algorithm-in-python/network/members)
|
||||
[![repo-size](https://img.shields.io/github/repo-size/mbinary/algorithm-in-python.svg)]()
|
||||
[![License](https://img.shields.io/badge/LICENSE-WTFPL-blue.svg)](LICENSE)
|
||||
[![Language](https://img.shields.io/badge/language-python3-orange.svg)]()
|
||||
<!-- [![Build](https://travis-ci.org/mbinary/PL0-compiler.svg?branch=master)]() -->
|
||||
|
||||
>Notes and codes for learning algorithm and data structures :smiley:
|
||||
|
||||
Some pictures and ideas are from `<<Introduction to Algotithm>>`
|
||||
|
@ -7,7 +15,7 @@ Some pictures and ideas are from `<<Introduction to Algotithm>>`
|
|||
I use python 3.6+ and c/c++ to implement them.
|
||||
|
||||
# Notice
|
||||
Currently, Github can't render latex math formulas.Thus,if you want to view the markodwn notes which contain latex math formulas, you can visit [my blog](https://mbinary.coding.me)
|
||||
Currently, Github can't render latex math formulas.Thus,if you want to view the markodwn notes which contain latex math formulas, you can visit [my blog](https://mbinary.xyz)
|
||||
|
||||
# Index
|
||||
{index}
|
||||
|
@ -18,7 +26,7 @@ HEAD = '''{begin} mbinary
|
|||
# File : {name}
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: {ctime}
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : genReadme.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-11 15:53
|
||||
# Description:
|
||||
|
@ -17,7 +17,7 @@ from config import README
|
|||
parser = ArgumentParser()
|
||||
|
||||
parser.add_argument('-p','--path',default='.',help='path to walk')
|
||||
parser.add_argument('-f','--fileinclude',action='store_true',help='if has, list files and dirs, else only dirs')
|
||||
parser.add_argument('-f','--fileinclude',action='store_true',default=True,help='if has, list files and dirs, else only dirs')
|
||||
parser.add_argument('-d','--depth', type = int, default = 2)
|
||||
#获取参数
|
||||
args = parser.parse_args()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : headInfo.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-07-08 14:48
|
||||
# Description:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# File : tree.py
|
||||
# Author: mbinary
|
||||
# Mail: zhuheqin1@gmail.com
|
||||
# Blog: https://mbinary.coding.me
|
||||
# Blog: https://mbinary.xyz
|
||||
# Github: https://github.com/mbinary
|
||||
# Created Time: 2018-12-11 15:56
|
||||
# Description:
|
||||
|
|
Loading…
Reference in New Issue
Block a user