用python只做web开发,自带的数据结构足够我现在使用。
不过想把关于算法这块的东西从c转到python,不明白python实现链表应该怎么做。写成一个class?怎么写才算是python风格呢?
不过想把关于算法这块的东西从c转到python,不明白python实现链表应该怎么做。写成一个class?怎么写才算是python风格呢?
|
1
要是做作业,你完全可以按照数据结构的作业搞个Python版的链表。
但是Python不需要去实现链表,我记得水木上有个讨论来着: http://www.newsmth.net/nForum/#!article/Python/73818?p=10 |
|
2
@swulling 不是作业。只是忽然有这么一个想法。不知道Python里面用什么来代替C的指针,同时也不知道用什么东西代替malloc来分配链表元素所需要的空间
|
|
4
|
|
5
为什么会要指针啊malloc呢,this.next = Node()不就可以了么;
|
|
6
|
|
venglideApr 19, 2013
7
我给楼主推荐一本python算法的书:Python Algorithms Apress
|