由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - can somebody help me with average running time of insertion sort?
相关主题
问一个严肃的实用问题问一个基本问题
Re: 有娃有老公,但是却感觉自己什么都没有。 (转载)如何 randomize 一个sorted的文件 ?
underlying sort algorithm for SET in STL?如何sort and merge n 个sorted linked list
一道C++面试编程题嵌入式系统用什么sorting算法比较好?
有人能解释一下这段C++代码吗如何让python dictionary sorting 的速度变得很快?
A STL sorting algorithm problemstandard C++ lib.
帮帮看看这段tree insertiontemplate question
[合集] 如何得到一个指向STL元素的指针?somebody used logsys before?
相关话题的讨论汇总
话题: average话题: running话题: time话题: insertion话题: me
进入Programming版参与讨论
1 (共1页)
t**********s
发帖数: 930
1
How can I prove that it is Ω(n^2)
Too difficult for me.
Thanks!
q*****g
发帖数: 72
2
worst case:
(n-1) + (n-2) + ... + 1 = n*(n-1)/2 = O(n^2);
average case is just half of worse case, which is also O(n^2)

【在 t**********s 的大作中提到】
: How can I prove that it is Ω(n^2)
: Too difficult for me.
: Thanks!

t**********s
发帖数: 930
3
I don't think that it is so simple.
It should be the running time on a array randomly permuted.
Say an array has n elements. Then there is n! possible arrays.
The average running time should be the average of the n! possible running
time.

【在 q*****g 的大作中提到】
: worst case:
: (n-1) + (n-2) + ... + 1 = n*(n-1)/2 = O(n^2);
: average case is just half of worse case, which is also O(n^2)

g**g
发帖数: 1575
4
find an algorithm book to read first... that saves you a lot of time

【在 t**********s 的大作中提到】
: I don't think that it is so simple.
: It should be the running time on a array randomly permuted.
: Say an array has n elements. Then there is n! possible arrays.
: The average running time should be the average of the n! possible running
: time.

1 (共1页)
进入Programming版参与讨论
相关主题
somebody used logsys before?有人能解释一下这段C++代码吗
Google test engineer求内推 (转载)A STL sorting algorithm problem
好了。终于把3-way qsort完成标准优化了:)帮帮看看这段tree insertion
non-aggregate type问题[合集] 如何得到一个指向STL元素的指针?
问一个严肃的实用问题问一个基本问题
Re: 有娃有老公,但是却感觉自己什么都没有。 (转载)如何 randomize 一个sorted的文件 ?
underlying sort algorithm for SET in STL?如何sort and merge n 个sorted linked list
一道C++面试编程题嵌入式系统用什么sorting算法比较好?
相关话题的讨论汇总
话题: average话题: running话题: time话题: insertion话题: me