Git Product home page Git Product logo

core-algorithm's Introduction

飞污熊算法笔记 - python3实现

算法参考书籍列表,建议按照顺序阅读:

  • 《Hello算法》
  • 《算法图解》
  • 《啊哈算法》
  • 《算法导论》
  • 《labuladong的算法小抄》
  • 《人工智能算法图解》

章节说明

  1. 【第一章】基础数据结构:数组、链表、队列、栈、哈希表。
  2. 【第二章】树数据结构:二叉树、红黑树、递归树、堆。
  3. 【第三章】图数据结构
  4. 【第四章】各类排序算法:(冒泡、插入、选择)、(快排、归并)、(桶、计数、基数)。
  5. 【第五章】各类搜索算法:二分查找、调表、散列表、哈希算法
  6. 【第六章】字符串匹配算法
  7. 【第七章】分治算法
  8. 【第八章】回溯算法
  9. 【第九章】动态规划算法
  10. 【第十章】贪心算法
  11. 【第十一章】高级数据结构和算法
  12. 【第十二章】AI算法
  13. 【第十三章】算法示例程序
  14. 【第十四章】LeetCode刷题记录

作者的话

书中经典的算法示例使用python3语言实现。

整个工程分为三个部分。第一部分是阅读经典算法书籍后自己的总结,作为基础算法部分。 第二部分是人工智能AI算法示例,第三部分是自己在LeetCode上面的刷题总结。

从2013年就开始写这个系列,写到动态规划后就停了,那段时间实在是太懒了。 今年2020年开始决定继续把之前的捡起来,重新更新这个系列,做事情得有始有终,希望能把这个系列坚持写完。

有任何问题都可以联系我:

欢迎关注我的个人公众号“飞污熊”,我会定期分享一些自己的Python学习笔记和心得。

公众号

How to Contribute

You are welcome to contribute to the project as follow

  • add/edit wiki
  • report/fix issue
  • code review
  • commit new feature
  • add testcase

Meanwhile you'd better follow the rules below

  • It's NOT recommended to submit a pull request directly to master branch. develop branch is more appropriate
  • Follow common Python coding conventions
  • Add the following license in each source file

License

(The Apache License)

Copyright (c) 2013-2020 Xiong Neng and other contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

core-algorithm's People

Contributors

nonocoke avatar pluieciel avatar yidao620c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core-algorithm's Issues

快速排序的一些疑问

def __quickSubSort(seq, p, r):
"""递归版本的"""
global num
num += 1
print(num)
if p < r:
# q = __partition(seq, p, r)
q = __randPartitions(seq, p, r)
__quickSubSort(seq, p, q - 1)
__quickSubSort(seq, q + 1, r)

def __quickSubSortTail(seq, p, r):
"""循环版本,模拟尾递归,可以大大减少递归栈深度,而且时间复杂度不高"""
global num
num += 1
print(num)
while p < r:
q = __randPartitions(seq, p, r)
# q = __partition(seq, p, r)
if q - r < r - q:
__quickSubSortTail(seq, p, q - 1)
else:
__quickSubSortTail(seq, q+1, r)
r = q - 1

我对比了下这两个函数的num值,发现你底下的这个版本递归深度是大于上面的递归版本的啊?是我理解错了吗?尤其是你__randPartitions版本的整整递归了几百次?是不是我测试错了?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.