wolverinn / iridescent Goto Github PK
View Code? Open in Web Editor NEWSolid data structure and algorithms
License: GNU General Public License v3.0
Solid data structure and algorithms
License: GNU General Public License v3.0
def select_sort(lst):
if not lst:
return []
for i in range(len(lst) - 1):
smallest = i
for j in range(i, len(lst)):
if lst[j] < lst[smallest]:
smallest = j
lst[i], lst[smallest] = lst[smallest], lst[i] #已更正
return lst
def insert(self, key, value):
index = self.hash_code(key)
head = self.table[index]
if not head: # 如果哈希表对应位置还是空的
self.table[index] = listNode(key, value)
else:
while head.next:
head = head.next
head.next = listNode(key, value)
这里insert重复的key,是有问题的
首先非常感谢作者的分享,但我在阅读过程中发现了几处难以理解的地方。
在B树那一部分内容第一点的最后一段中,作者写道:
在这类应用中,磁盘IO的速度已经远远超过了读取到数据之后在内存中进行处理的速度,所以提升速度的关键是减小磁盘IO。
以上是文章原话,个人认为应该改成“磁盘IO的时间已经远远超过了读取到数据之后在内存中进行处理的时间”。
如果我的理解出现错误,希望作者能帮我具体指出。谢谢。
作者写得不错,很感谢笔记的分享,这对复习和快速的准备很有帮助。
(个人看法)感觉红黑树那里可以建议看Algorithms第4版,因为我对比了一下Introduction to Algorithm和Algorithms第四版的引入,感觉后者那种把左倾红黑树作为2-3树(3阶B树)的二叉树表现形式的观点似乎更容易记忆;把3节点的2个key拆开,左边为红色右边为黑色,因此红色的节点表明和parent节点等black height;新插入的节点作为红色是为了假设它和parent节点等高, 插入之后的一系列操作可以理解是3节点变成4节点之后的分裂和中间节点的上升等等。
当然,这也可能是是因为我对经典红黑树理解不能...感觉四条性质放下来很抽象。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.