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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Ipython notebook of data structures and algorithms with unit tests

4 点作者 pattu777超过 8 年前

1 comment

dalke超过 8 年前
These appear to be homework assignments from someone in a first course in data structures. I would not advise people to use this for their own study.<p>The hash table, for example, uses 10 (or a user-defined) set of static chains. This is what <a href="https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;Data_Structures&#x2F;Hash_Tables#Chaining" rel="nofollow">https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;Data_Structures&#x2F;Hash_Tables#Ch...</a> calls &quot;the simplest chained hash table technique&quot;. The stack implements peek() as &#x27;self.arr[len(self.arr)-1]&#x27; instead of &#x27;self.arr[-1]&#x27;.<p>In general, it returns errors by printing a message rather then returning an error code or raising an exception. It also doesn&#x27;t hook into Python built-in methods like __len__.<p>The unittests use __init__() to set up data, rather than setUp() or tearDown(). For that matter, in the tests I looked at the data should be local to the test function, and not through a self.instance variable.