Python论坛  - 讨论区

标题:[python-chinese] 一个概念问题

2006年07月14日 星期五 09:52

linda.s samrobertsmith at gmail.com
Fri Jul 14 09:52:21 HKT 2006

python里的 list.sort的内核是不是用 tree的?
例如:
>>> test=[3,5,8,1]
>>> test.sort()
>>> test
[1, 3, 5, 8]

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月14日 星期五 10:08

刘鑫 march.liu at gmail.com
Fri Jul 14 10:08:52 HKT 2006

sort是用的快速排序法,在Python的文档里有介绍。list的内部结构我就不清楚了,Robert在这方面比较有研究:)

在06-7-14,linda. s <samrobertsmith at gmail.com> 写道:
>
> python里的 list.sort的内核是不是用 tree的?
> 例如:
> >>> test=[3,5,8,1]
> >>> test.sort()
> >>> test
> [1, 3, 5, 8]
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060714/0297e75a/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月14日 星期五 12:44

linda.s samrobertsmith at gmail.com
Fri Jul 14 12:44:17 HKT 2006

这个快速排序法比tree快吗?

On 7/13/06, 刘鑫 <march.liu at gmail.com> wrote:
> sort是用的快速排序法,在Python的文档里有介绍。list的内部结构我就不清楚了,Robert在这方面比较有研究:)
>
> 在06-7-14,linda. s <samrobertsmith at gmail.com > 写道:
> >
> python里的 list.sort的内核是不是用 tree的?
> 例如:
> >>> test=[3,5,8,1]
> >>> test.sort()
> >>> test
> [1, 3, 5, 8]
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> --
> 欢迎访问:
> http://blog.csdn.net/ccat
>
> 刘鑫
> March.Liu
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月15日 星期六 11:25

Robert Chen search.pythoner at gmail.com
Sat Jul 15 11:25:36 HKT 2006

list内部结构与C++中的vector相似

On 7/14/06, linda. s <samrobertsmith at gmail.com> wrote:
>
> 这个快速排序法比tree快吗?
>
> On 7/13/06, 刘鑫 <march.liu at gmail.com> wrote:
> > sort是用的快速排序法,在Python的文档里有介绍。list的内部结构我就不清楚了,Robert在这方面比较有研究:)
> >
> > 在06-7-14,linda. s <samrobertsmith at gmail.com > 写道:
> > >
> > python里的 list.sort的内核是不是用 tree的?
> > 例如:
> > >>> test=[3,5,8,1]
> > >>> test.sort()
> > >>> test
> > [1, 3, 5, 8]
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> >
> > --
> > 欢迎访问:
> > http://blog.csdn.net/ccat
> >
> > 刘鑫
> > March.Liu
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Robert
Python源码剖析――http://blog.donews.com/lemur/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060715/35d8dbd0/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月15日 星期六 15:23

linda.s samrobertsmith at gmail.com
Sat Jul 15 15:23:35 HKT 2006

那它比tree快吗?


On 7/14/06, Robert Chen <search.pythoner at gmail.com> wrote:
> list内部结构与C++中的vector相似
>
>
> On 7/14/06, linda. s <samrobertsmith at gmail.com> wrote:
> > 这个快速排序法比tree快吗?
> >
> > On 7/13/06, 刘鑫 <march.liu at gmail.com> wrote:
> > >
> sort是用的快速排序法,在Python的文档里有介绍。list的内部结构我就不清楚了,Robert在这方面比较有研究:)
> > >
> > > 在06-7-14,linda. s <samrobertsmith at gmail.com > 写道:
> > > >
> > > python里的 list.sort的内核是不是用 tree的?
> > > 例如:
> > > >>> test=[3,5,8,1]
> > > >>> test.sort()
> > > >>> test
> > > [1, 3, 5, 8]
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to
> > > python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info:
> > > http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> > >
> > >
> > > --
> > > 欢迎访问:
> > > http://blog.csdn.net/ccat
> > >
> > > 刘鑫
> > > March.Liu
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to
> > > python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info:
> > > http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
>
>
> --
> Robert
> Python源码剖析――http://blog.donews.com/lemur/
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月15日 星期六 18:06

Robert Chen search.pythoner at gmail.com
Sat Jul 15 18:06:52 HKT 2006

tree? 什么tree? 一般的tree还是binary tree? 一般的binary tree还是如RB Tree一样的balanced
binary tree?

list不是以快速排序为核心设计目标的,没有tree快也在情理之中。

On 7/15/06, linda. s <samrobertsmith at gmail.com> wrote:
>
> 那它比tree快吗?
>
>
> On 7/14/06, Robert Chen <search.pythoner at gmail.com> wrote:
> > list内部结构与C++中的vector相似
> >
> >
> > On 7/14/06, linda. s <samrobertsmith at gmail.com> wrote:
> > > 这个快速排序法比tree快吗?
> > >
> > > On 7/13/06, 刘鑫 <march.liu at gmail.com> wrote:
> > > >
> > sort是用的快速排序法,在Python的文档里有介绍。list的内部结构我就不清楚了,Robert在这方面比较有研究:)
> > > >
> > > > 在06-7-14,linda. s <samrobertsmith at gmail.com > 写道:
> > > > >
> > > > python里的 list.sort的内核是不是用 tree的?
> > > > 例如:
> > > > >>> test=[3,5,8,1]
> > > > >>> test.sort()
> > > > >>> test
> > > > [1, 3, 5, 8]
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese at lists.python.cn
> > > > Subscribe: send subscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Detail Info:
> > > > http://python.cn/mailman/listinfo/python-chinese
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > 欢迎访问:
> > > > http://blog.csdn.net/ccat
> > > >
> > > > 刘鑫
> > > > March.Liu
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese at lists.python.cn
> > > > Subscribe: send subscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Detail Info:
> > > > http://python.cn/mailman/listinfo/python-chinese
> > > >
> > > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
> >
> >
> > --
> > Robert
> > Python源码剖析――http://blog.donews.com/lemur/
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Robert
Python源码剖析――http://blog.donews.com/lemur/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060715/20fd187c/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月15日 星期六 19:49

swordsp sparas2006 at gmail.com
Sat Jul 15 19:49:19 HKT 2006

这个问题不是简单的"是"或者"否"可以回答的,如你的邮件标题所说,这里有两个概念问题需要先弄清楚:

1. 什么是tree?
tree是一类数据结构的统称,有许多种不同的实现,各自的效率都不一样,不可一概而论。

2. 什么叫做"快"?
第一,快与慢是针对具体的基本操作而言的,诸如查找、排序、增加、删除等等。我们说一个数据结构有多快,实际上是分别说它查找有多快、排序有快、增删元素有多快……
因为应用场景的不同,有的时候我们只用到查找,我们觉得A比较快,有时候用到增删操作多一些,这时候又是B比较快。
第二、通用的衡量一个数据结构(或者算法)快慢的标准是时间复杂度,但是这个标准也不是确定的。同一个数据结构同样的操作,因为应用场景中数据的统计分布不同,效率也可能有显著差异。数据量大和小,也可能引起差异。快速排序理论上的时间复杂度也是普通的O(n*log(n)),同一级别的排序方法还有很多,甚至快排在最坏情况下还可能颠簸降到O(n^2)。但因为它的常数比较小,所以在实际应用场景中的平均速度就是最快的。

如果这两个问题你觉得自己还没有完全想明白的话,建议你找一本专门的数据结构或者算法的书先通读一遍。看你这些天来发的邮件,似乎是在从基础的东西学起而不是只图尽快入门,如果是这样的话那么基础打扎实一点有百利而无一弊。

On 7/15/06, linda. s <samrobertsmith at gmail.com> wrote:
>
> 那它比tree快吗?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060715/c1fca988/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号