TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Pygorithm – A Python module for learning major algorithms

191 点作者 PleaseHelpMe将近 8 年前

8 条评论

tu7001将近 8 年前
I have few Python algorithms and data structures here: <a href="https:&#x2F;&#x2F;github.com&#x2F;lion137&#x2F;Python-Algorithms" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;lion137&#x2F;Python-Algorithms</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;lion137&#x2F;Python-Data-Structures" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;lion137&#x2F;Python-Data-Structures</a> You can use them if you want to extend a bit your; all tested and working (as far as I know). Let me know if you need me to add any comments&#x2F;explanations to code...
wiz21c将近 8 年前
In the binary search algorithm :<p>mid = (left + right) &#x2F;&#x2F; 2<p>It would be nice to have a discussion on why you used &#x2F;&#x2F; instead of &#x2F;. Depending on who reads your code, explaining this &quot;obvious&quot; choice might be interesting.<p>There are also other discussions topic : what happens if the array is empty ? what happens if the array is twice the size of the computer&#x27;s RAM ? What happens if all the numbers in the array are equal ?
评论 #14958507 未加载
teddyh将近 8 年前
If something is a “major” algorithm, isn’t this just like a “Design Pattern”, in that it really is something which should be built into the language, and ideally isn’t something you should implement yourself?<p>In fact, all of these seem to be ones that are actually built into Python already.
评论 #14957462 未加载
评论 #14958760 未加载
评论 #14958417 未加载
评论 #14957386 未加载
wooptoo将近 8 年前
Here is a fun one-liner quicksort in Python:<p>def q(list): return [] if list==[] else q([x for x in list[1:] if x &lt; list[0]]) + [list[0]] + q([x for x in list[1:] if x &gt;= list[0]])
评论 #14956316 未加载
评论 #14956195 未加载
thesmallestcat将近 8 年前
What is a &quot;major&quot; algorithm? This repo is pretty light, so the bar must be high.
评论 #14957640 未加载
hakcermani将近 8 年前
This is a neat learning tool. Will recommend to those starting out. A couple of suggestions if you have the time or will try to send a pull (!) .. 1) A built in dataset (numbers, chars, wordlist) 2) a single step mode
bogomipz将近 8 年前
This is great! If I could make a suggestion it would be to add the space complexity of each algorithm to the comments(the time complexity is already there.)
ssijak将近 8 年前
Once upon a time I made a Github repo with the same name and intention <a href="https:&#x2F;&#x2F;github.com&#x2F;ssijak&#x2F;pygoritm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ssijak&#x2F;pygoritm</a><p>It is sitting there alone... abandoned... Sorry poor repo that I never made something big from you. You deserve much more stars (p.s. don&#x27;t tell him that the only one is from me) :(